Window open, climate off

Hello! Nice, I was assuming that the Homematic climate devices are different. I did not know that homematic has its own service calls. But I think there is still a difference in 1. Homematic and 2. HomematicIP, right? Do you know the differneces? I am asking if your blueprint can handle all Homematic users (so that I can inform them in my initial post and make a link to your post).

It is really fascinating to me that an easy function can have so much corner cases even in Home Assistant. At the same time it is a proof that a single “smarthome” company will never be capable of managing all the functions a smarthome end-user wants to use!

1 Like

Hi @SmartLiving.Rocks. I just installed this blueprint for my Tado-based home. After creating a few template binary sesnors for the rooms with more than one window, creating the automations was easy and I was done inside of ten minutes. After initial testing, I can see it works perfectly. Thank you for all of your hard work and continued effort in this.

If you were to consider a https://www.buymeacoffee.com/ or similar, I’d gladly contribute!

I’m afraid that all my Homematic devices are IP types, so I can’t say for definite that it won’t work. However, I think it’s quite likley that it will, as the non-IP TRVs and thermostats do have the same functionality to use window sensors to control them.
Totally agree with your comment, no one manufacturer can cover every use case, which is why I love Home Assistant. Being able to link the sensors from my alarm system to control the heating system is a perfect example of this.

Alright, thanks! So all HomematicIP users can visit your link in this post. Very cool! Thanks

1 Like

:relaxed: Wow thank you very much! That is really great to hear/ read! Actually it was not so much work and it is more scientific experiment. That is one of the functions the market promised at the beginning of the smart home journey. But it was actually really complicated (tried it with fibaro HomeCenter2) and other Z-Wave controllers. Even a company like tado that only concentrates on heating is not able to handle it. Interesting, isn’t it.

No, I do not have a buymeacoffee account. I assume that they keep a little percentage. You can use my PayPal account and send money using friends.

Thanks in advance and have a nice day!

1 Like

Tado do have their own open window detection, but I think it’s based on sudden temp/humidity changes. I did try using it, but it wasn’t very accurate. Using actual door/window sensors makes it fool proof.

I’ve had this automation running for a few days now and it’s brilliant. It’s probably going to drain the batteries in my TRVs a lot faster, but they are rechargable and the cost savings compared to the gas heating make it a no-brainer.

Your PayPal link didn’t work. Looking at the HTML, it looks like it’s just plain text in an anchor tag.

The build in window detection does not work at all - I have experienced it with Danfoss Thermostats and other brands as well. Regarding the batteries, I am also looking for alternatives. There is a device with EnOcean technology that does create its energy by transforming the heat. But I do not have any experience yet.

What window sensors are you using? I have updated the link.

1 Like

How could I add multiple sensor in the blueprint. For 1 zone I have 2 Windows = 2 window sensor. If one of both is open, shutoff the hvac.

We have discussed it here. You need to make a Binary Template Sensor. Example in the following post:

2 Likes

Thank you for this blueprint.
I do have one question though. i do not want to use the open state from my radiator valve, but from a aqara window sensor as this seems to be more accurate. I cannot select these in the blueprint. Any easy way to fix this?

I assume the device class of your sensor is not “window”. We have discussed it here:

1 Like

You are correct. I did change this and all is working fine now.
Thank you !

1 Like

@SmartLiving.Rocks

The HA description states that this should no longer be used. What would be the more modern variant?

template:
  - binary_sensor:
    sensors:
      window_group:
        friendly_name: Windows_Heating_Julia
        value_template: >-
          {{ is_state('binary_sensor.openclose_28', 'on')
             or is_state('binary_sensor.openclose_29', 'on')
            }}
        device_class: window 

Thought would be this, but this does not work so :roll_eyes:

Hi, thanks for the hint! That’s also a very important information for @WhimsySpoon @Plouf34 as I know they are also using several sensors for one climate entity.

NOT RECOMMENDED (but working) Template - Home Assistant

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 

RECOMMENDED Version Template - Home Assistant

template:
  - binary_sensor:
      - name: NEW Window Group Sensor
        state: >
          {{ is_state('binary_sensor.training_fenster_936', 'on')
             or is_state('binary_sensor.training_philio_4_1_window_940', 'on')
            }}
        device_class: window
