[Solved] - Need help with a script

So, i have a problem, i’m trying to lern about scripts, so i thought i should start in the kiddiepool :slight_smile:

i made 3 scripts, 2 of them working
“daytime” - works without problem
“all_on” - works without problem
“all_off” - this is the one thats not working as i want
the switches (switch.wall_4_2, switch.desk_1_2, switch.lampa_5_2) turn off just fine.
but when it comes to the lights (light.bed, light.desk_lamp, light.left, light.right)
the script only executes the first parts of the script and stops after the “light.bed”,
so it dont turn of the other 3 lights.

what have ive done wrong?

daytime:
  alias: daytime
  sequence:
  - data:
      brightness_pct: '100'
      effect: colorloop
      entity_id: light.bed
      transition: '10'
    service: light.turn_on
  - data:
      entity_id: switch.desk_1_2
    service: switch.turn_on
all_on:
  alias: all on
  sequence:
  - data:
      entity_id: switch.wall_4_2
    service: switch.turn_on
  - data:
      entity_id: switch.desk_1_2
    service: switch.turn_on
  - data:
      entity_id: switch.lampa_5_2
    service: switch.turn_on
  - data:
      brightness_pct: '100'
      effect: colorloop
      entity_id: light.bed
      transition: '10'
    service: light.turn_on
  - data:
      brightness_pct: '100'
      effect: stop
      entity_id: light.desk_lamp
      transition: '10'
      rgb_color: [254,40,255]
    service: light.turn_on
  - data:
      brightness_pct: '100'
      effect: stop
      entity_id: light.left
      transition: '10'
      rgb_color: [65,53,255]
    service: light.turn_on
  - data:
      brightness_pct: '80'
      effect: stop
      entity_id: light.right
      transition: '10'
      rgb_color: [255,48,33]
    service: light.turn_on
all_off:
  alias: all off
  sequence:
  - data:
      entity_id: switch.wall_4_2
    service: switch.turn_off
  - data:
      entity_id: switch.desk_1_2
    service: switch.turn_off
  - data:
      entity_id: switch.lampa_5_2
    service: switch.turn_off
  - data:
      brightness_pct: '20'
      effect: stop
      entity_id: light.bed
      transition: '10'
      rgb_color: [254,0,0]
    service: light.turn_on    ## This is where the script stops ## 
  - data:
      brightness_pct: '0'
      effect: stop
      entity_id: light.desk_lamp
      transition: '10'
    service: light.turn_off
  - data:
      brightness_pct: '0'
      effect: stop
      entity_id: light.left
      transition: '10'
    service: light.turn_off
  - data:
      brightness_pct: '0'
      effect: stop
      entity_id: light.right
      transition: '10'
    service: light.turn_off```

light.turn_off doesn’t accept attributes. You need to use light.turn_on to gradually move it to zero then use light.turn_off with no attributes

Thank you, that did it.