Delays do not work

I have an automation and I want a delay… or a pause ,a sleep, a something where it is not instant.

# Front Door
- alias: 'Front Door Closed Lights'
  trigger:
    platform: state
    entity_id: binary_sensor.front_door_sensor
    to: 'off'
  condition:
    condition: state
    entity_id: input_boolean.zwave_up
    state: 'on'
  action:
    - delay:
        minutes: 3
    - service: switch.turn_off
      entity_id:
        - switch.front_door_light_switch_switch_2
        - switch.front_door_light_switch_switch_3

instantly turns off

- alias: 'Front Door Closed Lights'
  trigger:
    platform: state
    entity_id: binary_sensor.front_door_sensor
    to: 'off'
  condition:
    condition: state
    entity_id: input_boolean.zwave_up
    state: 'on'
  action:
    - delay: '00:03:00'
    - service: switch.turn_off
      entity_id:
        - switch.front_door_light_switch_switch_2
        - switch.front_door_light_switch_switch_3

also instantly turns off, how can I make it wait for 3 minutes?

I am using Hasbian + version 0.55.0

apparently you need to use a script for a delay to work.

Really? I use delays all over the place and they work just fine…

check your config if it’s valid YAML (it probably is) and check the error log if there is any indication to a problem with the automation. Then reload the automations or restart HA. Delays do work in automations. You do not have to use a script for them to work. I have an automation that uses a 1 minute delay to run off lights after arming the house and locking the door. example:

  - id: alarm_armed_actions
    alias: 'Alarm Armed Actions'
    trigger:
    - platform: state
      entity_id: alarm_control_panel.ha_alarm
      from: 'disarmed'
    action:
    - service: lock.lock
      entity_id: lock.garage_door_lock_locked
    - delay: '00:01:00'
    - service: switch.turn_off
      entity_id:
        - switch.kitchen_lights_switch
        - switch.living_room_lamp_switch
        - switch.under_cabinet_lights_switch

Hi everybody !

I’ve got the same problem !

I have a All In One installer instance that works well, and when I copy my .YAML files in Hass.io, I have the same error as you !!
So I know my files are corrects…

Invalid config for [automation]: [delay] is an invalid option for [automation]

my code:

- alias: 'Oeufs durs 10 minutes'
  initial_state: 'on'
  hide_entity: False
  trigger:
    - platform: state
      entity_id: input_boolean.oeuf_dur
      to: 'on'
      from: 'off'
  action:
    - service: switch.turn_on
      entity_id: switch.buzzer
    - delay: '00:00:01'
    - service: switch.turn_off
      entity_id: switch.buzzer
    - service: switch.turn_on
      entity_id: switch.countdown
    - delay: '00:10:00'
    - service: switch.turn_on
      entity_id: switch.buzzer
    - delay: '00:00:03'
    - service: input_boolean.turn_off
      entity_id: input_boolean.oeuf_dur
    - service: switch.turn_off
      entity_id: switch.buzzer
    - service: notify.pushover
      data:
          message: "Les oeufs durs sont cuits !!"
          title: "Jarvis"

yaml is good, no errors.

ok, well. I was thinking it is maybe because I start with a delay? Maybe some bug. I have not tested it yet.

I am not getting that error, I get no error but if you go and trigger the automation (using zwave devices, so I go and open and close my door) there isn’t a delay.

once I added the script part in, I get my delay.

Did you find out how to resolve this issue? I have the same error, using HASS.io, when I try to delay an automation.

Thanks

Hi, as I said… I just made a script… and then called the script…

Hi,

I also have issues with the delay.
I have an automation where the lights should turn on for x minutes, but the delay function doesn’t work at all not in the automation nor in the script. I don’t get any errors, the configs are valid, the automation triggers fine and the lamps turn on, but stays on and don’t turn off after x time.
Here is the part of my script, I just put in 30 seconds just for testing purposes but if it works I’ll make it 5 minutes.

timer_light_huiskamer:
  sequence:
    - service: light.turn_on
      data_template:
        entity_id: group.Main_Lights_group
    - service: script.turn_on
      data:
        entity_id: script.timer_light_huiskamer_off

timer_light_huiskamer_off:
  sequence:
    - delay:
        seconds: 30
    - service: light.turn_off
      data_template:
        entity_id: group.Main_Lights_group

put the time in quotes like my example below:

action:
  - service: homeassistant.turn_on
    entity_id: light.front_door_light
  - delay: '00:01:00'
  - service: homeassistant.turn_off
    entity_id: light.front_door_light

Already tried that. But didn’t work.

with the time in that same format I posted? this works for me in many automations and scripts without fail

Yes, tried that and the time format I mentioned in my config. It should work by hitting the trigger button when selecting it from the automatic automation section in the dashboard, am I correct ?
The light does turn on so the script is being called but then it should use the delay to turn it off again.

What’s strange is in my automations, times are not in quotes, and they all work for me. Btw, I didn’t script it by hand, used the automation wizard tool in Hassio.

Ok, I think I got it solved. I have completely uninstalled my hassbian installation and reinstalled and now i’m on version 0.67.1 and the delay is working !! :slight_smile:

I dont use the built in automation editor as I dont like it. I prefer to code them myself