Smart Ventilation based on Absolute Humidity

I have tried the blueprint from: 🪟 Open Window Recommendation | Absolute Humidity Based Blueprint
but it was not working for me. So I have decided to extend the functionality and build something by myself.

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

This blueprint helps you maintain optimal indoor humidity by notifying you when to open or close windows based on Absolute Humidity (AH) differences between indoor and outdoor air. Unlike relative humidity, absolute humidity accounts for temperature, making it a more accurate indicator for effective ventilation.

Key Features

  • :thermometer: Temperature-aware ventilation - Uses Absolute Humidity (AH) calculations
  • :bell: Smart notifications - Only notifies when conditions are optimal
  • :crescent_moon: Quiet hours support - No notifications during sleep time
  • :house: Multi-room support - Shared settings across all rooms
  • :gear: Customizable messages - Personalize notification text
  • :window: Window state detection - Clears notifications when windows open
  • :stopwatch: Cooldown period - Prevents notification spam

How It Works

The Science Behind It

Absolute Humidity (AH) measures the actual amount of water vapor in the air (g/m³), regardless of temperature. When indoor AH is higher than outdoor AH by a significant amount, opening windows will help dry out the indoor air.

Formula used:

AH = (6.112 × e^((17.67 × T)/(T + 243.5)) × RH × 2.1674) / (273.15 + T)

Where:

  • T = Temperature in °C
  • RH = Relative Humidity (as decimal, e.g., 0.60 for 60%)
  • e = 2.71828 (Euler’s number)

Notification Logic

“Open Window” notification triggers when:

  1. :white_check_mark: AH difference (indoor - outdoor) > threshold (default: 3 g/m³)
  2. :white_check_mark: Indoor relative humidity > minimum threshold (default: 50%)
  3. :white_check_mark: Current time is NOT in quiet hours
  4. :white_check_mark: Windows are closed
  5. :white_check_mark: Cooldown period has passed (default: 4 hours)

“Close Window” notification triggers when:

  1. :white_check_mark: AH difference drops to ≤ (threshold / 2) (default: 1.5 g/m³)
  2. :white_check_mark: Windows are open

Notification clears when:

  • You open a window (no need to manually dismiss)

Prerequisites

Required Sensors

For each room, you need:

  • Temperature sensor (e.g., sensor.bedroom_temperature)
  • Humidity sensor (e.g., sensor.bedroom_humidity)
  • Window/door sensor (e.g., binary_sensor.bedroom_window)

For outdoor conditions:

  • Outdoor temperature sensor
  • Outdoor humidity sensor

Installation Guide

Step 1: Install the Blueprint

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

Step 2: Create Template Sensors for AH Calculation

Add this to your configuration.yaml or create a separate templates.yaml:

template:
  - sensor:
      # Outside AH
      - name: "AH Outside"
        unique_id: ah_outside
        unit_of_measurement: "g/m³"
        device_class: humidity
        state_class: measurement
        icon: mdi:water
        state: >
          {% set t = states('sensor.outdoor_temperature') | float(0) %}
          {% set rh = states('sensor.outdoor_humidity') | float(0) %}
          {% set e = 2.71828 %}
          {{ ((6.112 * (e ** ((17.67 * t)/(t + 243.5))) * rh * 2.1674) / (273.15 + t)) | round(2) }}
      
      # Bedroom AH
      - name: "AH Bedroom"
        unique_id: ah_bedroom
        unit_of_measurement: "g/m³"
        device_class: humidity
        state_class: measurement
        icon: mdi:water
        state: >
          {% set t = states('sensor.bedroom_temperature') | float(0) %}
          {% set rh = states('sensor.bedroom_humidity') | float(0) %}
          {% set e = 2.71828 %}
          {{ ((6.112 * (e ** ((17.67 * t)/(t + 243.5))) * rh * 2.1674) / (273.15 + t)) | round(2) }}
      
      # Bedroom AH Difference
      - name: "AH Bedroom Difference"
        unique_id: ah_bedroom_difference
        unit_of_measurement: "g/m³"
        device_class: humidity
        state_class: measurement
        icon: mdi:delta
        state: >
          {{ (states('sensor.ah_bedroom') | float(0) - states('sensor.ah_outside') | float(0)) | round(2) }}

