Can Edit Condition utilize a variable to represent a physical device On or Off State?


I am using the Edit Condition builder to create a condition comparing the state (On or Off) of a physical device (light switch). In the command builder, in the “compare to” section, if I select “Value”, it shows me a predefined list of “On” or “Off”.

I would like to utilize a “Variable” (rather than a Value) to make this comparison more generic (ie, the variable would indicate whether the device state is being compared to On or Off).

But, I have tried using boolean, integer and string variable values, and nothing seems to satisfy the compare. Is there a way to accomplish this? I could write separate On and Off sections of code, but would prefer to make this more generic. Appreciate any suggestions.


Not sure if I’m understanding the question properly… what if you use an Expression to do the comparison?

If [device:switch] == 1 is true
  Log to console Device is on


I am trying to do a more complex loop to ensure multiple switches are all turned ON or OFF (despite zwave inconsistency).

The IF condition looks like the following:
{theSwitches} switch is off
save matching devices to {switchesStillOff}
[more code to turn them On, increment loop counters, etc]

The result is that if ANY of the theSwitches are off, they will be saved into another device list.
Then I repeatedly turn them On until they are eventually all turned On.

This is a complex IF condition in which the command builder lets you define a comparison between the state of physical devices and something else. My question relates to the “compare to” section in which you can compare the state of light switches to a “value” (predefined list of On and Off in the case of a physical device that is a “switch”) or to something else like a “variable.”

But it doesnt appear to allow the On or Off “value” to be defined in a variable.