String Variable with Embedded Device Attribute



I recently had to replace a faulty sensor [Den Sensor]. The sensor’s illuminance attribute is used in several pistons. I designated the ‘Sensor’ device in the ‘Define’ section at the top of the pistons. I also defined a number of string variables with [Den Sensor : illuminance] using expressions so they can be used in logs, emails, etc. Here’s the Define section for reference:

All of this works fine normally. When I changed the Den Sensor device, I also edited the piston and made sure the ‘Sensor’ device variable pointed at the new sensor. This also worked OK.

However, the string variables with embedded expressions did not work OK - with the error that the variable [Den Sensor : illuminance] was not found. I was able to fix this by re-inputting (choosing from the device pull-down) each of the embedded expressions to ensure they used the new device and then I saved each one and then the entire piston.

Was doing that editing of the expressions necessary or could I just have opened each definition line and then resave it (without actually editing it)?


Since you already had the Den Sensor defined as device variable, my suggestion would have been to use [Sensor:illuminance] in your expressions.


Excellent suggestion! That would have avoided the need for my question in the first place. I’m off to do that now. Thank you!