Variable usage question


#1

Is the device name stored in a variable? For example, if I set my “virtual battery sensor” to 10% and trigger this piston, I would like to display the devices name. Or whatever devices is causing the trigger. I tried using {$device} but that did not work. {$time} worked did work.

-Thanks

image


#2

You can use [device : attribute] to obtain details of a device, but, I don’t think device name is an attribute. No idea why, it would be useful. If you start typing in the expression editor, once you enter the :, a list of available attributes is displayed.

When I’ve wanted to do this, I use two arrays, one of devices, and a string array of device names. You can then get the index odd the current device, and use that to access the name.


#3

So if you have hundreds of devices, I would need to create an array of devices including all of them?


#4

You create a device variable and store all the devices in it then loop through the list.