Break out of Repeat

I am planning a switch from Indigo Domotics to Hubitat. I will be buying a Z-Combo (combination smoke/carbon monoxide detector) to replace the Z-Smoke that I currently use.

I plan to use something like the following for the Action of the rule. I am assuming the trigger will be something like: when the Z-Combo turns on…

Set color: Sylvania 1 -> Red->Level: 100
Repeat 300 times every 0:00:08 (stopable)
    On: Sylvania 1
    Wait for event:  --> elapsed time: 0:00:05  
    Off: Sylvania 1

In my playing around, I can't figure out how to force stop this rule after a few seconds?

I think I would like to have it break out of the Repeat section if the Z-Combo turns off (exits self-test after a few seconds, or responds to my button press after complaining about my cooking).

I think I'm looking for "While ON Repeat...", but I can't see a way to do this. It may be because I don't don't have a Z-Combo connected yet, or I'm just not thinking about it correctly.

What is the correct way to do this?

Thanks,
Barry.

Inside your repeat loop you can use an if to test for a switch being on and then use

Stop Repeating Actions

There is a RM idiom that does exactly what you are wanting. It is the “Simple Condition Action” where the Action is a Repeat.
I discussed this recently, with an example, here.

So, what you want is:

Stop Repeating Actions
IF (Z-Combo = ON) REPEAT 300 times every 0:00:06 (stopable)
Toggle: Sylvania 1
END-REP
Off: Sylvania 1

That’s it. The final Off is because the Sylvania 1 could be left on or off. You could set it however you want.

Edit: I left out the Stop Repeating Actions. Need that if the rule is re-triggerable.

1 Like

Thanks for both your replies.

That Simple Condition Idiom is brilliant. It allows you to form a "While" loop.

@steve.maddigan, I see vs.Bed.shaker. Which hardware do you use? I have cobbled together a controllable bed shaker using a smart outlet, 9 V power supply, and Sonic Boom vibrator/shaker. It works, but it's not the prettiest solution. Have you found a better choice?

Thanks @672southmain

I will investigate simple automations as well.

@barry5 - short answer - no.

I bought this and threw out the clock.

Super Loud Alarm Clock for Bedroom Digital Clock for Heavy Sleeper Vibraning Alarm Clock Strong Bed Shaker,Battery Backup,Large LED Display,5 Dimmer, Snooze,USB Amazon.ca

And am using a sonoff s31 lite and a 3v dc power supply. After the repeat loop it gets set to on until I get up and double tap the closet light twice :wink:

I learned I have to be careful and not repeat too fast or the plug locks up for a minute or so.

That said, it’s be 100% in getting me out of bed for almost three months now.

Just reread you post.

Now I understand this is a simple condition statement and not under simple automations like I first read. Nice.

1 Like

Thanks. It looks like about the same thing I do. I bought used stuff from eBay – an Aeotec outlet, wallwort-type DC power supply, and individual Sonic Boom bed shaker. I also found that if I toggle it too fast, it acts a little funny.

1 Like