#scene.create in script doesn't seem to capture light color/temperature

1 messages · Page 1 of 1 (latest)

normal crescent
#

In a script, I am capturing the state of a lamp by using scene.create. The lamp is a smart bulb with RGB or Temperature color adjustment. Before the script runs, the lamp is in temperature mode. The script then changes it to color mode. After the script is done, it attempts to revert the lamp back by using scene.turn_on. Here are the relevant snippets from the script:

        sequence:
          - action: scene.create
            data:
              scene_id: before_leak_alert
              snapshot_entities: "{{ lights }}"

        sequence:
          - action: scene.turn_on
            data:
              entity_id: scene.before_leak_alert    

The problem is the lamp goes back to the previous brightness but not the previous temperature. Am I missing something on how to capture the correct state in scene.create?

#

I might've found the issue. It seems the light entity has color_mode: null when the lamp is off. So, what I think is happening is the light restores previous color mode when turned on and since the state is null, whether it's captured in the scene or not is irrelevant.

clever tendon
#
  • create a scene (1)
  • turn all involved lights on
  • create a 2nd scene (2)
  • perform your actions
  • apply scene 2
  • apply scene 1