Lovelace Automation Gui - Delay syntax

Good day team!
I have been trying to use one automation to turn a switch on, delay for 1 hour, and turn the switch off. I attached a screenshot of the automation in the gui builder

And the code from the automation.yaml that resulted.

- id: '1560183708322'
  alias: Hot Garage
  trigger:
  - above: '95'
    entity_id: sensor.garage_temperature
    platform: numeric_state
  condition: []
  action:
  - data:
      message: The garage is HOT!
      target:
      - '+19992223333'
    service: notify.sms
  - data:
      entity_id: switch.garage_attic_plug_outlet_1
    service: switch.turn_on
  - data:
      delay: '1:00'
      entity_id: switch.garage_attic_plug_outlet_1
    service: switch.turn_off

The SMS is sent. The switch turns on, but never turns off after one hour. Is there a way to do this all as one automation without using a script?
Thanks!

delay is not part of the switch.turn_off call, it’s an action of its own.
Replace

  - data:
      delay: '1:00'
      entity_id: switch.garage_attic_plug_outlet_1
    service: switch.turn_off

with

  - delay:
      hours: 1
  - data:
      entity_id: switch.garage_attic_plug_outlet_1
    service: switch.turn_off

Thank you @lolouk44 this was helpful and worked perfectly!
Unfortunately the Automation GUI doesn’t support creating a delay action - but editing the raw automation.yaml worked just fine.
Thank you again!
Rich

1 Like