Window open, climate off

Tags: #<Tag:0x00007fc4161caf48> #<Tag:0x00007fc4161cae08>

This blueprint takes care about the climate control depending on the status of a window sensor. It checks if a climate device is running before the automation is triggered.


It is a simple and useful automation. It turns off a running climate entity and waits for the window to be closed again until it turns the device on again (to the last active hvac-mode). It also can be used with Air Conditioner and other climate devices.

Important notice: If you have to restart Home Assistant for any reasons it will probably kill the automation. “Delay” and “Wait for” triggers will not be recognized after a restart and it can result in a strange behavior as @NicoLeOca has experienced and described in his post!

IMPORTANT notice for HOMEMATIC users
:crying_cat_face: This Blueprint will not work for you!
The Homematic Thermostat HM-CC-RT-DN and prpably other Homematic thermostats as well cannot handle the service climate.turn_on without doing modification. Please see this post 48 for more detailed information as well as a workaround to get it working!

UPDATE: Thanks to @Soccs we have added a condition that checks if the climate device is running before the automation triggers! It is not specific for MELCloud users as some other climate devices also have more active states!

UPDATE: Now you can also define a minimum time in seconds before the automation is triggered. Good idea from @ferryhel ! Thanks

Blueprint

Click the badge to import this Blueprint: (needs Home Assistant Core 2021.3 or higher)

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

Or import this Blueprint by using the forum topic URL:

blueprint:
  name: Window open, climate off after a defined time
  description: An automation that turns off a running your climate device for exmple a heater
    or an air conditioning if a window sensor is open for a specific time. It waits
    until the window is closed again in order to turn the climate entity on again.
  domain: automation
  input:
    window_entity:
      name: Window Sensor
      description: The window sensor that controls the climate entity.
      selector:
        entity:
          domain: binary_sensor
          device_class: window
    minimum_open_time:
      name: Miniumum time the window is open
      description: Time in seconds to wait until the automation is triggered
      default: 12
      selector:
        number:
          min: 0.0
          max: 120.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    climate_target:
      name: Climate Device
      description: The climate entity that is controlled by the window sensor.
      selector:
        entity:
          domain: climate
trigger:
- platform: state
  entity_id: !input 'window_entity'
  to: 'on'
  for: !input 'minimum_open_time'
condition:
- condition: not
  conditions:
    - condition: state
      entity_id: !input 'climate_target'
      state: 'off'
action:
- service: climate.turn_off
  entity_id: !input 'climate_target'
- wait_for_trigger:
  - platform: state
    entity_id: !input 'window_entity'
    to: 'off'
  continue_on_timeout: false
- service: climate.turn_on
  entity_id: !input 'climate_target'


It prevents the entity of excessive heating and/or cooling while a window is open. Some people say it helps to reduce CO2. I primary use it to reduce costs and raise thermal efficiency as well as my personal comfort.

Let me know your thoughts on this and in what situations you could imagine using it.

8 Likes

Hi,

Nice work. May I ask what kind of window sensor you are using? Looking for something usable for quite some time now but couldn’t find anything good. Wireless, small and battery powered would be awesome. RF or wifi would be great. Any advice? Thanks in advance and br

Hi, thanks!
Difficult question - they all have their pros and cons!

I am using several Z-Wave and Zigbee based window Sensors for testing purposes.

The Z-Wave are cost intensive but in a lot of form factors. The Zigbee are cheep and effective but not as nice looking as some Z-Wave. Furthermore there are some that have some more features like motion detection, illuminance, temperature, vibration detection. One also can detect if the window is tilt. Price range: 30-60 € (Controlled by Open Z-Wave integration).

The Zigbee ones are cheep and do their job. The manufacturing often feels more solid compared to some Z-Wave manufacturers. I have the Aquara Door Sensor (I got mine directly from a China Mi Store) for about 8$. (Controlled by deconz integration).

Thanks for the blueprint. I think it would be usefull to support multiple windows and/or a group to disable the climate entity.

2 Likes

Hi - thanks. I am not sure if this is supported at the moment. An blueprint example eg. several motion detectors trigger a light would be helpful. I will put it on the list of further improvements.

I haven’t tried it, but I think you just need to add target: like this;

  input:
    window_entity:
      name: Window Sensor
      description: The window sensor that controls the climate entity.
      selector:
        target:
          entity:
            domain: binary_sensor
            device_class: window

No. I have tried it before answering you. :nerd_face: You are able to select different window sensors but they do not create a working automation. It has to do with the “or” in the trigger area. I had a look at the several motion based light blueprints but all of them only work with only one sensor (at the moment).

Since the pir motion sensors I have are somewhat unreliable I ended up using two of them per device and build a template binary sensor around so that they only trigger as soon as both per device detected motion. I did that in esphome instead of HA but this would solve the issue for you if You use OR instead of AND. so any detected motion from any sensor would switch the binary sensor to ON. Not sure if that works in blueprints…

Thanks for the small overview of the sensors you’re using ^^

Br

Cool blueprint! :slight_smile:

For my case i have to change the line and remove the device class:

selector:
entity:
domain: binary_sensor
device_class: window

