Difference between physical and virtual contact

This is not important to me, but just an attempt to learn.
I have two identical rules. The only difference is that in rule 1 I have two physical switches and in rule 2 the physical switches are replaced by virtual switches.
Simple rule - when I press one switch I should be able to see the value 99 in my variable, and when I press the other switch I should be able to see the value 44.
In rule 1, I get the value 99 REGARDLESS of which switch I press.
In rule 2, I get the value 99 when I press one switch and the value 44 when I press the other switch.
What have I overlooked?


Hi William-
Thanks for posting.

I would clarify that the device types in your rule screenshots appear to be different than your description. The first one appears to be Buttons rather than switches and the second appears to be True/False Variables rather than switches.

This is an important distinction as the logic you’ve used with the first rule (buttons) won’t work as expected since a button press is more like an event, but some platforms still retain the last event as the state. In other words, the Dimmer A button will always appear ‘pressed’ unless another event type replaced it like ‘held’.

For this kind of rule design, it’s better to use Context Variables to determine which type of event triggered the rule and use that directly in your condition. You can find details on this approach from our previous discussion:

:link: Button Rules and Determining Which Button Was Pushed - #4 by josh