Light Script, help Please!

hi Guys
Have a script written to my daughter in the room to give light signals when food is ready :wink:

The only problem is that when I run the script, all the lights are off, even if my daughter had turned on a light before.

How can I restore the light state of the before after script?

my simple light script:

lena:
  sequence:
  - service: light.turn_on
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena
  - delay: '00:00:01'
  - service: light.turn_off
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena
  - delay: '00:00:01'
  - service: light.turn_on
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena
  - delay: '00:00:01'
  - service: light.turn_off
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena
  - delay: '00:00:01'
  - service: light.turn_on
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena
  - delay: '00:00:01'
  - service: light.turn_off
    data: 
      entity_id: light.lena_stehlampe, light.sonoff_mini_lena

greetings

Instead of using the light.turn_off and light.turn_on services use the light.toggle service an even number of times.

Four times would give this if the light is on:

off, on, off, on

or (if the light is off)

on, off, on, off

2 Likes