I have a rule that tracks the cumulative runtime of my furnace. It works as expected except for when the start and stop time cross over midnight (the difference between start and stop doesn't calculate correctly), what is the best way to deal with this scenario?
After thinking about it, I may have answered my own question. If I set the start and stop time varialbes to include time and date it should correct the final math?
Rather than doing all that logic yourself, perhaps just use one of these apps that track time-of-device-in-state for you.
You might need a rule that toggles a virtual switch when the Operating State of your tstat goes into or out of heating. Then track that virtual switch with either of these:
It's pretty specific to my use case (letting me know when to replace a filter based on hours of runtime), but this app might work for you too or maybe could with some modifications:
I had a rule that did something similar before that but no longer have the rule around to show exactly what I did, unfortunately.
Your app is very close to what I was trying to achieve (seems we think similarily). Only thing I'd love to see is the option to reset it with a contact (my furnace filter door) or a button or switch so I could do it from RM.
This is what I was doing for a reminder/reset as a companion to the RM rule from above to track the runtime.
If you don't care about when it ran but only for how long, why not make a one minute repeat loop and store the number of minutes. Then do with the minutes what ever you need. Maybe at 40,000 minutes send a filter reminder.
I do but with it integrated in HE I not only get phone notifications but I can have it announce it on my echo devices. I also have a a dashboard where I can look at all my Ecobee information. I never have to open the Ecobee app anymore.
The example I showed would require less resources as it doesn't have a 1 min reboot loop. Not sure if it's a huge difference to the hub, but seems like it would be more efficient.
The Ecobee driver does, That is probably my largest runtime for my system. I installed a air purifier system on my unit last year and set the ecobee to run the fan a minimum of 20 minutes/hr.
What the loop does only if the HVAC is not in idle. Adds 1 to a memory location, then compares that memory location to a value stored in another location once a minute. Once in a big while, it sends out a notification and maybe writes a 0 into a memory location. All low overhead operations.
If Fan on could move the state off of idle, the counter would start. The thermostat has a circulate mode which the driver is not picking up. I recently moved off of a Nest Gen 3 thermostat I have run for nearly 6 years which did all that in Googles cloud. No Google cloud so I have to write in my own extra features. Like the filter reminder and shut it off if a smoke alarm alerts.