🚿 Bathroom Humidity Exhaust Fan

np, i’m just starting to understand blueprint’s so I can do some of my own in time.


Well, this is different. For the last 3 years, I have been controlling the bathroom humidity in a crude way, through node-red. I just now happened on this post and will have to read through it. I thought I was the only one interested in this. I am very happy someone else is talking about this subject. Below are my iterations in node-red (the uneducated way, lol).

Yeah, this is one blueprint I realy love and it works well. Since using it all the mould issues in the bathroom are gone. In the past, someone in family would forget to turn the fan ON including me, now it never forgets and we use to turn the fan OFF when we would leave the bathroom, now it runs for the correct amount of time before turning OFF.

Blacky :smiley:

1 Like

Bathroom Dimmer turned off triggered by automation Bathroom Humidity Exhaust Fan triggered by numeric state of Bathroom De-Humifier

Not sure why the light was turned off. I don’t see where I set it to do that? Is this not configurable? Thanks.


Hi Richard

Could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on “</>” and paste code in there.

Then I will be able to see what is happening with your automation.

Blacky :smiley:

New update 1.7

Bugs Fixes :bug:

  • Fixed an error in light transition as shown below. This was probably when you are using zigbee2mqtt.
Transition value 0 is not valid.

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:


Blacky :grinning:

Hi @Blacky,

First of all what a good Blueprint just what I was looking for. Until yesterday my extractor fan was controlled by my plc, because a remote IO station has broken (which has a long delivery time), I came across this Blueprint which does almost exactly the same as what I programmed in the plc. Only when I took a shower this morning did I notice that the fan wouldn’t come on and I turned it on manually to check the logs later. Now I suspect I did something wrong somewhere because I get the following error every time the automation is triggered.

Error log:

Logger: homeassistant.components.automation.hvac_bathroom_humidity_exhaust_fan
Source: components/automation/__init__.py:608
Integration: Automation (documentation, issues)
First occurred: 11:06:59 (6 occurrences)
Last logged: 12:20:26
Error rendering variables: UndefinedError: 'dict object' has no attribute 'entity_id'

Config in :point_right: /config/automations.yaml:

- id: '1692464664570'
  alias: 'HVAC: Bathroom Humidity Exhaust Fan'
  description: ''
    path: Blackshome/bathroom-humidity-exhaust-fan.yaml
      trigger: sensor.bathroom_humidity_derivative
        - fan.fan_bathroom_on_off
      bathroom_humidity_sensor: sensor.temperature_and_humidity_sensor_bathroom_humidity
      time_delay: 15
      include_max_humidity: maximum_humidity_disabled
      time_out: 45
      falling_humidity: -1

I must have done something stupid but I can’t see it at the moment :sweat_smile:

@Hert [quote=“Hert, post:184, topic:509992”]
First of all what a good Blueprint just what I was looking for

No problem, your welcome.

Thanks for letting me know and providing all the information I needed :+1:. Not your fault, I did something stupid :sweat_smile:

Fixed it please update to Version 1.8

It had to do with not entering a light entity. Sorry for the brain fart.

Blacky :smiley:

New update 1.8

Bugs Fixes :bug:

  • Fixed an error in light if nothing was selected. It would prevent the automation from running and throw the below error.
Error rendering variables: UndefinedError: 'dict object' has no attribute 'entity_id'

If you like this blueprint? Consider hitting the :heart: button in the top post :+1:

If you like my blueprints, and would like to show your support or just say thank you? Click Here :smiling_face_with_three_hearts:


Blacky :grinning:


Yes this has solved the problem and I have tested it a few times and everything works properly. This is great now I don’t have to make anything myself to control my fan and you have thought of a lot of things I saw when I was browsing your code. Good job.

But I have one question:
While browsing through your code I saw some nice places here and there to add a function to adjust the fan speed. My fan can run at 2 speeds (high and low). What I would like to see is if the function “Turn on the fan” is called and before “Check if the lights are enabled” there is an option to set the low/high bit high, and then after “Wait until Humidity Derivative Sensor drops or it times out” to set the bit low again. So basically when the timer runs “Wait the number of minutes that has been set for the time delay” the fan then runs at low speed, and then of course after this time the fan simply turns off.

I actually programmed almost exactly the same in my PLC as you did here in this blueprint, only this is the difference with what I made.

Also, the humidity had to be close again before I started showering (I took a snapshot of the value 10 min before I started showering and it also had to have dropped within a certain window, I don’t know the percentage value now) otherwise the timer restarted and repeated a maximum of 3x. I do not attach much value to the latter because you have the option to set a maximum humidity and a time out value can be entered.

But don’t get me wrong this is not an accusation or that I see it as a shortcoming. The blueprint is awesome in itself, just thought before I start experimenting with your blueprint I’ll drop the idea here :sweat_smile:


