Set wled light to Chase effect while front door is opened and then return to previous state

So, basically this topic will be pointed to this; previous state
I was been able to put logic when binory_sensor.front_door is ‘on’ to trigger the lights. But I really want to put that light in “previous state” before automation kicks in.

So basically here is my code:

- alias: "Hallway LED Light Effect Frontdoor"
  trigger:
      platform: state
      entity_id: binary_sensor.front_door
  action:
    choose:
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.state == 'on'}}"
        sequence:
          - service: scene.create
            data:
              scene_id: hallway_led
              snapshot_entities: light.hallway_wled
          - service: light.turn_on
            data:
              color_name: green
              effect: Chase
            target:
              entity_id: light.hallway_wled
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.state == 'off'}}"
        sequence:
          - service: scene.turn_on
            data:
              entity_id: hallway_led

When I close the door, nothing happens. Light is still in this green color and effect Chase

Was the automation triggered when you closed the door?
Going back in the trace history, wouldn’t the “on” part be triggered multiple times, overriding hallway_led?

Yes, the second conditiond and its sequence is triggered, I put some persistent notification, and the notification showed up.

Well, each time when door opens, I want to override scene - sometimes the light will be off, sometimes the light will be in different color, when sensor is ‘on’, and I would like to restore that state, after I close the door.

And what does the scene actually contains after a “close door” (I assume you can see it in the scene menu, but I’m not actually sure)

That’s the catch, I can’t. I see just state of the scene “scening”. Thats all.

Why not create two automations depending if the state is on or off ? That way you can also see the time each triggered.

I’m afraid that I don’t understand you idea?
I can see the time when each triggered on or off, but I cannot set the scene - remember the state of the light before automation kicks in.

Instead of setting each scene, depending if the sensor is on or off, in 1 automation use 2 automations - 1 for on and 1 for off.

Yes, but how that impacts on scene recall to a previous state?

Finally I made it work it.
The catch was that I didnt reference correct entity. I missed scene. prefix lol

here it is my autoamtion:

- alias: "Hallway LED Light Effect Frontdoor"
  trigger:
      platform: state
      entity_id: binary_sensor.front_door
  action:
    choose:
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.state == 'on'}}"
        sequence:
          - service: scene.create
            data:
              scene_id: hallway_led
              snapshot_entities: light.hallway_wled
          - service: light.turn_on
            data:
              color_name: red
              effect: Chase
            target:
              entity_id: light.hallway_wled
      - conditions:
          - condition: template
            value_template: "{{trigger.to_state.state == 'off'}}"
        sequence:
          - service: scene.turn_on
            data:
              entity_id: scene.hallway_led