Help/Ideas Needed - Timer Based On Switch Runtime With a Reset


Thank you in advanced for any ideas/help on this.

Tl; DR version:
Need help establishing a cumulative timer with an ability to reset

Full Version:
I have a dumb humidifier (manual dial for on/off and no auto-shutoff when out of water) that I have plugged into a smart plug (zooz zen25). I plan on running the humidifier to figure out runtime of a full tank of water. I have existing rules that turn it off/on based on when I need humidity added and work well.

I would like to create a rule that tracks the amount of time the humidifier runs over a tank lifetime. So on/off several times with a time accumulator. Once it reaches the accumulated time threshold, it sends me a notification and shuts off the plug (notification and plug off part is easy). I would like to also be able to "reset" the accumulated timer by 2 quick on/offs, virtual button, or some other easy way as we might fill the tank before it is actually empty.

Have you looked into webcore? You could easily accomplish what you desire there.

I tried putting something together but couldn't get it to work quite right. It has 2 problems. First, it allows the humidifier to run past the timer-acc-max setpoint if the value of timer-acc is less than the max value at the beginning of the cycle. I would think you would want it to interrupt the cycle and shut down once it hits the max time. Although this rule will prevent any subsequent cycles.

Second, I can't get the rule to stop repeating. That's kind of a deal breaker.

This is my first attempt at using the repeating function, so I'm sure that I'm just doing it wrong. Probably both of these issues have pretty simple fixes for someone with a bit more experience.

Thank you for your reply. I have not, but upon first look it looks like its web based. If I cannot find a better local way (in RM) I might give this a shot.

Thank you for your suggestion. Yes, a few deal breakers there. I'll keep trying to think of a solution.

This looks promising...

1 Like

This does look promising. I'll have to give it a shot in a day or two when I'm free again. Thanks!

I was just about to suggest that.

I did some reading on repeating actions and got this rule to work. Had to get the sequence just right and also needed to use a "simple conditional" for the repeat action command. Seems to work great now. Just need to set the repeat interval to 1 minute and create two global variables. Time-acc is the accumulated runtime in minutes ( set to zero initially) and time-acc-max is how long your unit can run on a full tank.

Should be simple enough to use a virtual button to reset the time-acc variable and resume the humidifier control rule.

I'm planning to use this with my ecobee to track my HVAC hours. Then I can set a notification to change my filter every 300 hours of runtime instead of every 3 months. For that version i will probably use a local variable to track the minutes during each run event, then convert to hours before adding it to my global variable. Thanks for motivating me to figure this out!

Thank you! Very much appreciated. I will set this up as I think it is what I am looking for. Also now, I also have to notify myself to replace the furnace filter. Never thought to automate that!

Thanks again to everyone who responded. You all helped me get to the final end. I thought I would post my final result incase anyone else ran across this thread.

My approach does NOT relate to any power or runtime related smart plug per my original approach. I could not get it running reliably from the plug metrics. Any smart plug could be used in my solution.

I have put a couple local variables (lv) in the mix and have one global variable (gv) to do runtime accumulation.

I was running into an issue, based on my trigger, that it was executing multiple times thus causing my maxRunTime accumulator variable to increase incorrectly, so I added in a local variable to keep track if the rule was already executing. I tinkered with the idea of splitting up the rule, but then I would have 4 instead of 3 rules and this is only something I'll be running in the winter occasionally so didn't want to have the spread.

This is the main automation of the humidifier itself which could be adopted to anything else you might be trying to run. The variables allow for you to parametrize the solution making it easier to adjust if you wanted to change it in the future.


I then have a separate rule where I reset the maxRunTime global variable via an Alexa command and a virtual switch (Virtual Switch - Reset Plug - Humidifier) that I created and exposed through the Amazon Echo Skill app.

The virtual switch (Virtual Switch - Reset Plug - Humidifier) that I exposed to Alexa, I then setup a custom routine in the Alexa app where I setup a trigger phrase "Alexa, reset the humidifier" that I invoke whenever I refill the tank. This turns on the Virtual Switch - Reset Plug - Humidifier switch that I exposed.

Since I do not always have the humidifier running, I have created another rule and virtual switch (Virtual Switch - Humidifier Season) to pause and resume the rules. I have done something similar for all of my various Christmas lights and several routines so its easily manageable. I have a created a dashboard that I called "Variables" that shows the virtual switch (Virtual Switch - Humidifier Season) that I created and it is used to toggle if I am using the humidifier or not and does the rule pausing or resuming based on one click.

This rule logic is: