I am trying for a small automation to make my garage door switch to toggle. Automation should turn the switch OFF after 200ms if someone turn it ON. So I did this but it is not working. What I am doing wrong?
You want 'on' and 'off' in lower case, and entity_id is mis-spelled in your trigger code. Here’s how I’d format it, with alias, description and id. The id (just a random string: I use UUID4) allows the automation tracer / debugger to work.
- alias: Garage door momentary on
description: Turns the garage door switch off as soon as it is turned on
- platform: state
- service: switch.turn_off
If the 200ms is critical, you may be disappointed: HA isn’t necessarily that “punctual”.
But do please format your code using the </> button. See point 11 here: