Optimal Winter Humidity with Home Assistant
Winter is coming. In Chicago, that means dry air, itchy skin, and chapped lips. Most people use humidifiers to combat this. If you’ve tried to do this with small plug-in humidifiers, you know it works well enough for bedrooms. For an entire house of sufficiently large size, the endless trips to fill the container are futile.
Enter: whole house humidifiers
I don’t advertise on this website, so I’ll let you search for whole house humidifiers. For people with forced air systems, you likely have an in-line system. I have radiant floor heat and mini-splits, so an in-line humidifier wasn’t an option for me. I ended up going with the self-contained Aprilaire 350. (Note: I don’t advertise or get referral money or whatever, this is just what I use; YMMV)
It looks like this:
It connects directly to your hot water plumbing line, drips hot water over a grate, and blows a fan past it. When the humidity gets below your prescribed humidity setting the unit powers on, the water starts flowing, and the fan starts blowing. It’s kind of loud, so I only run it during the night. Regardless, it does the job.
What is the optimal humidity setting in winter? Aprilaire says it depends on the outside temperature.
Instead of fiddling with the dial as the weather changes, I crank up the dial to the max setting and programmed Home Assistant to turn it on and off automatically. Because it uses a simple 120v wall plug to power itself on, it only requires is a smart WiFi-enabled plug for Home Assistant to switch it on and off. I use Kasa, but there are a bunch supported by Home Assistant.
Code
Maybe I’m bad at RTFM-ing, but it took way too long for me to find the right syntax for variables in the action
section of Home Assistant automations, so I thought I’d share my few lines of code.
First, I create a generic hygrostat. I put this in my config.yaml
:
humidifier: !include humidifier.yaml
Then this in humidifier.yaml
:
- platform: generic_hygrostat
name: Main Humidifier
humidifier: switch.plug01
target_sensor: sensor.1st_floor_humidity
min_humidity: 15
max_humidity: 60
target_humidity: 55
device_class: "humidifier"
dry_tolerance: 1
wet_tolerance: 1
Use your WiFi-enabled plug for switch.plug01
. You’ll also need an indoor humidity sensor defined here as sensor.1st_floor_humidity
.
Next, I define a target_humidity
sensor. Using a little math with the above chart tells us that:
Relative_Humidity = (Outside_Temperature / 2) + 25
I put this directly into my config.yaml
(but should probably move all my self-defined sensors to their own file):
sensor:
- platform: template
sensors:
target_humidity:
device_class: humidity
unit_of_measurement: '%'
value_template: >-
{% set t = states('sensor.outside_temperature') | float %}
{{ ((t / 2) + 25) | round|int }}
Protip: Notice the parentheses in the last line. In Home Assistant, filters (aka pipes, aka |
) go second in the order of operations. So instead of PEMDAS, it’s P-FEMDAS.
Note: I have an outdoor thermometer (sensor.outside_temperature
), but you can use the integrated weather app instead; i.e. states("weather.home.temperature")
.
Finally, I create the automation. Apparently, you can create automations in the UI now, but I’m used to writing them directly to yaml.
I include automation.yaml
in config.yaml
:
automation: !include automations.yaml
and include the following in automations.yaml
:
- alias: Target Humidity
variables:
target_humidity: sensor.target_humidity
trigger:
- platform: state
entity_id: sensor.target_humidity
action:
- service: humidifier.set_humidity
entity_id: humidifier.main_humidifier
data:
humidity: "{{ states(target_humidity) }}"
The hardest part for me was finding and understanding variables
(the second and third lines) in the docs and figuring out how that’s called in the last line. You find it in the scripts section and not in the automation section. There are a few rabbit holes I fell into. I hope this helps you avoid those!
Cross-posted on reddit here.
#################################################################
Some additional notes if you are considering a whole house humidifier:
- You need a drain nearby for the excess water that doesn’t evaporate.
- I have a tankless hot water heater. The humidifier doesn’t generate enough
Bonus Automation
As stated above, my whole house humidifier is loud, so I only run it at night. This is also in the automations.yaml
:
- alias: Turn on humidifier
trigger:
- platform: time
at: '23:59:00'
- platform: homeassistant
event: start
condition:
condition: time
after: '23:59:00'
before: '07:30:00'
action:
- service: humidifier.turn_on
target:
entity_id: humidifier.main_humidifier
- alias: Turn off humidifier
trigger:
- platform: time
at: '7:30:00'
- platform: homeassistant
event: start
condition:
condition: time
after: '07:30:00'
before: '23:59:00'
action:
- service: humidifier.turn_off
data:
entity_id:
- humidifier.main_humidifier