I have a fairly basic rule that allows my wife to push a button in that alerts me to keep it down while she is sleeping for night shift. I'm stuck trying to figure out how to repeat an action N times without being bound to time or a condition.
If she pushes the button I want it to do the following:
Check if I am home - if yes then -
Send a single notification to my phone to be quiet.
Have my coloured bulbs flash three times quickly.
If I am not home - do something else.
There may be a better way to do this altogether. I'm kind of stuck and can't find any specific documentation on it.
When you create a repeating action, you have an (optional) option to "repeat n times." If you use this, there is a defined stopping point for your repeat, so you do not need to use conditionals elsewhere in your actions to perform that function:
I'm not sure where the repeat comes into play in your rule at all unless you are simulating the flash with repeated "On" and "Off" actions in a rule, in which case this would certainly work (very easy if you have a desired end state, on or off, for the bulbs; or don't plan on changing their color, in which case Rule Machine's built in "Capture..." and "Restore..." actions for bulbs will work without any surprises). Alternatively, some devices implement a "Flash" command (check their device page: you'll see it in the buttons/commands at the top by things like "On," "Off," "Refresh," and whatever other commands your device has). In that case, you can use that action in RM to do this instead without any repeats on your part.
I think this tells me what I need to know.
I interpreted this to repeat 5 times every 2 seconds indefinitely. But it actually will repeat every 2 seconds for 5 cycles?
The settings as I have defined above will repeat the actions 5 times total. There will be 2 seconds in between repeats.
Thanks very much bert. I should have been able to figure this out. Hopefully someone else finds this thread and gets a quick answer.
I think my initial interpretation was actually correct. I have the rule set up as you described, and it just keeps repeating. It is repeating 3 times every 2 seconds for example, not the other way around.
To define a repeat, you need at least a time interval; the set of actions will not repeat on its own immediately when the last one is reached (probably because this could lead to never-ending resource-consuming loops). You can optionally add a number-of-times restriction, without which you'd need something else to stop the actions (assuming you do indeed want them to stop).
This doesn't sound consistent with what you're seeing, so maybe something is wrong with your rule? Feel free to share a screenshot if you're not sure.
On firmware 2.2.3.148, these rule actions produce the following results, as expected:
Mine seems to just loop indefinitely. Can you show me the settings for your release step? Everything else looks the same.
Alas, that was a rest rule I deleted, but I just put in 5 seconds for the interval and 3 times for the number. I did not choose "stoppable," though that would not have hurt (just also wouldn't have done anything here).