I’d like to draw everyone’s attention to a useful new option in this release, called snapshot_entities
, that simplifies creating scenes on the fly. It was created by Santobert in PR 28939 and is an enhancement to scene.create
.
The use-case is when you want to:
- Record the current state of several entities before you change them to something else.
- Change them to something else.
- Restore their states to their previous values.
Using snapshot_entities
, you can now simply list the entities in scene.create
. Their current state will be stored in the temporary scene.
Example from the documentation:
Save the states of two entities to a new, temporary scene called scene.before
.
- service: scene.create
data:
scene_id: before
snapshot_entities:
- climate.ecobee
- light.ceiling_lights
When the time comes to restore their states, simply turn on scene.before
.
- service: scene.turn_on
data:
entity_id: scene.before
EDIT
Clarified the use-case.