Simpel delay in automation not working

Hi
I can not get a delay for 2 lights to work
Any help would be great

  • id: normal_lys_av
    alias: Normal lys av
    trigger:
    platform: time
    at: ‘23:00:00’
    condition:
    • condition: state
      entity_id: input_select.hus_modus
      state: “Normal”
      action:
    • service: light.turn_off
      entity_id:
      #- light.kjkkenlys_163
      #- light.trapplysz_223
      • light.spisestue_hovedlys_35
      • light.spisestue_taklys_29
      • light.stue_lys_sofa_17
      • light.stue_lys_gostol_15
      • light.ovnlys_63
      • light.stalampe_65
      • light.vegglampe_67
    • delay: ‘00:03:00’
    • service: light.turn_off
      entity_id: light.trapplysz_223
      entity_id: light.kjkkenlys_163

You need to format the code properly using </> after selecting the code in the edit box - having said that the delay command looks fine so I would say it’s the way you have listed the lights, for a list put - before the lights like you have above or put the service command before each one basically either do one or the other not both :wink:

Tried like this, but still shuts of right away

 - id: normal_lys_av
  alias: Normal lys av
  trigger:
    platform: time
    at: '23:00:00'
  condition:
    - condition: state
      entity_id: input_select.hus_modus
      state: "Normal"
  action:
    - service: light.turn_off
      entity_id:
        #- light.kjkkenlys_163
        #- light.trapplysz_223
        - light.spisestue_hovedlys_35
        - light.spisestue_taklys_29
        - light.stue_lys_sofa_17
        - light.stue_lys_gostol_15
        - light.ovnlys_63
        - light.stalampe_65
        - light.vegglampe_67
    - delay: '00:03:00'
    - service: light.turn_off
        - entity_id: light.trapplysz_223
        - entity_id: light.kjkkenlys_163

Can you try:

- delay: 0:03

Or:

    - delay:
        minutes: 3

Well you haven’t changed anything :stuck_out_tongue:

Look at the format above its like this …

- service: light.turn_off
      entity_id:
        - light.spisestue_hovedlys_35
        - light.spisestue_taklys_29

you have it like this .....
- service: light.turn_off
        - entity_id: light.trapplysz_223
        - entity_id: light.kjkkenlys_163

:wink:

I can’t reproduce your problem, but the automation, as you have it listed won’t work. It generates a duplicate ID error when you try to run it.
Try it like this:

- id: normal_lys_av
  alias: Normal lys av
  trigger:
    platform: time
    at: '23:00:00'
  condition:
    - condition: state
      entity_id: input_select.hus_modus
      state: "Normal"
  action:
    - service: switch.turn_off
      entity_id:
        switch.sun
    - delay: '00:01:00'
    - service: switch.turn_off
      entity_id: switch.office2
      entity_id: switch.office1

- id: normal_lys_av
  alias: Normal lys av
  trigger:
    platform: time
    at: '23:00:00'
  condition:
    - condition: state
      entity_id: input_select.hus_modus
      state: "Normal"
  action:
    - service: light.turn_off
      entity_id:
        #- light.kjkkenlys_163
        #- light.trapplysz_223
        - light.spisestue_hovedlys_35
        - light.spisestue_taklys_29
        - light.stue_lys_sofa_17
        - light.stue_lys_gostol_15
        - light.ovnlys_63
        - light.stalampe_65
        - light.vegglampe_67
    - delay: '00:03:00'
    - service: light.turn_off
        entity_id: 
        - light.trapplysz_223
        - light.kjkkenlys_163

Of course, so easy, but still hopeless to see :slight_smile:

Thanks a lot.

Tommy