How set Switch to turn off automatically

Hi all,
I would like that swich activated, turn off automatically after 0.5sec. This because I need to open doors with a simple imput. Maybe you know best way to do that. After that in the future I will integrate it with google assistant. In particular I would like that saying “ok google open door”, hassio turn on a gpio and after 0.5sec turn off it.

Thank you really much for help
Best regard

Hi,

This works for me

- alias: Door Pulse
  initial_state: 'on'
  trigger:
    platform: state
    entity_id: switch.door
    to: 'on'
    for:
      milliseconds: 500
  action:
    service: switch.turn_off
    entity_id: switch.door

succes!

thank you. It works