Distinguishing Physical vs Digital and set Virtual Switches

Disclaimer, this may not work 100% on all devices, for example if turn the switch on Physical, then off via digital, then do a physical off, the devices I have do NOT report the physical off because it is already off. If the device supports CentralScene might be able to capture the on/off physical presses via buttons instead of the state. Maybe I will do another example using the buttons for the physical. Or if anyone has any ideas how to do this better let me know.

Purpose of this is to try and separate the SW and Relay on/off states on a Zooz ZEN16 when using the Parameter 12-14 setting of (2) so the SW does not actually turn on the relay on/off but still reports.

Global variable to track the last time we got a physical event (in ms).

Using the Physical Switch trigger, setting the global variable to the time in ms.

Here is the complicated part, in another rule that triggers on any switch event I have two local variables to calculate the time difference from the last physical change. If its less than 500ms I assume this rule was triggered physical, and if > 500 I assume it was a digital trigger. The "Laundry Physical" and "Laundry Digital" are virtual switches. The delay of 0.1 seconds is to make sure the other rules has time to trigger and update the global var if it was a physical change.

Local vars on this rule

1 Like

Download the Hubitat app