How to add a delay to automation

hi all,
i am trying to add a delay to my automation. currently it is triggered by a switch and all three lights turn on.
I want to add a delay of 2 seconds beteen each light.
how would i go about it.

  - alias: "all living room lights max"   
    initial_state: 'on'
    trigger:
      platform: event
      event_type: deconz_event
      event_data:
        id: switch_2
        event: 2004
    action:
      service: scene.turn_on
      entity_id: 
       - scene.living_right_max
       - scene.living_left_max
       - scene.living_paper_lamp_max

thank you in advance …

You can see an example of how its implemented here:

https://github.com/SilvrrGIT/HomeAssistant/blob/master/automation/snapshot.yaml#L17

thank you, but i am unable to figure out still on how to add the 2 second delay between my 3 light scenes.

  • delay: ‘00:00:02’

I added service and entity id for each scene and delay in between but didn’t work…

Any errors in the log?

Did you restart or reload your automations after making the change?

Make sure you reload the automations. You can define hours, minutes, or seconds as well.

    action:
      service: scene.turn_on
      entity_id: 
       - scene.living_right_max
       - delay:
           seconds: 2
       - scene.living_left_max
       - delay:
           seconds: 2
       - scene.living_paper_lamp_max

appreciate the help, but after adjusting the automation like the following

  - alias: "all living room lights max"   
    initial_state: 'on'
    trigger:
      platform: event
      event_type: deconz_event
      event_data:
        id: switch_2
        event: 2004
    action:
      service: scene.turn_on
      entity_id: 
       - scene.living_right_max
       - delay:
           seconds: 2
       - scene.living_left_max
       - delay:
           seconds: 2
       - scene.living_paper_lamp_max

the check config gave following error

Invalid config for [automation]: not a valid value for dictionary value @ data[‘action’][0][‘entity_id’]. Got None. (See /config/configuration.yaml, line 180). Please check the docs at https://home-assistant.io/components/automation/

but when i delete the delay, the automation and all three lights works as in the scene…

any thoughts ?

I got it like this

- service: light.turn_on
  entity_id: group.kitchen
- delay: 00:03:00
- service: light.turn_off
  entity_id: light.domitech

you can’t put delays in the entity_id section. Each entity id needs to have it’s own service with delays between each

  - alias: "all living room lights max"   
    initial_state: 'on'
    trigger:
      platform: event
      event_type: deconz_event
      event_data:
        id: switch_2
        event: 2004
    action:
      - service: scene.turn_on
        entity_id: scene.living_right_max
      - delay:
          seconds: 2
      - service: scene.turn_on
        entity_id: scene.living_left_max
      - delay:
          seconds: 2
      - service: scene.turn_on
        entity_id: scene.living_paper_lamp_max
``
4 Likes

Thanks so much … working with no errors …