I’m sure this has been asked many times but I’m unable to find a direct answer in the forum.
I have door sensors. I want to set an automation to keep making a sound until the door is closed. I can easily set the automation to run when the door is opened, but how to I tell HA to stop the automation as soon as the door is closed? I’m not very good at using scripts so I’m using the GUI on the automation page. I can’t see any option for stopping the automation automatically.
If you want to make decisions in the actions / while the actions are running that is possible.
Generally for simplicity’s sake you have an automation trigger on a thing happening, that starts or runs an action, then another automation that triggers on a different event, and that stops the first action or runs something else.
Lots of opportunities to combine things , but starting out simple and getting it going is what I recommend.
Be advised that when Home Assistant is restarted, all automations that are in progress are terminated.
That means if your automation is busy iterating its repeat until, it will be immediately terminated and will not resume on restart.
Given this potential failure scenario, examine your automation and determine what are the possible consequences. If they’re benign then no worries, otherwise you may need to redesign the automation to be more resilient.