So, I want to notify myself to empty the dehumidifier when it is full. Presently, there are some rules for the outlet that make it turn on and off the dehumidifier as I wish; this functionality works excellent.
The general idea is that if power < 20w, it means the dehumidifier is being told by Hubitat that it should be on, but it isn't running, so it must be full. The problem is that it is unpredictable, and will go into some weird power states where it's drawing like 1-15w randomly for a few minutes.
My current "problematic" solution:
Trigger:
- Power < 20
Rule:
- Wait 5m
- If power < 20w AND the outlet is still trying to be on (to deal with getting a notification pointlessly after it is off)
--- notify cellphone - End If
It works perfectly, except it triggers over and over every time power fluctuates. So, if the dehumidifier IS full, it sits at around 3w and does nothing; it's great IF the power is consistent. However, maybe it's losing it's mind and drawing 4.8w, 2.1w, 17.6w, 1w, 17w ... or "at idle (full) it's drawing 3.1w, 3.2w, 3.0w, 3.1w, etc etc. In those scenarios, each time power changes it runs the rule, and waits (so, potentially hundreds of notifications). If the tank IS full, I'll get all the reports after 5m of the power reporting.
Unless there's another way, I want to do this:
Trigger: Power < 20w
Rule:
- Pause this rule (but, for this instance, keep running)
- Wait 5m
- If power < 20w AND the dehumidifier is still trying to be on
--- notify cellphone - End If
- Re-enable rule <-- this option does not seem to be available for the current rule
I thought of using a local variable instead, so:
Rule:
- If "is_running" = false then
--- Set variable "is_running" = True
--- Wait 5m
--- If power < 20w AND the dehumidifier is still trying to be on
----- notify cellphone
--- End If
--- Set variable "is_running" = False - End If
It's a bit cleaner, but still results in the trigger executing a bunch of times for no reason, though it eliminates the duplicate notifications, and potentially a bunch of pointless processing. Does it end up mattering? Not sure, but I'd rather have clean rules, and never run into issues, rather than go back and fix piles of rules because I programmed them like poo.