Important:

  • Replace sensor.outdoor_temperature, sensor.outdoor_humidity with your actual outdoor sensor entity IDs
  • Replace sensor.bedroom_temperature, sensor.bedroom_humidity with your actual room sensor entity IDs
  • Create similar sensors for each room you want to monitor

Restart Home Assistant after adding these sensors.

Step 3: Create Shared Helper Entities

Go to Settings → Devices & Services → Helpers and create the following:

3.1 AH Difference Threshold

  • Type: Number (Helper)
  • Name: AH Difference Threshold
  • Icon: mdi:delta
  • Minimum: 0.5
  • Maximum: 10
  • Step: 0.5
  • Unit: g/m³
  • Default value: 3.0

Entity ID: input_number.ah_difference_threshold

3.2 Humidity Threshold

  • Type: Number (Helper)
  • Name: Humidity Threshold
  • Icon: mdi:water-percent
  • Minimum: 30
  • Maximum: 80
  • Step: 1
  • Unit: %
  • Default value: 50

Entity ID: input_number.humidity_threshold

3.3 Quiet Hours Start

  • Type: Date and/or Time → Time only
  • Name: Ventilation Quiet Start
  • Icon: mdi:sleep
  • Initial value: 22:00:00

Entity ID: input_datetime.ventilation_quiet_start

3.4 Quiet Hours End

  • Type: Date and/or Time → Time only
  • Name: Ventilation Quiet End
  • Icon: mdi:weather-sunset-up
  • Initial value: 08:00:00

Entity ID: input_datetime.ventilation_quiet_end

Step 4: Create Per-Room Helper Entities

For each room you want to monitor, create:

Last Notification Time Helper

  • Type: Date and/or Time → Date and Time
  • Name: Ventilation [Room Name] Last Notification (e.g., “Ventilation Bedroom Last Notification”)
  • Icon: mdi:bell

Example Entity IDs:

  • input_datetime.ventilation_bedroom_last_notification
  • input_datetime.ventilation_living_room_last_notification
  • input_datetime.ventilation_kitchen_last_notification
3 Likes

Dashboard Card (Optional but Recommended)

Add this card to your dashboard to monitor all rooms at once:

yaml