Thanks for the update, nice to know it working again :+1:

I am working on this blueprint so I will consider your suggestion but it will be some weeks before I release the next new features. I to have a 2 speed fan but only use one speed. Maybe check in again next month.

Blacky :smiley:


Oh see that’s good news. I don’t really care that it will take a while, I’m going to test the values of the humidity (decreasing and rising value) first, then I will be a week further haha. I’ve already changed your blueprint to what I said in my previous post.

What did I do:
I actually copied your include_fan_speed_off and fan_speed literally and called it “speed_switch”

After this I put a choose for the “fan_on” function if an entity is selected for speed switch then it will execute otherwise not

And for switching to the Timer I did the same, only of course with homeassistant.turn_off

I didn’t make this neatly, I looked that I can get it made in the easiest possible way in my situation. Your other flow “For winter mode when enabled and within the set winter months” I have not changed. For now I have more than enough with this and I am still experimenting with the settings. I’ll keep an eye out for your updates, I’m curious about your upcoming implementations


1 Like

I have a request about time delay, ATM TimeDelay starts when the -level is reached ie -1, but if the level drops again after say 5 mins the timer is not reset, so, once the timer end the fan turns off, so it can cause the room humidity to start going up as it has not really had time to level out.

So could you code it so it resets the timer or add an option to reset it if falls below the point where the Delay Timer started.

see attached.

The delay Time started at Orange arrow, but the derivative was still dropping (Pink and Blue), the Delay Time out ended and fan turn off at Green Arrow, which cause the the room humidity to raise again and eventually start the fan again once it reached the derivative high point (Yellow arrow). Restarting the timer each time the derivative goes lower than the set point would help stop this.


Hi Andy,

At what point did you stop having a shower?

I know you would of read the settings guide Click Here.

If the humidity rises again it is a balancing act to get all your settings correct. I have mine so when the fan goes OFF the humidity will rise but not enough for the fan to come back ON. Then the humidity fall again. Good to also add your humidity sensor in your chart as it can help to understand what is happening and if you should run the fan longer. Here are my settings if your interested.



Blacky :smiley:


I saw this happening to me today too and I think it’s kind of the same problem. Only I think jumping back is not that simple, maybe a timer for the trigger would help a lot and in my opinion it is not that difficult to implement.

Could you please take a look (this is the place in my case) on line 1708 here you call the function “Wait until Humidity Derivative Sensor drops or it times out”. If you add a “for x time condition” to this with a variable input, don’t you think we can dampen this out.

Here’s my graph:

On the red line is where he passed over to the timer

Got out of show about 19:37, here the graph with humidity sensor.


Looks like your sensor location is ok. Try lowering your “Falling Humidity”. Then you may be able to adjust your “Time Delay”. It is a bit of a “Love Affair” and it could take 20 showers to get it right, but once you do it works well. I have tried this but found getting the setting right stops the automation always going to the “Safe Guard - Maximum Run Time”.



Hi Andy :smiley:

Now we can see what is happening, … having your settings would be nice but no stress, let’s have a look at it. Below I have added a few things in the hope it will be more clear.

At point “A”. The red arrow (1.7 - 1.9) looks to be your “Rising Humidity”. Consider raising it to the yellow arrow (3.0). Because it is now 3.0 the point “B” (fan ON again) may not accrue (try it, see, adjust, try it see, adjust, etc). The red line is where you finished your shower. Point “1” (green arrow) should be your “Falling Humidity” around -2.0. Looks like your “Time Delay” is around 15 min so if we take orange line to the green line it is around 20 min but we have a stop / start of the fan so 15 min may be ok. First try and set your “Time Delay” to 25 min then look at the graph again to fine tune your run time as 25 min is way to long but we will be able to see what is happening. Then it is fine tuning, again, again and again of all your settings.

Sensor, sensor set up and sensor location is the main critical factor because that is the information we need to make it work perfectly. Having it inline with your fan inlet will stop all your problems (air flowing over it when the fan is ON). I also have my humidity sensor report every 60 seconds regardless. The data is not a problem it is the key and all this data gets purged in 10 days. In the past I had other sensors but once I set it up like this “BOOM” perfect.

As I said in the above post, It is a bit of a “Love Affair” and it could take 20 showers to get it right, but once you do, it works well. This is why winter and summers is realy nice feature as you can see by my settings it is so different and even 0.1 makes a difference.

Blacky :smiley:

thanks for taking the time, i’ll try to tweak i did have 25mins for delay, now reduce this to 10 mins, and raised the detect point to 3 (was 1) hopefully this will stop the re-actioning. thanks let thw fun begin tweaking.

Thanks Andy, thanks for persisting at it, this is one blueprint I realy love (Game Changer to home automation) and my family love it to. If you have any question I here to help.

1 Like