🚿 Bathroom Humidity Exhaust Fan


All good, happy to help. You just need a humidity sensor and then you create a Derivative Sensor Helper using the humidity sensor.

Q: How do you set up a Derivative Sensor Helper?

A: Please follow these steps Click Here


Are you asking how to create a ESP32 with a humidity sensor using ESPHome like I did?

Blacky :smiley:

I looked at the exact sensor you employed and it’s priced nicely and if it’s the exact sensor you’re using, I’d like to “copy” your automation as closely as possible since it’s one of my first (and therefore would be fewer variables from what you’ve done).

So I don’t have ESPHome installed nor experience with ESP32 sensors. It sounds like I install an “editor” and connect the sensor physically to my PC (or HA controller) and do some initial programming.

After that, connect the sensor to HA (which I haven’t seen what frequency or protocol that actually uses yet). Then place the sensor and work with your blueprint.

That’s a long way of saying, yes, I want to start from the beginning - assuming I have the same sensor “in hand”, what are the first steps to prep’ing that sensor for use?

If there are some links or other sites you recommend to help me read-up, that’s fine and thanks in advance!

Here is the link to install ESPHome

One you add it to your HA go into it and add new device. Once you device is added you can use the code I have.

Let us know if you are having problems.

Blacky :smiley:

Hi Blacky

Thanks for such a comprehensive Blueprint! :slight_smile: I’m finally able to set this one up after installing a smart switch for my bathroom exhaust fan. I noticed while setting up my automation, that only light entities can be turned on by the trigger sensor. Are there any plans in future to add support for switch devices too? I have a heated LED lit mirror in the bathroom. The LED’s are controlled by one Shelly relay (I’m going to turn these on with the trigger sensor) and the heated pad/demister is controlled by a separate shelly relay. Ideally, I would like the demister to be turned on by this trigger sensor as well as the LED lights, so thought I would check if these are any plans to support non-light devices at all? Thanks!


Hi Scott

Yep, this is on the list to do and will probably be out in the next release.

Blacky :smiley:

1 Like

Hey Blacky! I’ve been using this for a long while now and love it. Your work is phenomenal and your support with people is amazing. You’re doing a ton for the community, so thank you.

I think there’s a simple change to the blueprint that would make it work significantly better. I considered just copying your blueprint and modifying it but I think it would be better for everyone to discuss implementing it into your (very successful) blueprint.

The trigger to turn the fan off is when the derivative falls BELOW the Falling Humidity value and then the fan runs for the clearance time. Unless I’m missing something, I think the automation would be significantly improved over a wide range of conditions if that’s changed to when the derivate rises ABOVE the Falling Humidity value. I’ll show you what I mean.

Here’s a shower from my home. On the way up, everything works great. Let’s say my rising humidity is set to 2.0% and my falling humidity is set to -1.0%. Here’s what happens currently:

  • 8:45:00 Shower starting, humidity at 39.7%
  • 8:45:25: Derivative is 2.1% and fan kicks on
  • 8:55:30: Derivative crosses 0 to -1.6% and 10 minute timer starts
  • 9:05:30: Fan kicks off, humidity at 49% (10% above starting)
  • Humidity actually rises for a bit (no more fan, water evaporating from shower) then slowly falls
  • It takes 3 hours for humidity to reach a normalized level (40%)

Of course I could run the fan longer to clear more of the humidity. The problem is that the clearance time varies drastically based on summer/winter and whether the heat or AC is running. Sometimes it needs less than 10 minutes, sometimes it needs 45.

But instead, if you wait until the Falling Humidity level rises ABOVE the input, you can account for the varying times it takes to clear a room based on other factors. You can also set the value much closer to 0 and it’ll run the fan until it stops lowering the humidity. Here’s what would’ve happened in the above example if we used -1.0% and -0.5% for the Falling Humidity value:

  • 8:55:30: Derivative goes negative, but automation doesn’t respond as it currently would
  • 9:07:04: Derivative rises ABOVE -1.0% for the first time. However, this is after the fan shut off. In all likelihood, the rate would’ve stayed below that for additional time to bring the humidity closer to equilibrium and the original level. At this point it’s 8% above starting humidity, so you know it can’t run more than 8 minutes more without the rate rising above -1.0%. Clearance timer would start here.
  • 9:11:41: Derivative rises above -0.5% for the first time. But again, this would’ve been pushed further out if the fan was still running.
  • In both cases, the fan would’ve run longer, but would’ve stopped much closer to the time humidity was no longer being removed from the room.

Right now, the automation triggers a timer and it varies widely whether it’s the appropriate run time. I’ve seen this in my house over several seasons and have needed to adjust the Time Delay often to keep it working well. Changing the Falling Humidity to trigger when it rises above the value does a few things:

  • It allows setting very short or no Time Delay at all (0-2 minutes instead of 10-20)
  • It allows more reliable clearing of humidity
  • It eliminates the need to change things seasonally
  • It allows more fine tuning of the Falling Humidity variable to individual needs/home characteristics
  • It’s simpler to set, since you’re not trying to find the largest negative number you can reliably use
  • It’s more failsafe, since humidity will always stop falling at some point. It could even be set at zero if you wanted the fan to run until it’s no longer being effective. Although in practice I think a non-zero number closer to zero than currently used would be best.