2 Likes

Thks.
Where do you create the recommended version? In the binary_sensor.yaml? if yes, I must write all the code above?

@SmartLiving.Rocks

I have 3 rooms with 2 window contacts and it won’t work on one. Looked through several times now, can not find the error. Ask for some advice.

config:

template:
  - binary_sensor:
      - name: Julia Heizung Gruppe
        state: >
          {{ is_state('binary_sensor.openclose_28', 'on')
             or is_state('binary_sensor.openclose_29', 'on')
            }}
        device_class: window
        
  - binary_sensor:
      - name: Schlafzimmer Heizung Gruppe
        state: >
          {{ is_state('binary_sensor.openclose_23', 'on')
             or is_state('binary_sensor.openclose_24', 'on')
            }}
        device_class: window
        .
.
.
.

 Logger: homeassistant.components.automation
Source: components/automation/__init__.py:646
Integration: Automatisierung (documentation, issues)
First occurred: 12:00:11 (3 occurrences)
Last logged: 12:01:49
Blueprint Window open, climate off after a defined time generated invalid automation with inputs OrderedDict([('climate_target', 'climate.julia_zimmer'), ('minimum_open_time', 30), ('window_entity', 'Julia.Zimmer.Fenster')]): Entity ID Julia.Zimmer.Fenster is an invalid entity ID for dictionary value @ data['entity_id']. Got None

In configuration.yaml (please refer to the official documentation!). Of course, if you have manually set a binary_sensor.yaml you could do it here, too.

1 Like

First, I wanna thank you for your automation. This is exactly what I needed. There is just one problem. The automation turns off the heating without a problem but in one of two instances it won’t turn the heating back on. There is no apparent system. sometimes it works, sometimes not. Do you have an idea that I can try?

Hi, Check the trace timeline and share the result.

1 Like

Hi,

Thanks for the quick response. I attached the trace but I am not sure if it was a failed attempt or a successful.

