Dynamic scenes (i.e. created with scene.create
) are awesome! Particularly those which use snapshot_entitites
, as they provide me with a way to temporarily override a “stable” state with a context-aware one, while still giving me the option to “undo” the automation and go back to the stable state by activating the dynamic scene.
However, in order not to use several helpers, I would like to have 2 extra features for these dynamic scenes:
- the ability to delete them explicitly, without reloading the
scene
integration - the ability to “extract” a scene and “look” inside at the saved states of entities, specifically those saved with
snapshot_entities
, for which I don’t know what the state was at the time of creating the scene
Here’s a use case I’m having trouble with: I have individual climate control and window sensors in all rooms, as well as an outside temperature sensor. I would like to:
- be able to alter the set temperature when the window is open for a while (to debounce short openings) and notify family members about it
- they can choose to “undo” the automation if, for example, the window is left open on purpose, with the desire to heat the room knowing about the energy waste
- go back to the initial state either when
- the window is closed (also with a debounce time)
- a family member has expressed their desire to “undo” the automation
- if, during the temporary override, someone sets a new temperature on the thermostat, don’t revert to the initial state upon closing the window and don’t adjust the temperature down upon external temperature variation, just consider that this is the new “stable” state
- a while after the automation was undone either by expressing the desire to undo or by manually altering the set temperature (e.g. several hours, let’s call it “override cooldown”), the automation should re-start to turn down the thermostat, as maybe whoever has set the temperature forgot they did and energy is being wasted for more time than they had planned
If I could delete dynamic scenes and check the states inside them, my automation would be relatively simple (considering my climate control is in heating mode):
- variables:
- “stable” set temperature: the thermostat temperature if a scene doesn’t exist, else the temperature of the thermostat snapshot in the scene
- triggers:
- window open or closed
- outside temperature changes
- set temperature changes
- actions
- if the window opens and the set temperature is above the outside temperature and the snapshot scene doesn’t exist or it exists and has never been activated (
state=="unknown"
)- take a snapshot of the thermostat
- save it in a scene or overwrite the existing scene
- turn down the thermostat
- notify about the change, with the ability to “undo”, in which case activate and delete the dynamic scene
- if the window closes, the scene exists, has never been activated and the stable set temperature (i.e. in the scene) is above the outside temperature
- activate the scene
- delete the scene
- if the scene exists and the set temperature is altered
- recreate the scene with the new thermostat temperature (manual override)
- activate the scene (no effect except for scene state)
- if the scene exists and has been activated for longer than the override cooldown
- delete the scene
- re-run the automation
- if the window opens and the set temperature is above the outside temperature and the snapshot scene doesn’t exist or it exists and has never been activated (
Notice all the “scene exists” conditions. The automation may look long, but it’s actually pretty straightforward considering the desired scenario complexity. This would be an automation blueprint that can be instantiated for each room with its own thermostat and window sensor.
I know that all this can be achieved with helpers, but I would have to create a couple of helpers for each room, which adds up to a lot. Plus the automation(s) would be much, much longer.
Having the ability to delete dynamic scenes would also help with creating blueprints that others can use for a similar task without having to instruct them how to create helpers.