🌡️ Automatic Room Heating Based on Window State
This guide explains how to set up a smart heating automation in Home Assistant that reacts to your window sensors to maximize comfort and save energy.
- Window Opened: The heating in the corresponding room will automatically turn off.
- Window Closed: The heating will restore the last manually set temperature for that room.
⚙️ Requirements
- A working Home Assistant installation
- Climate integrations (thermostats) for each room
- Binary sensors for windows or doors
- Input Number helpers to store the last set temperature
🔧 Setting Up Input Number Helpers
Input Numbers are used to remember the last desired temperature for each room. Example configuration for the living room:
wohnzimmer_last_temp:
name: Living Room Last Temperature
min: 5
max: 30
step: 0.1
unit_of_measurement: "°C"
initial: 23.5💾 Automation Example (Per Room)
This automation triggers whenever a window sensor changes state. When the window opens, it stores the current temperature and turns off the heater. When the window closes, it restores the previous temperature.
alias: Living Room Window Heating Control
trigger:
- platform: state
entity_id: binary_sensor.living_room_windows
condition: []
action:
- choose:
- conditions:
- condition: state
entity_id: binary_sensor.living_room_windows
state: "on"
sequence:
- service: input_number.set_value
target:
entity_id: input_number.wohnzimmer_last_temp
data:
value: "{{ state_attr('climate.living_room', 'temperature') }}"
- service: climate.turn_off
target:
entity_id: climate.living_room
- conditions:
- condition: state
entity_id: binary_sensor.living_room_windows
state: "off"
sequence:
- service: climate.set_temperature
target:
entity_id: climate.living_room
data:
temperature: "{{ states('input_number.wohnzimmer_last_temp') | float }}"
mode: single📄 Notes and Best Practices
- Each room should have its own automation with its respective thermostat and window sensors.
- Input Numbers store the last manually set temperature, ensuring the system always restores your preferred comfort level.
- This approach works with multiple windows per room and automatically reacts to any open or closed state.
- You can expand this logic to include doors, guest rooms, or any other zones in your house.
- Optional: Combine with Home Assistant presence detection or HVAC schedules for even smarter energy savings.
⚡ Summary
This automation setup ensures:
- Energy savings by turning off heating when windows are open.
- Comfort restoration by automatically setting the last preferred temperature when windows close.
- Scalability: Add as many rooms as you need with separate automations and temperature memory.