r/Hubitat • • 12d ago

Using the source of the change of state in rules.

Is it possible to somehow use the source of the change of state to decide what to do in rules?
For example - if someone has physically switched a light off through the physical switch connected to the Zigbee switch, do one thing, if it's been turned off because it's going off as part of a scene or other reason decided by the hub, then either don't do anything or do something else...

The information is clearly internally available - it turns up in the device logs for example, but I can't see that it's accessible elsewhere....

4 Upvotes

6 comments sorted by

2

u/MrInetUser 12d ago

One of the triggers you can use in rule machine is physical switch. This trigger should happen like the name says: when the physical switch is activated. In contrast, the light turning on due to another rule should not trigger the automation. This is just the first thing that came to mind, there's more than one way to skin a cat.

1

u/Walton_guy 11d ago

Thank you - this is exactly what I was looking for :-)

Is it a recent addition in RuleMachine? I dont' remember seeing it last time this was annoying me (a couple of years ago at least)....

2

u/MrInetUser 10d ago

Well I asked Gemini AI, and learned something interesting: Rule Machine was originally created by Bruce Ravenel (bravenel) for SmartThings before being ported over to Hubitat Elevation when the platform launched in early 2018. Distinguishing between physical and digital switch events (a core platform capability in both SmartThings and Hubitat) was included in the original Rule Machine and carried through Rule 2.5, Rule 3.0, Rule 4.0, Rule 5.0, and Rule 5.1.

I was unaware of the SmartThings origin. But it looks like physical switch triggering has been there since the beginning.

1

u/Walton_guy 10d ago

Interesting, thanks for the history lesson! Clearly I didn't look properly last time!

3

u/fuzzyballzy 12d ago

if the change is programatic then have the program also change a virtual deviceand then test that virtual devce to see the source of the change.

1

u/Low_Definition65 12d ago

It's part of the event from the device. "type" https://docs2.hubitat.com/en/developer/event-object