🚿 Bathroom Humidity Exhaust Fan

@BeeGee

Nice work!! Glad it is all working for you… thanks for sharing your set up :+1: :wink:

1 Like

@R0yk3

Just posting my set up now as promised. I will update this in the next few weeks as I am waiting for some items so I only need to use one ESP32.

thank you for the script. I’m trying the 2.2 version. if this does not work, I’ll try the script.

thanks, I’ll let you know

@Blacky hey. I have updated to 2.2 and am just going through testing/configuring. I dont know if I am an edge case, if so please feel free to ignore me, however, regarding the ‘Manual Fan Switch’ section, for me this is turning on the fan speed high (I have a Shelly 2.5 to control high speed and low speed of the bathroom fan (one device but stepped speeds), the Shelly also therefore shows me when the light switch is turned on). I have configured ‘Fan Switch’ to be the high speed fan and ‘Input - Fan Speed - Low Speed Switch (Optional)’ to be the low speed fan HA entities. The problem is, with having ‘Manual Fan Switch’ enabled, when I turn on the bathroom light switch the high speed fan is being turned on but because the low speed fan is not also turned on the fan doesnt come on at all. For full clarity, I did also enable the ‘Use The Fan Speed Options (Optional)’ and set that to the first option (‘switch to low speed then turn off’).
I tried reversing the selected entities in the ‘Fan Switch’ and ‘Input - Fan Speed - Low Speed Switch(Optional)’ fields and the low speed fan then came on when enabling ‘Manual Control’. I think maybe the logic needs reversing when a low fan speed option has been selected higher up?

FAQ - Can you show us your full set up?

Below is one of my bathrooms. I will show all my controllers (ESP32), sensors, setting along with the settings for my sensor light as it all works together. I will try an document as much as possible for you. If you need more information just let us know. It is a big read so maybe make yourself a coffee first.

NOTE: I am waiting on some parts as they have just been released and I am updating my systems. When I receive them I will update this post, so if your interested then maybe check back in in a few weeks.

:gear: The Controller And Sensors

All the items are from m5stack. I have spare controllers and sensors if they need to be replaced ASAP.

ATOM Lite ESP32 IoT Development Kit

1

ENV III Unit with Temperature Humidity Air Pressure Sensor

4

Dlight Unit - Ambient Light Sensor

2

PIR Motion Sensor

3

ATOMIC PortABC Extension Base

5

I2C Hub 1 to 6 Expansion Unit

6

:camera: The Bathroom

Below is one of my bathrooms. Note, the linear slot diffuser directly above the shower head, this is critical for the automation to work correctly. It is connected to my exhaust fan and sucks air over the sensor when the fan is ON. Inside this linear slot diffuser is my humidity sensor.

Below shows the LED lighting. They are separated into segments… the mirror, under the vanity and in the niche

Inside the linear slot diffuser the cable passes through into the cushion head. This cable is in the ceiling space where the ESP32 is plugged into mains power.

I have cut out one of the slots so the sensor finishes flush with the face of the linear slot diffuser. I also painted the cover of the sensor black to hide it and drilled some small holes in the other side of the sensor cover to allow for good airflow trough it.

Below is the sensor fitted to the linear slot diffuser.

Under the vanity is my LUX and motion sensor.

:memo: The code used in the ESP32 (atom light) and esphome

This is for the humidity sensor, temp sensor, LUX sensor, motion sensor, door sensor and the “Manual Fan Switch”.

## "#" = Item - "##" = Note - "###" = DEACTIVATED option

esphome:
  name: bed2-ens
  friendly_name: Bed 2 Ensuite

esp32:
  board: m5stack-atom
  framework:
    type: arduino

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: !secret encryption_key

# Over The Air Password (Stops somone on your network accessing files)
ota:
  password: !secret esphome_secret

# Wifi Information
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

## Optional manual - Static IP
###  manual_ip:
###    static_ip: ?.?.?.?
###    gateway: ?.?.?.?
###    subnet: 255.255.255.0

# Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "bed2-ens"
    password: !secret fallback_ap_password

# Captive Portal
## After 1 minute of unsuccessful WiFi connection attempts, 
## the Atom Lite will start a WiFi hotspot (with the credentials from your fallback).
## Use your AP (Access Point WiFi) SSID & Password to connect then go to http://192.168.4.1/ in your browser.
captive_portal:

# This is for sensors plugged into I2C Hub 1 to 6 Expansion Unit - It can be tricky

i2c:
  sda: 25
  scl: 21
  scan: true

