There is quite a mess with the documentation. Most of it talking about how to do something an “old” way. There is documentation talking about “new” way. Just a few weeks ago that “new” way documentation was relocated and it looks like certain things were removed. I’d like to ask about creating of a virtual device that recently was described on this page SmartThings Developers | Documentation (bingj.com). It is from the search engine cache. Is it still possible in the Developers Workspace? I cannot find many things described in that cached article. Where is a new page talking about creating virtual devices?
The old page is still indexed in a search engine but I cannot file a new one.
I need to create a completely custom virtual device. Not a virtual switch. I need it for better structuring of automation. Maybe I’m wrong in my thinking, let me know if there is a better way to do that, again in a “new” way using Rules API etc. I wanted to have a few sensors, then I wanted to aggregate an information from the few sensors in a virtual device using a rule. Then I wanted to have other rules using that virtual device attribute and doing something to other devices.
I can give you a simplified example. Let’s say I have a light sensor or a few of them. I decided to create an algorithm to translate the numeric values from those sensors into a descriptive value like: dusk, earlyNight, night, dawn, earlyMorning, morning, brightDay and so on. Then I will use that value in other rules in other complex expression. So, I was thinking why don’t I create a virtual device with an enum attribute for than and corresponding commands with all those values. Then I create a rule and put an algorithm there to set those properties on that virtual device. Then I would use that virtual device values in other rules.
Why I want this virtual device? Because I want many rules to use the attribute from that virtual device and I don’t want to repeat the algorithm that I have in the rule reading light sensors in all the rules.