RM: Repeat without having to set 'every'

Hi,

How can I add a repeat block that repeats 3 times. When I omit to enter a value for frequency it fails...

The "n times" is optional, but you need a time. See here for more:

In your case, a value of 5 seconds would probably get you close to what you have now. The actions are also a bit odd, but I'm assuming you're trying to work around some issue and won't ask questions about that. :slight_smile:

2 Likes

Kind of, but feel free to suggest. My aim is to have light signal an automation is about to start. I felt RM would do, I know there are plenty of notification apps, but a flash or two is all I need

Well, thanks. While this completed the expression and let it execute, there is something strange going on. I set the CT to 2200 and level to 10, but the last "blink" was at an entirely different setting... Restore set it back to what it was before, so that part works...

Ah, yes, I suppose that would flash if all works normally. I thought you might be trying to work around a scene issue or something where the first activation doesn't work. :rofl:

Not sure why the last one would have worked differently. If you had other things being sent to your Hue Bridge at the same time, you could have exceeded Hue's recommended rate limits, and if these are directly-paired Zigbee bulbs, I've found they don't really like fast commands either. More space may help.

1 Like

It is doing something funny... This is the log from one run
image '

It runs the restore twice... I trigger manually 'Run Actions'... Makes no sense, or does it? :slight_smile:

And this is the rule producing the log above
image

That does look strange.
Does the two times restore happen every time you run the rule, or was it only that one time?
Maybe something went wrong after editing the rule a couple of times and setting it up from scratch would solve it?

1 Like

I'd say it does. I've run it like 6 times now and same log every time
image

Won't hurt to try I suppose. brb with results from rewritten rule

Edit: Rewrote the rule from scratch, result is identical
image

Try turning on "Action" logging (and whatever else you may want) for this rule to see if it shows anything helpful about what it's executing when and why.

1 Like

Good idea, here we go... Slightly longer

Summary

I see what's happening. Try and use a delay on the action rather than delay the actions especially as the last delay. I think I saw this my self a while ago but now seeing it in your logs makes me think it is a bug.

@bravenel it's not delaying the final set of actions and continuing on, then doing them again when they should.

Edit @furom you actually don't need the last delay because the 5 second in the repeat is the delay. So you could just remove that? Although you would then need a 3 second delay (or what ever delay you want on the restore).

1 Like

Thanks... I adjusted a bit, and now the light is left off... It says it restored, but actually does not...

Rule
image

Log

Summary

This may not be related, but the "Delay 0:00:03" at the end shouldn't be really be needed here. If the goal before was to repeat every 5 (i.e., 2+3) seconds, that is now handled by the repeat itself. It's possible there is some odd/undefined behavior if both the end of the repeat and a new repeat are reached at basically the same time, as is likely to happen as-is.

Actually it is doing it, its just the delayed off is then happening 2 seconds later.

more like this.

I added some other bits that would be needed if it got triggered again during the loop.

import below

Import jason

{"deviceReplacements":{"5094":{"deviceName":"(DR) Chandelier on Rotherstone 2","deviceLabel":"(DR) Chandelier","deviceTypeName":"Advanced Zigbee RGBW Bulb","deviceTypeNamespace":"hubitat"}},"appReplacements":{"7031":{"appTypeName":"Rule-4.1","appTypeNamespace":"hubitat","appName":"Rule-4.1","appLabel":"test rule","parentAppTypeName":"Rule Machine","parentAppLabel":"Rule Machine","singleInstance":false}},"appData":{"7031":{"state":{"actionListMain":["7","6","11","12","1","2","3","4","8","9","13"],"connectors":{},"actionDone":true,"oldConst2":null,"hasRuleAct":false,"selectActionsParams":{"thisStr":"Main","label":"test rule"},"editCondIf":null,"usesTime":false,"inIf":null,"lvt.Capture":"Boolean","trigCustoms":[],"repeating":[],"capabDone":true,"locationBlocked":[],"ndx.false":3,"lvList":["Capture"],"ruleNdx":2,"capture":"captureMain.11","timeTriggers":[],"allVarsO":["(MB) Bed Spots ManualTrigger","(MB) Bottom of stairs ManualTrigger","(MB) Front Window DL ManualTrigger","(MB) Main Spots ManualTrigger","(SmB) PendentManualTrigger ","(SmB) SpotsManualTrigger","Both Home","Capture","EmergencySleepSync","Emma In Bed","GoodNightMessage","Home Sim","KitchenChristmas","Mode Level","Mode colour","Mode.Level.Downlights","One In Bed","Speakers","Steven In Bed"],"actLabelIndent":"","subscribedVariables":[],"certainTimes":[],"oldConst":null,"prevState":{"PB":"true","Capture":"true"},"capabstrue":{},"lastEvtDate":"03-Apr-2021","actionsMain":{"11":{"wait":null,"delay":"","modes":{},"method":"getCapture","indent":"","rule":0,"label":"IF (Variable Capture(<span style='color:black'>true</span>) = true<span style='color:green'> TRUE</span>) Capture: (DR) Chandelier\\n","cond":2},"1":{"wait":null,"delay":"0:00:05 (stopable)","modes":{},"method":"getRepeat","indent":"","rule":0,"label":"Repeat 3 times every 0:00:05 (stopable)\\n","cond":0},"12":{"wait":null,"delay":"","modes":{},"method":"getSetVariable","indent":"","rule":0,"label":"Set Capture to false\\n","cond":0},"2":{"wait":null,"delay":"","modes":{},"method":"getSetColorTemp","indent":"\\t","rule":0,"label":"\\tColor Temperature: (DR) Chandelier: 2200: 10\\n","cond":0},"13":{"wait":null,"delay":"0:00:03 (cancelable)","modes":{},"method":"getSetVariable","indent":"","rule":0,"label":"Set Capture to true --> delayed: 0:00:03 (cancelable)\\n","cond":0},"3":{"wait":null,"delay":"0:00:02 (cancelable) (cancelable)","modes":{},"method":"getDelay","indent":"\\t","rule":0,"label":"\\tDelay 0:00:02 (cancelable)\\n","cond":0},"4":{"wait":null,"delay":"","modes":{},"method":"getOffSwitch","indent":"\\t","rule":0,"label":"\\tOff: (DR) Chandelier\\n","cond":0},"6":{"wait":null,"delay":"","modes":{},"method":"getCancelDelay","indent":"","rule":0,"label":"Cancel Delayed Actions\\n","cond":0},"7":{"wait":null,"delay":"","modes":{},"method":"getStopRepeat","indent":"","rule":0,"label":"Stop Repeating Actions\\n","cond":0},"8":{"wait":null,"delay":"","modes":{},"method":"getEndRepeat","indent":"","rule":0,"label":"END-REP\\n","cond":0},"9":{"wait":null,"delay":"0:00:03 (cancelable)","modes":{},"method":"getRestore","indent":"","rule":0,"label":"Restore: (DR) Chandelier --> delayed: 0:00:03 (cancelable)\\n","cond":0}},"nestedInIf":[],"actNdx":14,"lastEvtValue":0,"installed":true,"waitEvents":[],"private":"true","gvList":["(MB) Bed Spots ManualTrigger","(MB) Bottom of stairs ManualTrigger","(MB) Front Window DL ManualTrigger","(MB) Main Spots ManualTrigger","(SmB) PendentManualTrigger ","(SmB) SpotsManualTrigger","Both Home","EmergencySleepSync","Emma In Bed","GoodNightMessage","Home Sim","KitchenChristmas","Mode Level","Mode colour","Mode.Level.Downlights","One In Bed","Speakers","Steven In Bed"],"hasDevice":null,"allVars":{"EmergencySleepSync":{"val":"false","type":"Boolean"},"Mode Level":{"val":15,"type":"Number"},"(SmB) SpotsManualTrigger":{"val":false,"type":"Boolean"},"Mode.Level.Downlights":{"val":15,"type":"Number"},"(SmB) PendentManualTrigger ":{"val":"false","type":"Boolean"},"KitchenChristmas":{"val":"false","type":"Boolean"},"Both Home":{"val":"true","type":"Boolean"},"Speakers":{"val":null,"type":null},"Steven In Bed":{"val":"false","type":"Boolean"},"Capture":{"val":"true","type":"Boolean"},"GoodNightMessage":{"val":"Good night everyone;Night, Night don't let the bedbugs bite;Sexy time?;Have a great sleep;Hope you had a great day, who knows what tomorrow will bring?","type":"String"},"Home Sim":{"val":"false","type":"Boolean"},"Mode colour":{"val":2800,"type":"Number"},"(MB) Front Window DL ManualTrigger":{"val":"false","type":"Boolean"},"(MB) Bed Spots ManualTrigger":{"val":"false","type":"Boolean"},"(MB) Bottom of stairs ManualTrigger":{"val":"false","type":"Boolean"},"(MB) Main Spots ManualTrigger":{"val":"false","type":"Boolean"},"Emma In Bed":{"val":"false","type":"Boolean"},"One In Bed":{"val":0,"type":"Number"}},"changedValues":true,"simpleCond":false,"nestedRepIf":[],"lastEvtTime":"08:58 PM","nestedElse":[],"formerState":"Capture","cutAction":[],"stopped":false,"nestedLabel":[],"paramNdx":1,"lv.Capture":"true","howMany":0,"varUseList":{},"waitCondNdx":2,"capabsfalse":{"11.false":"cond","2.false":{},"1.false":{}},"timeTriggersW":{},"timeFormat":"hh:mm a","waitConds":[],"thisStr":"Main"},"appSettings":[{"deviceList":null,"multiple":false,"name":"actionDone","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.9","type":"enum","value":"Restore Devices"},{"deviceList":null,"multiple":false,"name":"createCon~Capture","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.7","type":"enum","value":"Stop Repeating Actions"},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.8","type":"enum","value":"END-REP"},{"deviceList":null,"multiple":false,"name":"delaySecondMain.3","type":"text","value":"2"},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.6","type":"enum","value":"Cancel Delayed Actions"},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.3","type":"enum","value":"Delay Actions"},{"deviceList":null,"multiple":false,"name":"repeatMinuteMain.1","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.4","type":"enum","value":"Turn switches off"},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.1","type":"enum","value":"Repeat Actions"},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.2","type":"enum","value":"Set color temperature and level"},{"deviceList":null,"multiple":false,"name":"insertAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"cancelLv","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"not2","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"state2","type":"enum","value":"true"},{"deviceList":null,"multiple":false,"name":"goof","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.14","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"varType","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"delaySecMain.9","type":"text","value":"3"},{"deviceList":null,"multiple":false,"name":"actTypeMain.11","type":"enum","value":"Capture/Restore, Device Refresh or Polling"},{"deviceList":null,"multiple":false,"name":"actTypeMain.12","type":"enum","value":"Set Mode, Variables or File, Run Custom Action"},{"deviceList":null,"multiple":false,"name":"myVarsMain.13","type":"enum","value":"Capture"},{"deviceList":null,"multiple":false,"name":"myVarsMain.12","type":"enum","value":"Capture"},{"deviceList":null,"multiple":false,"name":"actTypeMain.13","type":"enum","value":"Set Mode, Variables or File, Run Custom Action"},{"deviceList":null,"multiple":false,"name":"stopRepeatMain.1","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"delayMinMain.9","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"refreshActions","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"editLv~Capture","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"dValues","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"deleteLv~Capture","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.13","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"hasAll","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"cancelCapab","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delayMinMain.13","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"rDev2","type":"enum","value":"Capture"},{"deviceList":{"5094":null},"multiple":true,"name":"captureMain.11","type":"capability.switch","value":null},{"deviceList":null,"multiple":false,"name":"delayActMain.11","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.12","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"repeatNMain.1","type":"text","value":"3"},{"deviceList":null,"multiple":false,"name":"delayHorMain.13","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"origLabel","type":"text","value":"test rule"},{"deviceList":null,"multiple":false,"name":"delayHourMain.3","type":"number","value":""},{"deviceList":null,"multiple":true,"name":"logging","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"editCond","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"updateRule","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delaySecMain.13","type":"text","value":"3"},{"deviceList":null,"multiple":false,"name":"repeatSecondMain.1","type":"text","value":"5"},{"deviceList":null,"multiple":false,"name":"valBoolMain.12Capture","type":"enum","value":"false"},{"deviceList":null,"multiple":false,"name":"butEndRep","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"ctLevelMain.2","type":"text","value":"10"},{"deviceList":null,"multiple":false,"name":"delete","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"valBoolMain.13Capture","type":"enum","value":"true"},{"deviceList":null,"multiple":false,"name":"cancelActMain.9","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"locVar","type":"text","value":""},{"deviceList":null,"multiple":false,"name":"delayHorMain.9","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"rCapab1","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"rCapab2","type":"enum","value":"Variable"},{"deviceList":null,"multiple":false,"name":"actionCancel","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"cancelActMain.3","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"delayMinuteMain.3","type":"number","value":""},{"deviceList":null,"multiple":false,"name":"repeatHourMain.1","type":"number","value":""},{"deviceList":{"5094":null},"multiple":true,"name":"ctMain.2","type":"capability.colorTemperature","value":null},{"deviceList":null,"multiple":false,"name":"ctLMain.2","type":"text","value":"2200"},{"deviceList":null,"multiple":false,"name":"RelrDev2","type":"enum","value":"="},{"deviceList":null,"multiple":false,"name":"editAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.9","type":"enum","value":"Capture/Restore, Device Refresh or Polling"},{"deviceList":null,"multiple":false,"name":"comments","type":"textarea","value":""},{"deviceList":null,"multiple":false,"name":"cancelActMain.13","type":"bool","value":"true"},{"deviceList":null,"multiple":false,"name":"cutAct","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.7","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.12","type":"enum","value":"Set Variable"},{"deviceList":null,"multiple":false,"name":"delayActMain.6","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.13","type":"enum","value":"Set Variable"},{"deviceList":null,"multiple":false,"name":"delayActMain.9","type":"bool","value":"true"},{"deviceList":{"5094":null},"multiple":true,"name":"offSwitchMain.4","type":"capability.switch","value":null},{"deviceList":null,"multiple":false,"name":"actSubTypeMain.11","type":"enum","value":"Capture Devices"},{"deviceList":null,"multiple":false,"name":"varValue","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"useCondMain.11","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"moreVar","type":"button","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.2","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"delayActMain.4","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.2","type":"enum","value":"Set Dimmers and Bulbs"},{"deviceList":null,"multiple":false,"name":"actTypeMain.1","type":"enum","value":"Delay or Repeat Actions, Wait"},{"deviceList":null,"multiple":true,"name":"deleteAct","type":"enum","value":null},{"deviceList":null,"multiple":false,"name":"actTypeMain.4","type":"enum","value":"Control Switches, Push Buttons"},{"deviceList":null,"multiple":false,"name":"actTypeMain.3","type":"enum","value":"Delay or Repeat Actions, Wait"},{"deviceList":null,"multiple":false,"name":"actTypeMain.6","type":"enum","value":"Delay or Repeat Actions, Wait"},{"deviceList":null,"multiple":false,"name":"randomActMain.3","type":"bool","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.8","type":"enum","value":""},{"deviceList":null,"multiple":false,"name":"actTypeMain.7","type":"enum","value":"Delay or Repeat Actions, Wait"}],"subscriptions":[]}}}

1 Like

Thanks. With that as inspiration, I ended up with this. I just cancel all remaining delays before the restore, it will be good enough for my needs.
image

I still have a hard time with this one though
image

...how should this be read? "Every 5 seconds this is repeated 3 times", or "With 5 seconds interval repeat this, and do it 3 times" or "Repeat 3 times with 0:00:05 apart" ?

Without the mandatory time, it could have been used as a simple FOR loop, which really is what I wanted...

This

2 Likes

I believe this can be done aswell, although I believe it is essentially this.

I mostly use the WHILE loop, that's done with a simple condition then repeat as the action. Then as long as the condition is true it keeps happening.

2 Likes