sensor:
  - platform: bh1750
    name: "LUX Sensor"
    address: 0x23
    update_interval: 10s

  - platform: sht3xd ## sht3xd is for a ENV III - sht4x is for a ENV IV
    temperature:
      name: "Bathroom Temperature"
      id: bathroom_temperature
    humidity:
      name: "Bathroom Humidity"
      id: bathroom_humidity
    address: 0x44
    update_interval: 60s

  - platform: qmp6988 ## qmp6988 is for a ENV III - bmp280 is for a ENV IV
    pressure:
      name: "Bathroom Pressure"
    address: 0x70 ## 0x70 is for a ENV III - 0x76 is for a ENV IV
    update_interval: 60s
    iir_filter: 2x

# This is for the physical switch on the wall and to allow for control in a HA dashboard
switch:
  - platform: gpio
    pin: GPIO23
    id: bathroom_manual_control 
    name: "Bathroom Fan - Manual Control" # Link to the binary sensor below
    icon: "mdi:fan-clock"

# The physical switch on the wall
binary_sensor:
  - platform: gpio
    pin: 
      number: GPIO33 ## Wire from this pin to the push button on the wall and back to ground on esp32
      inverted: true
      mode:
        input: true
        pullup: true
    name: "Bathroom Fan - Bypass Wall Button"
    icon: "mdi:gesture-tap-button"
    on_press: ## on_press is for a push button switch. on_state is for a toggle switch. Choose on_state or on_press for the type of wall switch you have, you can only use one or the other.
      then:
        - switch.toggle: 
            id: bathroom_manual_control # Link back to the switch above
    filters:
      - delayed_on: 10ms

# For a motion sensor in bathroom
  - platform: gpio
    pin: GPIO19
    name: "Motion Sensor"
    device_class: motion

## You can add another "gpio" on pin 32. This can be used for a door contact sensor. 
## I am not using a door contact sensor it is just there to show you how to use it if you require one. 
## For me I am using this pin for another motion sensor located in the WIR to turn on lights.
  - platform: gpio
    pin: GPIO32
    name: "Bathroom Door"
    device_class: door

:shower: The Bathroom Humidity Exhaust Fan Blueprint Settings

Below are the main sensor settings for the automation. I dont have a fan with different speeds so nothing is entered into the 2 “Input - Fan Speed” selections. If you have a fan with different speeds then you would enter them in here. I do use the “Maximum Humidity” in the settings so I have entered in my humidity sensor into “Input - Bathroom Humidity Sensor”.

Below are the main settings. I refer these setting as “Summer Mode” but the are not labelled like that as it is just easer to read this way.

Below is to enable winter mode. I use it but you don’t have to use it as it is an option.

Below are the winter settings.

Below are the light settings. I dont use them as I use my :bulb: Sensor Light blueprint to control the lights with the “Automation Link Option”.

Below is the manual fan switch settings. This is the switch I created in the ESP32 code and wired to a physical switch on the wall.

Below is the “Automation Link” settings. This will be referred to later when showing my sensor light set up. I have set this to 2 minutes. This allow us to dry ourselves before the motion sensor is able to detect motion again once we move to the other side of the glass shower screen. I have created a toggle helper for this.

I have entered in a by-pass but realy don’t use it now we have developed the manual fan switch.

:bulb: The Sensor Light Blueprint Settings

Click here for my :bulb: Sensor Light blueprint.

Below is the main settings. Trigger is the motion sensor under the vanity and in the ESP32. You can see my 3 LED lights entered in. The main light is controlled manually as we use the LED light most of the time and only turn ON the main lights when needed.

The light settings

The by-pass settings. This is where the automation link in the bathroom humidity exhaust fan blueprint controls and takes over this automation disabling it. I have selected to turn the lights ON as this allows it to work without ever knowing anything is happening. Note the by-pass time delay of 1 minute. This allows for when the by-pass is turned OFF for us to trigger this automation again before turning OFF the lights.

Sun options, don’t use them in this automation.

This is the LUX sensor under the vanity and in the ESP32. Selected “YES” as this sensor is affected by the lights.

Time options, don’t use them in this automation.

Device tracker, don’t use them in this automation.

Night Light main input settings.

Night lights, light settings for lower softer lights at night.

Night light conditions. 2 iPhones used to enable the night lights when they are in do not disturb.

And that is it :partying_face:. If you got this far you have done well :rofl:

Hope this helps you set up your automations

Enjoy

Blacky :smiley:

Back to FAQ: Click Here

3 Likes

@Townsmcp

The manual switch can not control the fan directly. You can’t use the switch connected to the fan. It has to be stand alone and it will only turn the fan ON and OFF. Low speed will not run.

If you would like to test it you can create a toggle helper and use that toggle as your manual switch.

