Creating and activating dynamic scenes with wled and playlist

I have a few WLED strips set around the house. I have managed successfully to create presets for them in the app, and they do show up in home assistant. One of the presets I have called “police” and I have it executed whenever my Alarmo smart home security is triggered.


Here is my script that is triggered by Alarmo:

alias: Alarm - Triggered action
sequence:
  - parallel:
      - metadata: {}
        data:
          scene_id: alarm_triggered_before_state
          snapshot_entities:
            - light.office_bed_wled
            - light.office_desk_wled
            - light.livingroom_cabinet_wled
            - light.diningroom_cabinet_wled
        enabled: true
        action: scene.create
      - metadata: {}
        data:
          target:
            - media_player.echo_hallway
          message: Alarm triggered! Possible intruder or apartment emergency!
        action: notify.alexa_media
  - metadata: {}
    data: {}
    action: light.turn_on
    target:
      entity_id:
        - light.office_bed_wled
        - light.office_desk_wled
        - light.livingroom_cabinet_wled
        - light.diningroom_cabinet_wled
  - target:
      entity_id:
        - select.wled_bed_preset
        - select.office_desk_wled_led_preset
        - select.livingroom_cabinet_wled_preset
        - select.diningroom_cabinet_wled_preset
    data:
      option: Police
    action: select.select_option
  - action: switch.turn_on
    metadata: {}
    data: {}
    target:
      entity_id: switch.closet_siren
mode: single
icon: mdi:alarm-light

Works like a charm. So far - perfect.

I create a BEFORE state for all my WLEDs called “alarm_triggered_before_state”

HOWEVER, when I stop the alarm I want all my WLEDs to go back to their previous state, before the alarm was triggered.

So this script is triggered:

alias: Alarm - Stopped action
sequence:
  - parallel:
      - action: switch.turn_off
        metadata: {}
        data: {}
        target:
          entity_id: switch.closet_siren
      - metadata: {}
        data:
          target:
            - media_player.echo_hallway
          message: Alarm stopped! All security measurements have been deactivated!
        action: notify.alexa_media
      - metadata: {}
        target:
          entity_id: scene.alarm_triggered_before_state
        action: scene.turn_on
mode: single
icon: mdi:shield-home

Here comes the problem. I have no issues when the alarm is triggered and the correct effects are loaded and started into all WLEDs. BUT when I stop/cancel the alarm the WLEDs don’t go to their previous state (some that were OFF, became ON and some that were ON became OFF, and some were OK but the effect was still POLICE and not the one that was active before the script got triggered. And some get the right effect even but is much “faster” or “slower” or it blinks randomly unnaturally, like a bug.

So, is anybody here with more experience with WLEDs and creating dynamic scenes with them, so I can recall perfectly of WLED was ON or OFF and what effect was used before that and the right speed and etc.

Any help will be greatly appreciated! Thanks

Anyone? Does anybody has knowledge of this or is it new territory for everyone? WLED is so fun, especially with home assistant the possibilities are limitless. I hope someone can give me a hand on this one…