Add an option to make dynamic scenes (`scene.create`) persistent across restarts

Description of the problem

Currently, dynamic scenes created on the fly using the scene.create service are stored exclusively in volatile memory (RAM). If Home Assistant restarts (due to a power outage, a system update, or a crash) between the moment scene.create is called and when scene.activate is triggered, the dynamic scene is completely lost.

Real-world use case

Taking a full snapshot of an entity’s state is extremely useful, and I rely on dynamic scenes across many different automations in my setup.

To give just one simplified example, I have a night and morning routine for my climate entities:

  1. At night, when activating “Night Mode”, I take a snapshot of all thermostats using scene.create and then lower the temperatures.
  2. During the night, temperatures might be adjusted manually if needed.
  3. In the morning, an automation calls scene.activate to restore the exact thermostat states from the previous evening.

If Home Assistant reboots overnight for any reason, the morning automation fails silently because the dynamically created scene no longer exists. This same issue affects all my other long-running automations that depend on entity snapshots.

Proposed solution

Add an optional boolean parameter to the scene.create action, such as persistent: true (defaulting to false to preserve current behavior and avoid unnecessary disk writes for short-lived snapshots).

Example:

action: scene.create
data:
  scene_id: before_night_mode
  persistent: true
  snapshot_entities:
    - climate.living_room
    - climate.bedroom

When persistent: true is set, Home Assistant should save the scene state to .storage (similar to how input_number or input_text helpers restore their state) and clean it up if overwritten or explicitly deleted.

Why existing workarounds are not ideal

Manually saving attributes into input_number or input_text helpers works for simple cases, but it becomes impossible to maintain when dealing with many different entity types across complex automations (thermostats with HVAC modes and target temperatures, lights with brightness and color attributes, media players, covers, etc.). Being able to take a native, persistent snapshot of entire entities is much cleaner and makes automations far more reliable.

1 Like

4 posts were merged into an existing topic: WTH can’t we permanently save scenes with an action?

6 votes have been moved.