Bathroom Humidity

Ok... some pseudo code to think about...

Input baseline humidity sensor
Input bathroom sensor.
Input high threshold. (e.g 25%)
Input low threshold (e.g 5%)

If bathroom sensor > (Baseline sensor + high threshold)
Then turn on fan

If bathroom sensor < (baseline sensor + low threshold)
Turn off fan

The fan would turn on once the % above baseline was reached
then turn off again once it went down to baseline or just above (low threshold)




I you want a really solid baseline you could use a number of sensors and average them out to use as the baseline sensor
(My ‘Average All’ app & driver)

I might think about building this into the app so a number of sensors could be used for the baseline

It’s 01:40 am here so time for bed :slight_smile:


1 Like

Sounds good, probably wouldn't hurt to have a better picture of the whole house.

It's 18:40 here and I am off to work... Have a good night!

1 Like

Please also include a way to have the fan on regardless of humidity for the case of someone using the toilet and just want the vent or sometime you just want air circulation.
In ST, I do this by sensing if the fan switch is turned on manually. Run fan and turn off aft x minutes with no motion. Haven't done anything with HE yet. I have the Aeon sensor and Xiaomi both in the washroom and find the Xiaomi is very slow on updating humidity.

1 Like

Its about 6 feet from the bathroom door so while it probably does it's not by much.

Of course, I was trying to give an estimate of how long it takes typically. I have a 110CFM bathroom fan so it clears it pretty quick, just faster with the door open as it doesn't have to pull the dry air from under the doorway if it's open.

I'd say if it's more than 5% over base line it should be on. But that's just my preference. And your right how long it takes to get there isn't relavent. My aeotec multi sensor (USB powered) is set to report every 5 minutes or if humidity increase by 5%. It can be set much more sensitive, but I don't like to make it too chatty and potentially cause issues with the z-wave mesh performance.

Sounds good. @napalmcsr port of smart humidity sensor was my first attempt at automation of this, but I find that using the average readings over 20 minutes and not a baseline from an adjacent room causes the fan to shut off too soon after humidity starts to drop, and stay on longer than necessary if I just try to use time to clear as a reference depending on the situation.

Sure, It would work. Mark's idea is pretty close to what I do, except I just look for it to start dropping and then turn it off after X minutes. The compare to another sensor would scare me due to calibration, needing to guard band, other sensor differences, but they can be overcome.

What might work better is to record the starting humidity and wait to turn off until you get back to say X% of the total change. You'd have to record the highest humidity, etc... Something to ponder...

1 Like

Yes, in my RM rules I have one that works like this. I will post my RM rules shortly for inspiration.

1 Like

You also need a mode for clearing out the other reason for using a bathroom fan...

Rules I have for bath fan.

Timeout after manual start (smell control)

Rule that actually turns fan on/off based on humidity.

Rule to restart fan if shut off manually while still to humid.

Rule to turn off fan after humidity has returned to baseline.

Rule to turn on fan when humidity is above baseline.

Screenshots are limiting my ability to show the restrictions I have in place so the the humidity present only runs if humidity isn't present and humidity off only runs when humidity is present.


Recording physical device events is very hit and miss - not many switches report this correctly.

We could probably look at the humidity again as a baseline and say something like;
If the humidity is the same as baseline but the switch is on then turn off after x mins.
Perhaps also with a motion sensor... off after x mins once motion stops (if humidity is the same as baseline again)

So... pseudo code again..
Apart from the humidity already defined...

  1. If fan switch is turned on... wait configurable mins before off UNLESS...
  2. optional Motion sensor is active... configurable delay for off once motion is inactive.

How close are we now to the desired result?


I think the baseline sensor is, in effect, the starting figure for humidity

Because of the ge jasco physical turn on issue, I have a Boolean in my code track if the switch was turned on by the app, or magically shows on due to polling.

OK guys..
Here is the first draft of the 'Super Smart Fan' :slight_smile:

If configured correctly it should:

  1. Turn on the fan when it's too humid (turning off when humidity returns to a normal level - based on a baseline sensor)
  2. Turn on with motion. - Turn off automatically after a pre set time period when motion stops (if humidity is normal)
  3. Turn off automatically after a pre set time period when manually switched on (if humidity is normal)

You can find the app here:

Have a thrash about and see if this works ok.

I've tested fairly well but using only virtual devices, as always... bug reports and suggestions always welcome



I think it would be nice to have another option to set a RH point where the fan would run for xx minutes even if the measured RH isn't higher than the threshold above baseline. I mention this only because if it's really humid outside the RH could creep up and having the fan run for xx minutes might help with potential mold issues.

Otherwise, I like what I'm seeing so far. I'll test it out and provide feedback soon.

Do you mean if no other trigger, a set point for humidity and a timer?
What happens if the set point is reached at 3am?

Would the fan wake you up?


In my case, the fan is rated at 1.5 Sone so waking me up isn't really an issue. However, I can see where that wouldn't be a desired feature for someone with a noisy fan.

Yes, in my RM rules (listed a few posts up) I was triggering "humidity high" at 62% RH regardless of baseline. Then my fan rule would shut it off after 10 mins since it was below baseline RH. I suppose this is probably unnecessary, but I've been known to have a touch of OCD at times.

Download the Hubitat app