Flash LEDs with motion, revert to previous state - can't get it to work

I’ve been trying to change my LED strip to a color when motion is detected. After a 3 seconds, the LED strip (“light.desk_lights”) should revert back to whatever color it was. I’ve been following this thread (Flash light red when motion detected) as it seems very similar. However, I can’t seem to get it working. When I run the actions in the automation, the LEDs change color, but don’t revert back to what they were before. For what its worth, the LEDs don’t flash either, they just turn on.

Banging my head against the wall. What am I missing here?

alias: LED test
description: ''
trigger:
  - platform: state
    entity_id: binary_sensor.front_door_motion
condition: []
action:
  - service: scene.create
    data:
      scene_id: before
      snapshot_entities: light.desk_lights
  - service: light.turn_on
    data:
      flash: long
      color_name: red
    target:
      entity_id: light.desk_lights
  - delay:
      hours: 0
      minutes: 0
      seconds: 3
      milliseconds: 0
  - service: scene.turn_on
    target:
      entity_id: scene.before
mode: single

That looks ok to me. Try putting a short delay (1 sec) between the scene creation and flash service call.

If that does not work it must mean the scene creation is not capturing the light colour, only the state.

Thanks for the reply. The light still only changes to red and doesn’t revert to anything.

Gotcha. I guess there isn’t really a workaround for that then?

Examine the scene and make sure it has the desired values.

After the 3s flash delay, turn off the light, then wait 1 more second then turn the scene on

1 Like

This worked, thank you!