After letting my Hubitat sit unused for a few months, I've finally started to learn a few automations and I'm running into a problem. The intent is simple, when a bathroom fan is switched on, wait 30 minutes, then evaluate the humidity in the bathroom compared with the bedroom - once they're within a certain distance (8%), shut off the fan (switch). I'm trying to replace a more "dumb" rule which simply runs the fan for 60 minutes (currently set up under Basic Rules, and currently paused).
I've created the rule, and according to the Hubitat web interface, all the conditions seem to have been met, however the action (shutting off the switch) has not been taken. Any suggestions?
I'll try to includ a screenshot of the rule (with conditions completed) and a couple of the logs (full logs, and filtered on the rule name). The error message in the logs is new (previous attempts haven't shown them), but I did notice an immediate " Action: Off: Master Bathroom Fan Switch (skipped)" message, which on previous attempts to troubleshoot I had put down to trying to troubleshoot several times in sequence (and hence the skipped message was from a previous attempt), but now I'm not so sure.
Your rule is going to typically fail immediately because your first action is evaluating a state of the fan being on for 30+ mins, but it was triggered milliseconds earlier by the fan turning on.
One way (there are plenty others!) could be something like this:
Trigger = Fan On
Wait for Event = Elapsed Time of 30 minutes
If Humidity thing met THEN
Fan = Off
ELSE
Wait for Expression = Humidity thing met
Fan = Off
End If
This is a simple version that assumes the fan can't (or won't typically) be turned off manually or by something else, and that you want the fan to run at least 30 minutes no matter what. If either isn't true, then it gets more complicated (but still do-able).
The Rule Machine Documentation is very good -- it's an excellent resource as you're learning Rule Machine.
Don't want to discourage you from learning Rule Machine, it's a worthwhile investment. But for controlling exhaust fans based on two humidity sensors, this app is (IMO) the best. It's not in HPM yet so you'll have to install the code manually.
Don't worry about the "for Testing" thing in the title. It's been "in testing" for 2.5 years now, perhaps the longest test period of any Hubitat app known to man. It's quite stable and works very well.
Thanks for the responses. hydro311, I see what you mean about events (ie discrete points in time) vs states (existing conditions), I think that the existing way that the Rule 5.1 creation tool is currently worded can cause some confusion for newcomers like myself - although I don't have any better solutions to suggest at this point.
I re-wrote the rule to follow the structure suggested by hydro311 and it seems to work exactly as intended - 30 min minimum run time, followed by a period of checking the deltas and shutting off the fan once the delta reached the threshold difference (8%, in this case).
dcaton1220, thanks for the heads-up. I should have some time off around christmas, I may take a look at more sophisticated options.
Glad that worked! If (or when!) you discover an edge case down the road that throws a wrench in it, you can tweak as needed.
My first stab at a new rule rarely stays untouched for long -- things you didn't originally consider eventually pop up, so you just improvise, adapt, and overcome.
I'm a huge fan of Rule Machine -- I'm not any kind of programmer, but I understand basic logical arguments, so Rule Machine is right up my alley. @bertabcd1234 has done (and continues to do) a great job beefing up all of the Hubitat Documentation stuff, so it's all a great resource to use as you're getting your feet under you. Have fun!