Switch turn on and off

Hi
I’m new in HA, and I need some help :slight_smile:
I’ve got xiaomi gatewy, I’ve added a switch, and I’ve added an automation, which after double click turn on my test switch.

- alias: Double Click - Turn On
  trigger:
    platform: event
    event_type: click
    event_data:
      entity_id: binary_sensor.switch_158d0001d8eb26
      click_type: double
  action:
    service: switch.turn_on
    data:
      entity_id: switch.espurna_test 

and it works. But I would like to add a line to turn off this switch 30 sek after turning on, and I don’t know how :frowning:
Regards
WOJ

add a delay and then turn the switch back off.

You will need to make the actions into a list…

action:
  - service:
    entity_id: 
  - delay:
  - service:
    entity_id:

For future reference, if you are not passing data (light brightness, message data, etc. ) you don’t need to include the data line in a service call.

works, Thank Yoy :slight_smile: