I have some automations that trigger scenes at certain times of day. I.E Dimming lights in the evening.
If the lights have been manually adjusted and no longer match a specified scene, I’d like to override the automatic transition. (E.G maybe I’m working on something and need max brightness which I’ve manually set - I don’t want the lights to dim automatically)
To do this, it would be nice if there was a function to confirm if a scene is currently active (I.E all entity values match those in a scene) and even better if it returned the active scene name.
The only way to achieve this I found is to use input_text and to set its value every time you activate the scene to value that represent actual state. Then also fo all manual action (I guess triggered by some switches, but being scripts or automations) you also add actions to change value of this field, to record manual change. Might be a lot of work to adjsut all automations/scripts
Other solution is to assume that certain values of entities are representing specific states (e.g. while triggering script or automation you check what is actual brightness and assume scene selection from this value). This is definitelly more complex and might be also less reliable solution…
I would love to see this in the future. As far as a scene only defines device or entity states, it would be fantastic to have an attribute at the scene entitiy. Maybe something like ‘isFullfilled: true’. At the moment a device or entity changes and does not match anymore, it would get the value ‘false’.
We have that information already. This way it would not bei necessary to create helpers for every Single scene.
I would like to take it a big step further: What if every event in HA was logged in a graph db or similar for a set number of events in the past? If that was the case we could instantly get any states and what caused that state.
One simple use for this ability would be to tell if a scene is “active” based on what is the expected states for that scene. Another use for this is to revert to a previous state: You have a scene that sets the house into night mode (most lights are off, some are on and some are dimmed). You have a motion sensor that trigger a scene in a part of the house (dimmed light in the hallway). When motion stops and there’s no need for lights in the hallway HA would be able to set the lights back to its previous state regardless of changes done in other parts of the house after night mode was initiated.
And there’s limitless of other possibilities by implementing this, like reporting states to other systems/frontends like HomeKit.
A feature (example attribute: scene.inEffect) that ingests a newly-modified scene, subscribes to any states mentioned within it, evaluates those states against current states and summarizes to “actual states match states described in scene”=true/false, that re-starts when the scene itself is edited. Example: For scene “kitchen lights, dim”, where brightness = 20 for each light; if applied/turned on, scene.inEffect would evaluate to true; then, if one or more lights were “manually” set to brightness = 100, then the scene.inEffect attribute would evaluate to false. Also, if (for example) one of the lights were off-line when the scene was applied, it would not be true, as the scene is not fully in effect.