In some cases (like this one) I think the fan would run a little longer to get a lot closer to equilibrium. In other cases where AC or heat is helping lower the humidity the fan wouldn’t need to run as long and a lot of the Time Delay runtime wouldn’t be unnecessarily wasted.

I’ve been thinking about this for close to a year. Just never got around to putting it all together. Let me know what you think or if you have any feedback on why it wouldn’t work. And thanks again for all your hard work.

Great news! Thanks Blacky :+1:

1 Like


Thanks for your kind words.

Firstly thanks for reaching out, your suggestion, well considered and written… so easy to understand what you are suggesting.

As you would know this blueprint is now well tested and works realy well. Changing the way it fundamentally works without some real benefit is something I take very seriously. I dont want to change it one week to then having to change it back next week.

I do however REALLY like your idea and I do think this could be a better way :+1: I agree in theory on 5 of your 6 points but I think we will still need seasonal (Summer / Winter) as I do have different start triggers but that is neither here or there as it is an option anyway.

So what next?

As I have stated I take it very serious so although the theory all checks out I would like to test it proving it benefit and functionality before I release it to everyone. I will do a beta blueprint were a few can test it before it release. This way we can prove that it works and its reliability. Would you be interested in doing this with me?

Again thanks for reaching out and your suggestion :+1:

Blacky :smiley:

Thanks for the consideration. I’d absolutely be interested in helping you test it. I’m willing to help any way I can.

I agree that a lot of the work you’ve done on summer/winter etc would still have value. But I think this pretty simple change would make it easier to dial that stuff in across the board.

How can I help? Would you prefer to take it offline to Discord or something?


I will PM you.

Blacky :smiley:

Hi @Blacky , if you do not mind, I would like to test this new blueprint with you as well. I guess I in my situation the suggestions made by @bradarussell would also be benefitial as the humidity is not going down soon enough. I do not have a fan but only use lights to turn on but nevertheless, the same is true for my case. In case you need help, I am willing to try :slight_smile: thanks!

Hi, great work!
the derivative sensor works well to turn on the fan as I’m using a sensor directly in the shower; however my falling humidity rate is slow and steady so I don’t get that clear falling “valley” to manage the “off” portion of the automation. My wife also tends to open the door while showering making things even worse (9:01 below). Any way to add an option to turn off the fan based on the actual humidity sensor value instead of the derivative sensor? just an open template condition field would do it and allow me to set the target value based on the difference between the shower humidity and another sensor elsewhere in the house to account for seasonal changes.

Let me know what you think.


Thanks for your offer at this stage we are just going through it.

Blacky :smiley:

Maybe try a different location of the humidity sensor. High in the room and close or directly on the fan inlet.

Blacky :smiley:

After using this automation for around a week, I’ve had my first ‘blip’ where it failed to work. From reviewing the history of the sensors involved, im not sure why, but when the smart switch that powers the fan was triggered after the derivate sensor rose, it immediately turned off. I had to manually turn the switch on to deal with the humidity.
Based on the history, does this look more like a hardware blip with the smart switch (Sonoff ZBMINI) than the automation itself?

Just for your reference… I don’t get any faults here. Keep an eye on it and check your logbook as that can help you find it. There is no reason for it to turn OFF instantly once ON as you have a 12 min delay.

Blacky :smiley:

Hi Blacky, than you so much for this blueprint, love it.

It work perfectly for the humidity, but has other i would like to use the same fan for the toilet use.

Here’s my settup, the fan is controlled with a wall siwtch (Kuled branded on tasmota), wich is set in Home Assitant has a fan (fan.shower).

I’m using a bidet wich is connected to a smart plug with energy monitoring. It’s easy for me to know when somebody is on the bidet since the seat is heated and the power consumption get high very fast (150w) and when not used the power lower to almost zero.

My goal is to Automate the fan based on humidity (it work), Then if someone use the bidet, and of course since the switch is very accessible and someone can use it, a timer.


Have a look at my :toilet: Toilet Exhaust Fan with time delay blueprint. It works together. You will have to create a template sensor (See REF - TS-3) so when your toilet power is above x then = ON. It even has a wait time for the times the fan is needed. Then have a look at this FAQ on how to set it up.

Q: Can we link the Toilet Exhaust Fan blueprint with the Bathroom Humidity Exhaust Fan blueprint as my bathroom has a toilet and a shower?

Hope this helps you.

Blacky :smiley:

A Yes, please follow these steps Click Here.

Hi Blacky for this fast answer.

I managed to make the two automations work together with you’re very c’est instructions.
For the power consumption i used the Threshold helper entities, worked for me like a charm instead of a template.

The only question that i have is the manual switch. In the documentation for both automation it says that the i quote :

" Use The Manual Fan Switch Option (Optional)

This allows you to add a switch to turn the fan ON and OFF manually and still allows the automation to be triggered, taking control of your fan. This is useful in removing any unwanted fumes from deodorant, hairspray, toilet etc. The auto off time delay in option 2 makes sure you never forget to turn the fan OFF.

NOTE - The switch can not be connected to your fan (Actual fan switch). It must be a totally independent switch or the automation will not work."

I don’t want to install another switch, and the wall switch is very accessible and for sure will be used. how can i still keep it function but with a timer (15 minutes or so)?

The problem is, if you have a automation turn the fan ON to then run a set of actions that works. Now if you have a automation that when the fan turns ON as the trigger it then runs a different set of actions. Can you see the conflict?

I do have an idea that I will explore and see if it works.

Blacky :smiley: