Trying to ensure HVAC fan runs for at least ten minutes every hour, but hourly conditionals not working


1) Give a description of the problem
My hourly conditions aren’t running

2) What is the expected behavior?
That hourly conditions run

**4) Post a Green Snapshot of the piston!

In addition to learning why the hourlies aren’t running, maybe you guys might have a better way to do this…

I want to track how often the HVAC fan runs. I’d like it to run for at least 10 minutes every hour. If it has only run for 2 minutes (as an example), starting near the bottom of the hour (from xx:52 - yy:00), I’d like it to run for 8 minutes.


I suggest you use this code from @eibyer to accumulate run time. Just replace the every day at midnight with every hour and then calculate the remaining time to run. For the run, I suggest using on, wait x minutes, off, reset timer. Keep it simple.


Weird. I’m having the same issue with that piston. The conditional, "every hour, at :50 past the hour’ isn’t running.

edit: Wait. Will the timer for :50 past not actually start until the top of the next hour?


Okay, I think I’ve simplified it a bit, but I still can’t seem to get the IF at line 35 to fire. I’m still missing something.


Yes. It is never scheduled for the hour you are currently in.

For example, if you edit/save the piston between 1PM and 1:59PM, the first schedule won’t be until 2:50PM. From that point onwards, it will be hourly


By chance, any idea what I’m doing wrong with my last posted piston?


I am booked the next 48 hours, but a few observations:

formatDateTime($now, 'mm')
is the same as using:

Since you have no logic in lines 29-33, I would delete all lines with the variable “countdown”.
(lines 28 thru 33 as well as lines 18, 36 & 45 serve no purpose)

Your lines 36-47, can be replaced with:

every hour at :44 past the hour
with Thermostat 1 
    Wait 1 second and then do stuff

(The 1 second wait is so the other repeating block has a chance to finish)

Beyond that, it helps when troubleshooting to add a few “Log to consoles” so it’s easy to see what is happening during the process.


OMG, you’re a wizard. That worked. I was just missing the ‘wait 1 second’ thing. Can you explain a little more on why that wait is needed?

For closure, here is the piston in it’s final form.

edit: And LOL at 67 builds. Good Lord!


Well, the piston runs top to bottom every minute and it runs top to bottom at half past every hour. This means that at :30 past, both triggers are firing. The 1 second Wait simply gives time for the first block to finish before the second block runs.

Pro Tip:
If the first block was complex, a slightly longer Wait may be needed, but 1 second is plenty to set a variable.


Okay. It clearly doesn’t work without the 1 second wait. But it can still process the 1 second wait (but nothing else) even though the ‘every minute’ trigger is firing. That seems… odd.


I think what is happening behind the scenes is the piston has two instances of itself running at half past each hour. The first instance just sets the variable, and then stops. The second instance waits a second, and then continues with the rest of the second block.

For what it’s worth, I normally try to stagger code like this. Something as simple as making the first block run every 61 seconds would probably also do the trick. (as long as the piston was saved at any time other than 28-32 past the hour)