Homey Community Forum

Possible to detect physical vs software state change?

Like the topic says…Is it possible to know if a switch (or whatever) was triggered by a physical touch or by a software command?

For instance - in my home office my monitors turn on when the ceiling lights turn on. The ceiling lights also turn on if the main switch inside my front door is turned on. If I’m not at home, I don’t want the monitors to turn on unless the switch in my home office is turned on manually. There are more instances where something like this would be nice, though, so other solutions to this single one isn’t the purpose of this post. :slight_smile:

You would need to make flows that detect said changes. You mentioned software vs physical, so I think you would also need to make use of virtual devices to activate the light switch desperately in a flow. As that physical smart switch will have a respective device tile/button in Homey.

Ie for my case, i made a virtual group device that turn on only if all the device in that group is on. With the group app of course.
Then the corresponding flows can either notify me if said group is on and trigger other flows.

You can also use the sets app if you have different switching combinations…

I’m not sure I’m following you here. How will that let me detect a physical/programatic state change? I need a state change in the switch to actually switch the lights on/off, and it doesn’t seem like the app differentiates…But please elaborate it this is a working solution :slight_smile:

I have similar flows but mine’s a little more complex as I use it as a toggle to expand my aqara wireless to have more sequence with the sets app.
For your example I will use a countdown timer, but if you like to use the sets app, you can use the flow card activate state temporarily. You can also use a Boolean variable and flip that in your flows.

You create a virtual device, name it X switch as your programatic switch.

You also have physical switch that is reflected in homey as a device named light switch

Flow for programmatic switch to on light switch.
When X switch is turned on
Then start countdown time 15s and turn on light switch

For physical switch to turn on ceiling light, assuming it’s not the load of the `light switch

When Light switch is turn on
And countdown is not running
Then Turn on ceiling Light
And push notification physical switching.
ELSE
Turn on ceiling Light
And push notification programmatic switching.
stop countdown

The differentiator here is the countdown that lets you know which switch is first to trigger and it’s important to kill the countdown as you cascade to the next flow.

I use sets And countddown timers a lot for all my single button to toggle my flows if its not possible to use global tags or just tracking states is not possible.

Cool, thanks :slight_smile: