Light - Flash loop with script

I’d like to use the effect flash as long as my alarm turns off.

I use this with a simple sonoff based light and this works great:

flash_terrasse:
  alias: Flash Terrasse
  sequence:
    - service: light.turn_on
      data:
        entity_id: light.terrasse
    - delay:
        seconds: 2 # time for flash light on
    - service: light.turn_off
      data:
        entity_id: light.terrasse
    - service: script.turn_on
      data:
        entity_id: script.flash_terrasse_loop
flash_terrasse_loop:
  alias: Flash Terrasse - Loop
  sequence:
    - delay:
        seconds: 2 # time for flash light off
    - service: script.turn_on
      data:
        entity_id: script.flash_terrasse

and I’d like to use flash to blink my led stripe like this:

flash_kugel:
  alias: Flash Kugel
  sequence:
    - service: light.turn_on
      data: 
        entity_id: light.kugellicht
        brightness_pct: 100
        color_name: red  
        flash: long         
    - delay: '00:00:15'
    - service: script.turn_on
      data:
        entity_id: script.flash_kugel_loop
flash_kugel_loop:
  alias: Flash Kugel - Loop
  sequence:
    - delay:
        seconds: 0.5  
    - service: script.turn_on
      data:
        entity_id: script.flash_kugel

but this doesn’t loop, it looks like it the script flash_kugel ignores the delay, because flash_kugel_loop is not activated.
Side question: Also I don’t understand why some scripts have a toggle and some an Activate button.

Looks like commenting out flash: long will make this loop work.

Why can’t i use this?
Is there another way to use the flash sequence every 15 seconds.

I’d like to use this rather than turn on and off the light by home assistant, because flash only needs one command to flash it for about 15 seconds.

Found a way how it works. Had to put the service light.turn_on into it’s own script.

flash_garten_skript:
  alias: Flash Garten Skript
  sequence:
    - service: script.turn_on
      data:
        entity_id: script.flash_garten         
    - delay: '00:00:15' 
    - service: script.turn_on
      data:
        entity_id: script.flash_garten_loop
flash_garten_loop:
  alias: Flash Garten - Loop
  sequence:
    - service: script.turn_on
      data:
        entity_id: script.flash_garten_skript
flash_garten:
  sequence:
  alias: Flash Garten  
    - service: light.turn_on
      data:
        entity_id: light.garten
        brightness_pct: 100
        color_name: red  
        flash: long 

Suggestions to make this more compact are welcome.

2 Likes