Delay in automation action not working?

Hi,
Have a problem with a automation, the code is:

  • alias: Sound the alarm
    hide_entity: True
    trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
    actionName: SOUND_ALARM
    action:
    delay: ‘00:01:35’
    service: notify.IPHONES
    data:
    message: “Påminnelse”
    condition:
    condition: state
    entity_id: binary_sensor.Pellets
    state: ‘off’

the error i get is:
2017-06-03 19:41:21 ERROR (MainThread) [homeassistant.config] Invalid config for [automation]: [delay] is an invalid option for [automation]. Check: automation->action->0->delay. (See /home/homeassistant/.homeassistant/configuration.yaml, line 121). Please check the docs at https://home-assistant.io/components/automation/

Can anyone help me whats wrong here?

It’s probably something to do with the alignment of your code. Double check the spacing you’re using.

When you post code, if you highlight it and then press the < / > button, it will display with the correct format. I’m no expert but that should help someone more competent to answer your query.

- alias: Sound the alarm
  hide_entity: True
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: SOUND_ALARM
  action:
    delay: '00:01:35'
    service: notify.IPHONES
    data:
      message: "Påminnelse"
  condition:
    condition: state
    entity_id: binary_sensor.Pellets
    state: 'off'

Don’t know if condition needs to be above action.

But there should be a hyphen before delay and service.

Hope this helps.

Forgot to paste the code :smile:

- alias: Sound the alarm
  hide_entity: True
  trigger:
    platform: event
    event_type: ios.notification_action_fired
    event_data:
      actionName: SOUND_ALARM
  condition:
    condition: state
    entity_id: binary_sensor.Pellets
    state: 'off'
  action:
    - delay: '00:01:35'
    - service: notify.IPHONES
      data:
        message: "Påminnelse"

Hi All,

I am in the same boat, needed something like this, your code helped me, however, I want a small iteration, I want the message notification to work after ever ‘00:01:35’ minutes. So first notification comes at '00:01:35, the second should come again after '00:01:35.

regards
sammy

What’s the trigger?

HI mf_social.

I changed the code a bit as the above code was sending the msg even if the door was closed. Below the updated one I am now using and its working … however my initial request still stays same, the msg should keep coming in 5 mints duration untill the door is closed. Below is my code …

automation:

  • alias: “front door opened”
    trigger:
    • platform: state
      entity_id: binary_sensor.front_door
      from: ‘off’
      to: ‘on’
      for:
      minutes: 5
      action:
      service: notify.pover
      data:
      message: Front Door Opened since last 5 minutes

You can use the Alert component to do this with reoccurring notifications.

1 Like