My sensors are not registered as window sensors. Is there any possibility to do the “wait for trigger” for two sensors? I have a room where are two windows and one heater.

Thanks! The sensors device class has to be specified correctly otherwise the blueprint does not find matching entitys. Your workaround shows all sensors - what in a lot of cases can become overwhelming.

As @Blade1337 reccomended you can use a “Template Binary Sensor” in order to make a (window) sensor group. Here you can also define a “device_class” so that my blueprint will recognize it as a window sensor.
You can put as many sensors as you want - the following example consists of two sensors.

binary_sensor:
  - platform: template
    sensors:
      window_group:
        friendly_name: Window Sensor with several Sensors
        value_template: >-
          {{ is_state('binary_sensor.training_fenster_936', 'on')
             or is_state('binary_sensor.training_philio_4_1_window_940', 'on')
            }}
        device_class: window 

Unfortunately it is not yet possible to do it directly in the Blueprint.

1 Like

Nice topic! I am looking for a blueprint using a temperature drop for detection of an open window. Then a window sensor is not needed. A rapid measured temperature drop of the thermostat or valve (Adam Plugwise) could be used to switch off the heating for 15-20 minutes.
Who can write such a blueprint? Thanks, Dirk.

Hi,
please define “A rapid measured temperature drop” in time and delta temperature. Please take in consideration that there are different environmental conditions during summer, winter as well as spring and autumn that will have an effect on the delta temperature.
Furthermore, I would like to know what happens after the 15-20 min countdown if the blueprint has been triggered and the window/door is still open?

This is great! It would be great if we could define the time it should be open before the heating is killed. For example, if I open my window for just a second, it shouldn’t kill the heating.

Yes, that is a good idea! I’ve just updated the blueprint. Is the time range of 120 seconds enough?

Just perfect! Thanks!

1 Like

Fritz Dect open window detection is a nice source for inspiration: open window based on temperature drop.
Fritz!dect open window
There are also suggestions of settings.

@SmartLiving.Rocks perhaps one final request: It would be really cool if we could send a message to a phone running the home assistant app:

{room} (or {climate} window was open. Killing heating
and on close:
{room} (or {climate} window closed. Restoring heating

Sorry, I am not convinced, and I highly doubt the efficiency as well as the stability of the automation. The failure rate is way too high (see also diverse AVM User/Experience groups/forums). Sorry, I am not the right guy for your requirement. Maybe you can develop a blueprint with these guys: Use rapid temperature delta to trigger automation? Thanks!

Notifications, alerts and other information is a complete different chapter in the Book of Home Automation! I see the need as I have TTS saying over my media player entity during daytime: “I have switched off the heater. The temperature is yx and the humidity is zx.” You have to set an input boolean helper to set notification ON/OFF as well as input sliders to define a time range. Then you use it also for other things like the “Garage/Entrance/ door is still open!”, “Person xy at the Entrance”, “Unknown car detected at the driveway!” etc. The notification is also able to select a device to send the Notification to (Media Player, Smartphone, TV, Telegram, E-Mail, LeMetric) based on different conditions (time, location, TV-on, sleepmode-on etc.)
For this basic automation it is too much.

Hello,
I grab your Creation and implemented a Condition. the condition is that if the Climate unit is actually turned off, this automation will not start the climate.
In this particular case for MELCLOUD systems. This is important because each climate unit has its own state names. if you want to find out about yours just go to DEveloper Tools and write the name of the entity. this will show you the state atributes.

blueprint:
  name: Window open, climate off after a defined time4
  description: An automation that turns off your climate device for exmple a heater
    or an air conditioning if a window sensor is open for a specific time. It waits
    until the window is closed again in order to turn the climate entity on again.
  domain: automation
  input:
    window_entity:
      name: Window Sensor
      description: The window sensor that controls the climate entity.
      selector:
        entity:
          domain: binary_sensor
          device_class: door
    minimum_open_time:
      name: Miniumum time the window is open
      description: Time in seconds to wait until the automation is triggered
      default: 12
      selector:
        number:
          min: 0.0
          max: 120.0
          unit_of_measurement: seconds
          step: 1.0
          mode: slider
    climate_target:
      name: Climate Device
      description: The climate entity that is controlled by the window sensor.
      selector:
        entity:
          domain: climate
    condition_target:
      name: Climate Device
      description: I Unit has a State by melcloud operate.
      selector:
        entity:
          domain: climate
  source_url: https://community.home-assistant.io/t/window-open-climate-off/257293
trigger:
- platform: state
  entity_id: !input 'window_entity'
  to: 'on'
  for: !input 'minimum_open_time'
condition:
- condition: state
  entity_id: !input 'condition_target'
  state:
  - 'heat'
  - 'dry'
  - 'cool'
  - 'fan_only'
  - 'heat_cool'
action:
- service: climate.turn_off
  entity_id: !input 'climate_target'
- wait_for_trigger:
  - platform: state
    entity_id: !input 'window_entity'
    to: 'off'
  continue_on_timeout: false
- service: climate.turn_on
  entity_id: !input 'climate_target'
1 Like