How to turn a scene off? No scene.turn_off

Referring to the example I posted above, the first automation’s action stores the current state of the two lights to scene.test1. That’s a snapshot in time. Running the automation again will overwrite scene.test1. Is this what you want, or something else?

Yeah, that’s exactly what I want. Perfect!

But what’s the issue? After creating the scene the same automation cannot change the state of entities inside the scene.

- alias: Kettle_work
  initial_state: true
  description: 'Switching off Boiler&Microwave plugs'
  trigger:
  - platform: numeric_state
    entity_id: sensor.0x00xx7f_power   
    above: '500'
  action:
   - service: scene.create
     data_template:
        scene_id: KeBefore
        entities:
        switch.0x00xx85_switch: 
          state: "{{ states('switch.0x00xx85_switch') }}"  
         switch.0x00xxa2_switch:
          state: "{{ states('switch.0x00xxa2_switch') }}" 
   - service: switch.turn_off
     entity_id: 
         - switch.0x00xxa2_switch  
         - switch.0x00xx85_switch  

Without creating the scene everything turns off. Including scene.create fragment makes it not to turn the switches off

To dig up an old thread…

Lets say you want to turn some of your rgb lights red as a notification for example, it’s easy to create a scene for that. I love the “just set all devices the way you want and save the scene” feature.

I wonder if you could capture the previous state of those devices on scene activation, so to implement “turn off scene” by restoring those stored states.

In case someone manually changed something while the scene is active, one would simply remove that particular device’s state from the stored list.

If another scene turned on, you would then restore the states of those devices that are not part of the newly activated scene…?

Would this logic work?

This is a mistake on a fast moving platform such as homeassistant. A year old thread is really out of date and commenting on it brings it back to the recent threads list implying it may still be a problem.

In fact, everything you suggest as a solution to this has long since been included in homeassistant by default (including doing so dynamically), see the scene.create service in the scene documentation.