type: vertical-stack
cards:
  - type: markdown
    content: |
      ## 🌬️ Ventilation Management
      Central settings for all rooms
  
  - type: entities
    title: Global Settings
    show_header_toggle: false
    entities:
      - entity: input_number.humidity_threshold
        name: Humidity Threshold
        icon: mdi:water-percent
      - entity: input_number.ah_difference_threshold
        name: AH Difference Threshold
        icon: mdi:delta
      - type: section
      - entity: input_datetime.ventilation_quiet_start
        name: Quiet Hours Start
        icon: mdi:sleep
      - entity: input_datetime.ventilation_quiet_end
        name: Quiet Hours End
        icon: mdi:weather-sunset-up
  
  - type: entities
    title: Current Conditions
    show_header_toggle: false
    state_color: true
    entities:
      - type: section
        label: Bedroom
      
      - type: conditional
        conditions:
          - condition: numeric_state
            entity: sensor.ah_bedroom_difference
            above: input_number.ah_difference_threshold
        row:
          entity: sensor.ah_bedroom_difference
          name: "🟢 OPEN WINDOW - Ventilation Status"
          icon: mdi:window-open
      
      - type: conditional
        conditions:
          - condition: numeric_state
            entity: sensor.ah_bedroom_difference
            below: input_number.ah_difference_threshold
        row:
          entity: sensor.ah_bedroom_difference
          name: "🔴 DON'T VENTILATE - Ventilation Status"
          icon: mdi:window-closed
      
      - entity: sensor.bedroom_temperature
        name: Temperature
        icon: mdi:thermometer
      
      - entity: sensor.bedroom_humidity
        name: Humidity
        icon: mdi:water-percent
      
      - entity: sensor.ah_bedroom
        name: Absolute Humidity (AH)
        icon: mdi:water
      
      - entity: sensor.ah_bedroom_difference
        name: AH Difference (indoor - outdoor)
        icon: mdi:delta
      
      - entity: binary_sensor.bedroom_window
        name: Window
        icon: mdi:window-open-variant
      
      - entity: input_datetime.ventilation_bedroom_last_notification
        name: Last Notification
        icon: mdi:bell
      
      - type: section
        label: Outside
      
      - entity: sensor.outdoor_temperature
        name: Temperature
        icon: mdi:thermometer
      
      - entity: sensor.outdoor_humidity
        name: Humidity
        icon: mdi:water-percent
      
      - entity: sensor.ah_outside
        name: Absolute Humidity (AH)
        icon: mdi:water
  
  - type: entities
    title: Automation Control
    show_header_toggle: false
    state_color: true
    entities:
      - entity: automation.ventilation_bedroom
        name: Ventilation - Bedroom
        icon: mdi:bed
  
  - type: markdown
    content: |
      ### 💡 Tips
      
      **Humidity Threshold (%)**: Minimum indoor humidity to start ventilation
      
      **AH Difference (g/m³)**: How much drier outdoor air must be
      
      **Quiet Hours**: When not to send notifications
      
      ---
      
      ℹ️ Notifications come at most once every 4 hours
1 Like

Hey, trying to use this blueprint and always getting:
In ‘condition’: In ‘template’ condition: UndefinedError: ‘input_ah_diff’ is undefined.

Any advice?

Best regards

@InfoFlori in the field AH Difference Sensor you have to select created Absolute Humidity Difference sensor
From the installation guide it will be:

      # Bedroom AH Difference
      - name: "AH Bedroom Difference"
        unique_id: ah_bedroom_difference
        unit_of_measurement: "g/m³"
        device_class: humidity
        state_class: measurement
        icon: mdi:delta
        state: >
          {{ (states('sensor.ah_bedroom') | float(0) - states('sensor.ah_outside') | float(0)) | round(2) }}

General Automation configuration:

  • Room Name: Bedroom (or your room name)

Sensors - Indoor

  • Indoor Temperature Sensor: sensor.bedroom_temperature
  • Indoor Humidity Sensor: sensor.bedroom_humidity
  • AH Difference Sensor: sensor.ah_bedroom_difference :warning: Important!

Window Sensors

  • Window/Door Sensors: Select all windows/doors for this room
    • Example: binary_sensor.bedroom_window
    • You can select multiple if the room has multiple windows

Thresholds (Shared Helpers)

  • AH Difference Threshold Helper: input_number.ah_difference_threshold
  • Humidity Threshold Helper: input_number.humidity_threshold

Notification Settings

  • Notify Services: Enter your notification service(s), one per line:
  notify.mobile_app_your_phone
  notify.mobile_app_partner_phone
  • Notification Cooldown: 4 hours (adjust as needed)

Notification Messages (Optional - Customize or leave defaults)

  • Open Window Notification Title: 🌬️ Ventilation: {room}
  • Open Window Notification Message: Humidity: {humidity}%. AH Difference: {ah_diff} g/m³. Open window!
  • Close Window Notification Title: 🚪 Close window: {room}
  • Close Window Notification Message: AH Difference is below {ah_diff} g/m³. Close window.

Available variables:

  • {room} - Room name
  • {humidity} - Current room humidity percentage
  • {ah_diff} - Current AH difference value

Quiet Hours (Shared Helpers)

  • Quiet Hours Start Helper: input_datetime.wentylacja_cisza_start
  • Quiet Hours End Helper: input_datetime.wentylacja_cisza_koniec

Tracking Helper

  • Last Notification Time Helper: input_datetime.wentylacja_bedroom_last_notification