Delayed Automations

I’ve used the home auto generator to create the following automation when my tasmota switch is long pressed it will shutdown. I would like to add a 5 second delay before shutting off the lights. How could I do that?

- id: '1616584941516'
  alias: Bedroom Long Press Shutdown
  description: shutdsdown all lights in room
  trigger:
  - platform: device
    domain: tasmota
    device_id: a4564c4c23ca0747da062d539296214f
    type: button_long_press
    subtype: button_1
    discovery_id: ECFABC683A15_button_1_HOLD
  condition: []
  action:
  - type: turn_off
    device_id: 806a858453940237e81eb6c7bed95edb
    entity_id: switch.tasmota_plug_readinglight
    domain: switch
  - type: turn_off
    device_id: e0e7c142fa10aa567e777d8f4c93d2d9
    entity_id: switch.tasmota_jensbedside_plug
    domain: switch
  mode: single

In the action there is a action type called delay, you can use this for delay. Just place this as the first action.

Wow! Thanks. That was simple. It was my misunderstanding about actions assuming they all occured simultaneously.

1 Like