If you are happy with it, you will probably have to add another Shelly in… like a Shelly plus 1 and wire another switch (or connect it to the existng fan switch and disconnect the other Shelly 2.5 to the switch) to it and connect it to nothing. Then use that switch to turn ON manual control.

Hope this helps.

Blacky :smiley:

1 Like

@Blacky thanks for the info.

I love your bathroom! Looks like you live in a hotel!

Question regarding ‘Automation Link - By-pass Control’ - can an automation be used as one of the entities? Automations can be turned on and off like an input_boolean. I use the Toilet Exhaust Fan blueprint and wondered if adding the blueprint automation into this field will simply turn the automation off and on as needed?

@Townsmcp

Yes but you will need to edit the code. The reason I say this is if your using my :toilet: Toilet Exhaust Fan with time delay there is no by-pass yet… yes it is on the road map and I will make it work with this blueprint :infinity:. Rather than edit the code I would suggest you create a template sensor that will do this for you, that way you never have to edit the blueprint code. It make it easer when updating. If you are not sure how to do this just reach out and I will provide the code for you.

FYI: When we enable and disable an automation it preforms not action, so it is basic function and not my recommendation. When we use the by-pass in my blueprints you have options, on what to do when you turn them ON (smart function). When we turn the by-pass OFF the blueprint analyse the automation and all your settings and tries to preform the correct action (smart function). So this is not realy good automation to enable or disable automations, just basic function. So if there is a by-pass I would recommend to use it rather than enabling and disabling an automation.

Blacky :smiley:

1 Like

ended up using the script! this works, thanks

1 Like

@fransiefrans

Thanks for letting us know… glad you are up and running :partying_face:

Enjoy

Blacky

1 Like

@Townsmcp

This :toilet: Toilet Exhaust Fan with time delay blueprint has now been updated so it will work with this blueprint now. Just need to create a toggle helper and enter it into both blueprints. More information can be found in its thread Click Here.

Blacky :smiley:

1 Like

Very interested in trying this, do you think it would work using the Sonoff Humidity sensor instead of the one you listed?

@ice3m

You can use other humidity sensor and you don’t have to use the one I use but it must report at least every 60 seconds or on every state change.

I did a quick google search and still not sure what your sensor does. Your humidity sensor must report a value at least every 60 seconds. Some battery sensors report on every change and I think your one reports on 5% of change even when they say it report every 5 seconds. If it is 5% change then no it will not work. The best way it to see what your sensor reports.

i use the aqara Humidity Sensor works great.

1 Like

I am stumped at selecting the Fan switch

I cannot select it (a Sonoff ZBMINI relay) which works via the Dashboard:

I have scrolled through all the dropdown for device and entity and tried typing Fan, MINI, Bathroom

Screenshot 2023-10-11 115913

Replying to my own question LOL

I went and checked the entity for the switch and then copied and pasted - seemed to accept it

1 Like

@Blacky can I also use the derivative of an absolute humidity sensor? Currently the “rising” and “falling” has the % unit of measurement. If I use absolute humidity, the value will be a change of 200 mg/m3/minute or so, instead of 5%/minute.

Why absolute humidity? Value change is “sharper”; relative humidity value is damp(en)ed due to temperature rise that comes with it when taking a shower. A 5% relative humidity increase combined with a 2 degreeC increase is a 24% increase of absolute humidity (50% to 55%, 20 to 22 degC). See Absolute Humidity Calculator

1 Like

@Blacky I am testing your blueprint out, and I have a manual binary switch setup in ESPhome called “binary_sensor.bath_sense_fan_10” The setup looks like:

binary_sensor:
  - platform: gpio
    pin: D0
    name: ${display_name} Motion
    device_class: motion
  - platform: gpio
    pin:
      number: D3
      inverted: true
      mode:
        input: true
        pullup: true  
    name: ${display_name} "Fan 10"
    filters:
      - delayed_off: 250ms
    on_press:
  # Simple
      - homeassistant.event:
          event: esphome.button_pressed
          data:
            title: Fan button was pressed 

I tried and pressed the temperature-open push button, but the fan did not turn on. Do I need to make the filter delayed_off longer than 250ms?
And do I insert a motion sensor somewhere in the blueprint? I do have a binary sensor in helper to bypass the motion sensor, setup I have is in node-red. In node-red I have disabled my fan on and off nodes.

I think I have to change the ESPhome to toggle switch, and not nomally open. It is a physical nomally open push button.

wonderful blueprint BTW!

@balk77

Give it a try and see what happens. There are many reasons why we use a Derivative Sensor and to date it just works.