I’d like to implement a blinking switch for a buzzer to chirp continuously until turned off, which I assume could be done with an output component and a template somewhat like below, but it would have a specified number of chirps rather than continuous.
I was able to do this using an output and a light component with a strobe effect, but then the component shows up as a light in HA. This is probably acceptable to me as I will 99% of the time utilize this in automations, but it isn’t satisfying to my perfectionist side.
a) Mark the light as internal by only giving an id, not a name. Then it will no longer show up in HA and you can use a template switch to control the light internally.
b) Use a template switch directly, this is a bit hackish but I think it will work (not tested):
I’m going to try the first option a), and can report back. The second option seems like it is infinitely self-recursive, but I have no experience to know whether this is is an issue at the lower level of logic.
I was 75% to this solution, but I think my wish for your second post was clouding my thinking. More complete automations would be wonderful!
It’s not self-recursive because the delay action is asynchronous. During the delay other code will execute, if there were no delay action you would be correct, the code would never terminate. You can think of the delay action as a special kind of action that stores a small micro-stack internally to allow for this.