Add Loop support in automations

I want to loop an Action in an automation …

For e.g. if my smoke detector goes off when I am not at home I want it to send a message to my mobile … then delay for 10 seconds and do this 10 times so that I don’t miss it!

The interface could be something similar to the “And” condition Where you select “Loop” as the action type and it opens a sub section where you can add sub actions. There should also be two fields: a “For” and “While”…
For being an int and While being Jinja2 that returns a bool… both should be able to be entered so for eg I can have it loop 10 times but only while smoke is still detected.

The Alert integration sounds like a good solution for what you described.

1 Like

I still think a loop would be better … more flexibility…

Also with the alert integration I would have to set up 8 of them for each of my entities (smoke detectors)… or make a template sensor that “monitors” the smoke sensors and changes its state to the name of the first offending smoke detector (as I want to be aware of what sensor is triggered)… nether I think are good solutions.

I could see this being useful.

There was a thread a couple of days ago in which someone want to perform the actions three times so a loop would have been the answer as opposed to wring the same actions one after the other. Especially if you want to do that more than a few times.

But they needed a condition controlling the number of times so not exactly the same. Unless you could also have a condition in the loop to stop executing the loop early. That would be even better.

I stated a condition :slight_smile:

The interface could be something similar to the “And” condition Where you select “Loop” as the action type and it opens a sub section where you can add sub actions. There should also be two fields: a “For” and “While”…
For being an int and While being Jinja2 that returns a bool… both should be able to be entered so for eg I can have it loop 10 times but only while smoke is still detected.

1 Like

why, yes you did…I need to read more closely. :wink: