Repeat / Until based on time. Stupid me!

After a while you forget. I should remember my old Fortran-77 procedural programing days reflexes.

I was a bit lazy and I blindly reproduce the rules from this youtube video : Color-changing LIFX bulb automation with Hubitat Elevation,… just to remember after a few days that this is the 101 newbie programming error that I was doing at the University ( I rather used While loop than Repeat loop myself :blush: )

Enough complaining.

Consider that rule :

What is the error?…. Until Time=22:15 in the UNTIL condition. What if at the time of the evaluation it is not 22:15 exactly but 22:15:01….. The condition will be false and the Until condition will never be true. (in my case there is a wait in the Repeat/Until (not a good idea, but I was lazy copying the rule as I previously said)

See my log below...

Solution – I set a variable to True with another rule that will stop the Repeat/Until.
Maybe there is something more elegant. I was looking for Repeat Until time <= 22:15 but it does not look that there is that possibility.

Although using Between two times, setting 22:15 and 22:20 would probably be ok. Just that I have another rule available to set that variable.


app:162  2022-12-13 22:13:37.501  info  Action: Repeating Actions`
app:162  2022-12-13 22:13:37.524  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Red
app:162  2022-12-13 22:13:37.645  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Green Level: 60
app:162  2022-12-13 22:13:37.888  info  Action: Wait for event: --> elapsed time: 0:01:00
app:162  2022-12-13 22:14:37.929  info  Wait Event: elapsed time
app:162  2022-12-13 22:14:37.934  info  Wait over: elapsed time
app:162  2022-12-13 22:14:37.984  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Green Level: 60
app:162  2022-12-13 22:14:38.115  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Red

app:162  2022-12-13 22:14:38.305  info  Action: Until (Time is 22:15(F) OR Variable ForceStopHolidayRotation(false) = true(F) [FALSE]) (rule false, waiting for next)
app:162  2022-12-13 22:15:37.689  info  Action: Repeating Actions

app:162  2022-12-13 22:15:37.716  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Red
app:162  2022-12-13 22:15:37.878  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Green Level: 60
app:162  2022-12-13 22:15:38.109  info  Action: Wait for event: --> elapsed time: 0:01:00
app:162  2022-12-13 22:16:38.149  info  Wait Event: elapsed time
app:162  2022-12-13 22:16:38.154  info  Wait over: elapsed time
app:162  2022-12-13 22:16:38.204  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Green Level: 60
app:162  2022-12-13 22:16:38.335  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Red

Variable ForceStopHolidayRotation(false) = true(F) [FALSE]) (rule false, waiting for next)

app:162  2022-12-13 22:16:38.524  info  Action: Until (Time is 22:15(F) OR
app:162  2022-12-13 22:17:37.824  info  Action: Repeating Actions
app:162  2022-12-13 22:17:37.848  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Red
app:162  2022-12-13 22:17:37.976  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Green Level: 60

To stop I was setting the Variable ForceStopHolidayRotation(true) manually to true to stop the Repeat

app:162  2022-12-13 22:22:38.529  info  Wait Event: elapsed time
app:162  2022-12-13 22:22:38.533  info  Wait over: elapsed time
app:162  2022-12-13 22:22:38.582  info  Action: Set color: (L)(E) Balcon Centre, (L)(E) Balcon Gauche, (L)(E) Balcon Droit Green Level: 60
app:162  2022-12-13 22:22:38.708  info  Action: Set color: (L)(E) Corniche Gauche, (L)(E) Corniche Droit, (L)(E) Garage Gauche, (L)(E) Garage Droit Red
app:162  2022-12-13 22:22:38.902  info  Action: Until (Time is 22:15(F) OR Variable ForceStopHolidayRotation(true) = true(T) [TRUE]) (rule true, end repetition)
app:162  2022-12-13 22:22:38.936  info  Action: Repetition ended
app:162  2022-12-13 22:22:39.048  info  Action: Set ForceStopHolidayRotation to false
app:162  2022-12-13 22:22:39.069  info  Action: Cancel Timed Actions: **This Rule**

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.