Do EVERY Loop - Odd Hours Only


#1

1) Give a description of the problem
I have a ‘Do Every’ loop - ‘do every other hour at 19 minutes after the hour’ that runs my HVAC recirculation fan every other hour for 20 minutes. It works well as written. However, I’d like it to run only on every ODD hour. Depending on the TOD that I modify/save the piston, it will then thereafter run either EVEN or ODD hours. I’d like to have it run always on the ODD hours - and not based on when I modify the piston. I’m having trouble coming up with the right expression to do this.

2) What is the expected behaviour?
Execute the DO EVERY loop every other hour on the odd hours only

3) What is happening/not happening?
See above

**4) Post a Green Snapshot of the piston![image|45x37]

5) Attach logs after turning logging level to Full
N/A


#2

Would a restriction in the timer help?
image


#3

Yup! A restriction will work - and that expression was the key.

I originally thought your suggested restriction wouldn’t work because the Do Every Other Hour loop and the Do only on odd hours restriction (in the case when the loop wanted to do even hours), would never match so the piston would never execute - unless of course the loop was already trying to do odd hours. But then the addition of the restriction would have done nothing to fix my issue.

But, once I thought about it more (I can be slow sometimes), I changed the loop to run hourly instead of every other hour and then added your restriction - “IF {$hour%2} is equal to 1” to the top of the restriction list so that it shouldn’t take very long for it to determine it’s an odd hour or not.

So, here’s the modified piston:

Thanks for your help!


#4

Ah, I didn’t notice you had every other hour initially, I missed the important other lol.


#5

Here is how I would do it. It works right out of the box.

pic


#6

Well, don’t I feel silly! Yup, that’ll definitely work too. I must be getting foggy-headed from all this social separation.

Thanks for the help guys!


#7

That is one of the beauties of webCoRE… So many different ways to go about things…