When should I open the basement windows? A dew point automation with Home Assistant

Hi everyone,

every autumn I have the same question about our basement: does opening the windows actually help, or does it make things worse? Many people simply air out when it’s sunny outside. In a basement, that can backfire. Warm outside air carries a lot of moisture, cools down on the cold walls and leaves even more humidity behind.

So I built a small automation in Home Assistant that tells me when ventilating really makes sense.

The idea

Relative humidity alone is misleading because it depends on temperature. The better value is the dew point, because it reflects the actual amount of water in the air. If the dew point inside is clearly higher than the dew point outside, opening the windows removes moisture. If it’s the other way round, keep them closed.

What I use

In each basement room (party room and laundry room) I have an Aqara Temperature and Humidity Sensor. You can use either the original model or the newer T1. Both measure temperature, humidity and air pressure, and both work fine for this. A third Aqara sensor sits outside on the terrace. Home Assistant calculates the dew point for each of them.

Here’s how the dew points looked over the last few days:

The logic

Ventilation is recommended once the indoor dew point is at least 3.0 °C higher than outside. The recommendation only ends when the difference drops below 1.5 °C. This gap stops it from switching back and forth when the values are close. On top of that, the difference has to hold for 10 minutes before the recommendation turns on, and 5 minutes before it turns off.

yaml

template:
  - sensor:
      - name: "Dew point basement"
        unique_id: dew_point_basement
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"
        availability: >
          {{ has_value('sensor.basement_temperature')
             and has_value('sensor.basement_humidity') }}
        state: >
          {% set t = states('sensor.basement_temperature') | float %}
          {% set rh = states('sensor.basement_humidity') | float %}
          {% set a = log(rh / 100) + (17.62 * t) / (243.12 + t) %}
          {{ (243.12 * a / (17.62 - a)) | round(1) }}

      - name: "Dew point outside"
        unique_id: dew_point_outside
        device_class: temperature
        state_class: measurement
        unit_of_measurement: "°C"
        availability: >
          {{ has_value('sensor.outside_temperature')
             and has_value('sensor.outside_humidity') }}
        state: >
          {% set t = states('sensor.outside_temperature') | float %}
          {% set rh = states('sensor.outside_humidity') | float %}
          {% set a = log(rh / 100) + (17.62 * t) / (243.12 + t) %}
          {{ (243.12 * a / (17.62 - a)) | round(1) }}

  - binary_sensor:
      - name: "Ventilation useful basement"
        unique_id: ventilation_useful_basement
        icon: mdi:window-open-variant
        delay_on: "00:10:00"
        delay_off: "00:05:00"
        availability: >
          {{ has_value('sensor.dew_point_basement')
             and has_value('sensor.dew_point_outside') }}
        state: >
          {% set diff = states('sensor.dew_point_basement') | float
                      - states('sensor.dew_point_outside') | float %}
          {% if diff >= 3.0 %}
            true
          {% elif diff < 1.5 %}
            false
          {% else %}
            {{ is_state('binary_sensor.ventilation_useful_basement', 'on') }}
          {% endif %}

Just replace the entity IDs with the ones from your own sensors.

Notifications

When the binary sensor turns on, I get a push notification on my phone. Alexa also announces it on our Echos, but only between 8 am and 9 pm, so nobody gets woken up by a basement announcement.

First impressions

It’s interesting how often my gut feeling was wrong. On some warm, sunny days ventilating would have done more harm than good, while on cool, dry evenings it’s ideal.

How do you deal with humidity in your basement? Does anyone already use a window sensor to check whether the window was actually opened after the recommendation? That’s my next step.

Frank

9 Likes

Basements can be tricky, there are lots of factors like age, wall material, region, finished vs unfinished and window placement etc.

I have those sensors you mentioned in each room and look for consistency in each room. Home Assistant is very good at keeping track of temperature in each room and making it easy to see.

This year I decided to rely on air conditioning to see how well I can control humidity and dew point. The basement tends to be cooler than normal but I’ve been able to control the dew point more consistently than opening or closing windows.

Heading into Winter will be a different animal. I’m not sure how I’m going to tackle the cool-dry environment.

An added bonus has been the basement has been much cleaner as a result.

4 Likes

One failure case in the YAML is a missing reading: float(0) for temperature or float(50) for humidity gives a plausible dew point, so the recommendation could change when a sensor becomes unavailable. I’d guard both inputs with an availability check and mark the recommendation unavailable until fresh readings return. Have you tried disconnecting either sensor to see what the alert does?

4 Likes

Good catch, and you’re right about the example in my post. To keep it short I stripped the availability templates, which wasn’t a good idea, because a sensor dropping out would give a plausible but wrong dew point.

My actual config already guards against that. Every dew point sensor has an availability template that checks temperature and humidity, and the ventilation sensor only reports a state when both dew points are available. If one sensor goes offline, the recommendation becomes unavailable and no notification is sent.

I haven’t tested it by actually taking a sensor offline yet. I’ll pull the battery from the outdoor sensor and report back.

I’ve updated the YAML in the first post so nobody copies the unsafe version.

2 Likes

Thanks for sharing your experience, and sorry for the late reply!

Using the air conditioning is an interesting approach. Since you can actively control it, it makes sense that you get more consistent results than with windows. The cleaner basement is a nice bonus I wouldn’t have expected.

About winter: that’s actually the season where the dew point approach should work best. Cold outside air holds very little moisture, so the outdoor dew point is usually much lower than the one in the basement. In theory, the recommendation should turn on far more often than now.

The one thing I’ll have to watch is not cooling the basement too much. My plan is short bursts of ventilation with the windows fully open rather than leaving them tilted for hours. That way the air gets exchanged without the walls cooling down too much.

I’ll report back once I have some real winter data. Curious to see how your AC approach works out over the colder months as well!

Frank