Let’s say I have an automation to turn on lights on motion… Great this is easy todo…
Now let’s say that I want to add a condition to not turn on the lights if the light was manually turned off (last state change) within a window of say half hour… It’s near impossible to do this and it should be easy.
This should be really common use case for automations, I could think almost anyone would want to do this with light automations. But it’s not straight forward and is undocumented. It also doesn’t consistently work. I’ve tried for 4 hours to get it to work looking at the context table and couldn’t get it to work across my switch as light group or by checking three different lights that are turned on by a single automation. I’ve given up. This should be super simple, tell me who made/how the last state change(d) and store it on the physical state as an attribute.
It’s super frustrating the ID’s given to what last changed a device. I believe it just says the HA user but nothing else.
It should display if an automation last changed it, a human manually changing it, whatever it is. Would make trouble shooting and adding conditions to automations so much better, and the resulting automations would be a lot smarter as a result.
I’ve tried this, and it was not consistent as explained in my first post. I haven’t had time to narrow this down and see if it’s happening across all my devices / light (switch as) groups. But this post still stands WTH is this so HARD. This should be a simple state attribute that gets set. Tell me what made the last state change, let me use it as a trigger! HA is for automating, this makes automating based on how a device changed really hard and not intuitive to a massive portion of the user base. If it was something stored in state attr, you could pick it from a dropdown action in the automation editor…
Regardless of the validity of this WTH, the only data home assistant can ever see is:
Physical/Outside source/Unknown source. Basically anything state update that comes from outside HA. You can’t separate these, it’s impossible.
User acted on in the UI - If a user is logged into HA and presses a control in the UI or calls a service.
<entity_id> envoked. If a service was called via a script, automation, or scene.
Anything outside of those 3 options is impossible as the context just doesn’t exist, even with code changes you will never be able discern (for e.g.) who pressed a physical button unless the device itself can somehow recognize the person who pressed the physical button.
There is a WTH for a condition that makes it easy to check if a user and/or automation invoked the trigger.