{
  "trace": {
    "last_step": "action/1",
    "run_id": "7d4594d1801111d16f517a89eb1855e8",
    "state": "stopped",
    "script_execution": "cancelled",
    "timestamp": {
      "start": "2021-11-21T16:28:39.714628+00:00",
      "finish": "2021-11-21T16:30:20.974297+00:00"
    },
    "domain": "automation",
    "item_id": "1635175869643",
    "trigger": "state of binary_sensor.combined_windows_livingroom",
    "trace": {
      "trigger/0": [
        {
          "path": "trigger/0",
          "timestamp": "2021-11-21T16:28:39.715219+00:00",
          "changed_variables": {
            "this": {
              "entity_id": "automation.turn_heating_wohnzimmer_off_if_fenster_open",
              "state": "on",
              "attributes": {
                "last_triggered": "2021-11-21T15:06:13.979193+00:00",
                "mode": "single",
                "current": 0,
                "id": "1635175869643",
                "friendly_name": "Turn heating wohnzimmer off if fenster open"
              },
              "last_changed": "2021-11-21T16:27:12.313863+00:00",
              "last_updated": "2021-11-21T16:27:12.313863+00:00",
              "context": {
                "id": "5e41aaecb387aced8e8590b52fb30762",
                "parent_id": null,
                "user_id": null
              }
            },
            "trigger": {
              "id": "0",
              "idx": "0",
              "platform": "state",
              "entity_id": "binary_sensor.combined_windows_livingroom",
              "from_state": {
                "entity_id": "binary_sensor.combined_windows_livingroom",
                "state": "off",
                "attributes": {
                  "friendly_name": "combined_windows_livingroom"
                },
                "last_changed": "2021-11-21T16:15:37.464056+00:00",
                "last_updated": "2021-11-21T16:15:37.464056+00:00",
                "context": {
                  "id": "7b7a54d42b4c088bd6267cbb6e7871d1",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "to_state": {
                "entity_id": "binary_sensor.combined_windows_livingroom",
                "state": "on",
                "attributes": {
                  "friendly_name": "combined_windows_livingroom"
                },
                "last_changed": "2021-11-21T16:28:31.711537+00:00",
                "last_updated": "2021-11-21T16:28:31.711537+00:00",
                "context": {
                  "id": "e488ae5ee291834be5c514c6ab01d67b",
                  "parent_id": null,
                  "user_id": null
                }
              },
              "for": {
                "__type": "<class 'datetime.timedelta'>",
                "total_seconds": 8
              },
              "attribute": null,
              "description": "state of binary_sensor.combined_windows_livingroom"
            }
          }
        }
      ],
      "condition/0": [
        {
          "path": "condition/0",
          "timestamp": "2021-11-21T16:28:39.715485+00:00",
          "result": {
            "result": true
          }
        }
      ],
      "condition/0/conditions/0": [
        {
          "path": "condition/0/conditions/0",
          "timestamp": "2021-11-21T16:28:39.715615+00:00",
          "result": {
            "result": false
          }
        }
      ],
      "condition/0/conditions/0/entity_id/0": [
        {
          "path": "condition/0/conditions/0/entity_id/0",
          "timestamp": "2021-11-21T16:28:39.715742+00:00",
          "result": {
            "result": false,
            "state": "heat",
            "wanted_state": "off"
          }
        }
      ],
      "action/0": [
        {
          "path": "action/0",
          "timestamp": "2021-11-21T16:28:39.718208+00:00",
          "changed_variables": {
            "context": {
              "id": "3ac2c6ad407eab5ca801265cbba7932f",
              "parent_id": "e488ae5ee291834be5c514c6ab01d67b",
              "user_id": null
            }
          },
          "result": {
            "params": {
              "domain": "climate",
              "service": "turn_off",
              "service_data": {},
              "target": {
                "entity_id": [
                  "climate.thermostat_wohnzimmer"
                ]
              }
            },
            "running_script": false,
            "limit": 10
          }
        }
      ],
      "action/1": [
        {
          "path": "action/1",
          "timestamp": "2021-11-21T16:28:39.729057+00:00",
          "result": {
            "wait": {
              "remaining": null,
              "trigger": null
            }
          }
        }
      ]
    },
    "config": {
      "trigger": [
        {
          "platform": "state",
          "entity_id": "binary_sensor.combined_windows_livingroom",
          "to": "on",
          "for": 8
        }
      ],
      "condition": [
        {
          "condition": "not",
          "conditions": [
            {
              "condition": "state",
              "entity_id": "climate.thermostat_wohnzimmer",
              "state": "off"
            }
          ]
        }
      ],
      "action": [
        {
          "service": "climate.turn_off",
          "entity_id": "climate.thermostat_wohnzimmer"
        },
        {
          "wait_for_trigger": [
            {
              "platform": "state",
              "entity_id": "binary_sensor.combined_windows_livingroom",
              "to": "off"
            }
          ],
          "continue_on_timeout": false
        },
        {
          "service": "climate.turn_on",
          "entity_id": "climate.thermostat_wohnzimmer"
        }
      ],
      "id": "1635175869643",
      "alias": "Turn heating wohnzimmer off if fenster open",
      "description": ""
    },
    "blueprint_inputs": {
      "id": "1635175869643",
      "alias": "Turn heating wohnzimmer off if fenster open",
      "description": "",
      "use_blueprint": {
        "path": "SmartLiving.Rocks/window-open-climate-off.yaml",
        "input": {
          "window_entity": "binary_sensor.combined_windows_livingroom",
          "climate_target": "climate.thermostat_wohnzimmer",
          "minimum_open_time": 8
        }
      }
    },
    "context": {
      "id": "3ac2c6ad407eab5ca801265cbba7932f",
      "parent_id": "e488ae5ee291834be5c514c6ab01d67b",
      "user_id": null
    }
  },
  "logbookEntries": [
    {
      "when": "2021-11-21T16:28:39.730541+00:00",
      "name": "Wohnzimmer Heizung",
      "state": "off",
      "entity_id": "climate.thermostat_wohnzimmer",
      "context_domain": "climate",
      "context_service": "turn_off",
      "context_event_type": "call_service",
      "message": "turned off"
    }
  ]
}