Measure Duration

Total noob, so I apologize if this is simple. I have a humidity sensor for controlling bathroom fan during/after shower. At this point I'm just doing some diagnostics to evaluate the effectiveness of what I eventually want to write to do the control.

I've been using RM + AutoRemote to Tasker + AutoTools to help graph the changes in humidity (haven't figured out InfluxDB + Grafana...or really best way to run local server – I don't know anything about Raspberry Pi, but do have a Windows 10 PC that's able to stay on).

Anyhow, I digress... I've found a humidity value via the graph where I am confident that is where I'll know the fan is needed (it may already be on, if turned on manually). What I'd like to do at this point is determine how long it would stay on, if it triggers at that humidity (A), and stays on until the humidity drops to a lesser humidity (B) that is still above the typical room humidity (don't want the fan fighting to get back to nominal...just enough to deal with the shower).

So, can anyone provide any help on a rule to measure how much time lapses between A and B?

Well you could just go based on humidity.

On when higher than whatever humidity trigger and cancel delayed actions
Off when lower with a 1 minute delay so you don't have fan cycles.

Could also throw in some additional sanity checks such as lights are on and time is not between say midnight and 6am.

1 Like

I just set this up here. I made two rules one that will capture the humidity in a global variable anytime the bathroom light comes on:

Then the other rule looks like this:

So basically the humidity is captured when the light in the room goes if the fan is currently off. Then the other rule looks for the humidity to climb by 4% (still fine tuning this) and once it does the fan is turned on. Then it will run until the humidity goes back down to 2% above the start point.

Note that I also have another rule that will turn off the exhaust fan if it's been running for 15 min and the bathroom light is off. Kind of a catch all.

Note too that the "virtual" fan is there because the driver on the fan part of this switch isn't updating for me properly. Hopefully it will get fixed at some point but I can't get any reply from anyone else that has one of these to see if it's just something I'm seeing or if others are as well. But this work around does the trick for now.

To do this in one rule you would be looking at

Trigger: humidity > 70

Actions:
Turn fan on
Wait for condition humidity < 70
Turn fan off

2 Likes

Good point. Still learning. Thanks @Hasty1

I've yet to include humidity in my bath fan control. However I've been thinking of the rule I might use. I live in the northeast and often the warm humid air should be kept inside.

  1. It should be on long enough to keep the moisture from coating the walls.

  2. In the winter when its cold and dry outside the fan should go off as soon as it can.

  3. In the Hot Humid summer the fan should be balances somehow, I don't have a good set of parameters for this yet.

So basically I have to determine if the air in the bathroom is more or less desirable than the air outside.

Setup seasonal virtual switches and apply your humidity settings based on which switch is on.

I've an app i use, tuns on at humidity level and off at a lower level, override and time out option

Edit
I see your looking at a humidity offset, maybe another humidity device?
You might want to look at hubigraphs

1 Like

I have a humidity sensor for controlling bathroom fan during/after shower. At this point I'm just doing some diagnostics to evaluate the effectiveness of what I eventually want to write to do the control. ... What I'd like to do at this point is determine how long it would stay on, if it triggers at that humidity (A), and stays on until the humidity drops to a lesser humidity (B) that is still above the typical room humidity

I wasted many evenings trying to do something similar, and then found this app on the Hubitat community pages that triggers based on humidity changes: SmartThingsStuff/smartapps/craig-romei/smart-humidity-fan.src at master · napalmcsr/SmartThingsStuff · GitHub. Works well and we have not needed to tweak any settings since commissioning it.

2 Likes

Was going to suggest the same thing.

@es_ferret, this app above does a percentage of humidity change, and not actual humidity numbers, so you have very few false triggers, and it accounts for low vs high relative humidity.

It can run the fan for a predetermined amount of time after a humidity percentage drop too.

3 Likes

Smart humidity fan is also found on Hubitat package manager

4 Likes

Wow! Thank you all. There's definitely a lot of options. I'm going to need to play around with a few to see what I like best (I figure that is part of the fun of this).

Two follow ups - many of the answers are centered on how to actually control the fan, and that is ultimately what I want to do once I get the smart switch that I've been looking at purchasing, but...

  1. how could I also measure the amount of time that the fan stays on and...
  2. how do I keep that rule from repeatedly retriggering every time it receives a humidity value, and sees that it's greater than the start limit (while in the shower - if I use the example above let's say 70°)?

Easiest would be use the Smart Humidity Fan app that they linked.

3 Likes

The rule Hasty1 gave will let you set a variance for both sides of the test mine looks like this now:

It's pretty short and sweet I just added the test for the light being on as I only want it happening if someone is really in the bathroom.

Note that the Master_Bath_Humidity is a variable that I am setting in another rule if the fan is not already on and the light is turned on.

Yup could use time variables to hold the on and off time or you could use the logs to determine run time.

Additionally the rule will process continually but the “wait for conditions” are reset every time the rule runs. This would prevent the switch from short cycling.

I imagine the report time is about once every couple of min or once every few % of change

1 Like

You can use the Private Boolean of the rule. Set it once the rule first triggers. Check for it at the top of the rule with a conditional to exit the rule if it's not yet "reset" . Once the rule completes, reset it once again.

PBs can be confusing and not easy to manually reset. So you could also use a local variable to the rule to achieve the same thing with a little more transparency.

1 Like

Ok. I tried something like this in Rule Machine

then after getting what I wanted (adding number variables to calculate time elapsed), I went to change the wait condition, which broke the rule.

I keep getting this error if I go into actions. I have a hunch the humidity option in wait for condition is setup for a string and not a decimal, and that now that I used a decimal (when I changed the value) it's locked up and I have to start over?

That is out of my area of knowledge. @bravenel might be of some help.

Oops. I meant to quote your message, but not direct the reply to just you.

No humidity is a number. But that error sounds like you used the back arrow in your browser somewhere along the way. Delete the rule and start fresh.