Window open, climate off

Thanks for that great blueprint!

I adpted it to my purposes. I substituted the complete action: paragraph. It’s now much shorter, no need for target_temperature and the conditions for state any more. :slight_smile: I replaced by creating scenes on the fly and reloading them. They fit ALL climate devices, doesn’t matter which modes they have. Creating and reloading scenes on the fly

action:
  - service: scene.create
    data:
      scene_id: before
      snapshot_entities: !input climate_target
  - service: climate.turn_off
    target:
      entity_id: !input climate_target
  - wait_for_trigger:
      - platform: state
        entity_id: !input window_entity
        to: "off"
    continue_on_timeout: false
  - delay: !input minimum_close_time
  - service: scene.turn_on
    target:
      entity_id: scene.before

Much shorter and not as complicated. :slight_smile:

1 Like

What? Wait, no way :heart_eyes:! You are absloutely right :partying_face: I was not aware that scenes also can be used for every entity - I thought it is only for lights! Thanks for educating me - that is a powerful feature!

Do you have an idea how we can dynamically define a name for scene_id: before so that every bp automation gets its own scene name for every climate area?

If it is a window, then define its device class to window!

change binary sensors device class from door to window in home assistant

There is also a version for any binary sensor on GitHub you can import manually:

Dynamic scene_id, very good hint. It doesn’t seem to be possibel (until now) templating this parameter. What I found here might be a possible solution. I will investigate it.

I made a little success. I got an entity list with
{{ expand(state_attr('climate.trv_wohnzimmer', 'entity_id')) |map(attribute='entity_id')|list }}

I did define this device group in configuration.yaml like this:

climate:
  - platform: climate_group
    name: TRV-Wohnzimmer
    temperature_unit: C
    entities:
      - climate.trv_wohnen_01
      - climate.trv_wohnen_02
      - climate.trv_wohnen_03

To group climate devices you’ll need Home Assistant Climate Group

Now i will do some tests how it behaves when you open and close several windows.

This doesn’t work also. becaus it restores always the last situation. I will try using two scripts as described here https://community.home-assistant.io/t/turning-on-a-scene-with-a-dynamic-entity-id-in-a-script/283941

Indeed, that tricky. Interesting links you have shared! Especially the climate group.

Here is also a guy who wants to improve the climate automation using node red. Maybe that is helpful for you: Window open, climate off - #191 by snikay

As far as I understand, you want to have a shorter code, but now you are creating two more scripts for each heating area to get it working?

Generally, Blueprints are designed to make complicated code easy to use for non-coders. You can have a look at how this Blueprint started (very easy, simple and straight forward) and how it has developed over the time. The community gave great feedback and we discovered a lot of corner cases from all over the world. Covering more than 90% of all climate devices from different vendors worldwide including air conditioning. To make it working and over all the corner cases the code became more complex/ complicated but at the same time it got better and better and now it is rock solid :partying_face: with more than 3,500 installations and even a fork for Homematic users as well as a working solution for AVM Fritz Dect Thermostats.

Regarding Homematic: thanks for pointing out the option to control the window state via setDevice-Dingenskirchen.

There is also an even better approach (in my opinion). When using the superceding in development integration for Homematic: GitHub - danielperna84/custom_homematic: Custom Home Assistant Component for HomeMatic one can expose the window state as a switch entity. The main benefit is that this adds read access to the state.

By default the window state is not exposed. You have to add the line “WINDOW_STATE” to an unignore file. See Fensterzustand TRV · Discussion #725 · danielperna84/hahomematic · GitHub

Thanks for sharing. I am already following the topic on github - somebody on the German Home Assistant matrix channel recommended it to me.
Unfortunately, I have not fully understood the homematic cosmos with it ip/wired/ “normal” and its reasperymatic in order to make it fully local accessible. Too complicated for a Z-Wave guy :wink:
As far as I have seen, you already have reached out to @sota who is the Homematic expert and also made a blueprint version.

I’m facing an issue, the thread is too long to follow and can’t find similar that I’m facing. I have four automation that happens when open some window or door sensor and stops heating just as this blueprint promises, all automations was launched because I’m using mode: parallel, but when the first paralleled automation finish, all are finished also, is this behaviour correct? Or exist a way to each paralleled automation ends when the door window match conditions?

alias: Clima) Apagar calefacción Matrimonio si se abren puertas o ventanas
description: ""
mode: parallel
max: 4
use_blueprint:
  path: SmartLiving.Rocks/window-open-climate-off.yaml
  input:
    window_entity: binary_sensor.sensores_de_ventanas_y_puertas_en_matrimonio
    minimum_open_time: 60
    minimum_close_time: 30
    climate_target: climate.dormitorio_matrimonio

Why?

My original code is single

Then, it’s not possible to handle the automation for each room in parallel way? When I run the automation in more than one room, only one of the automation works

Was my mistake, I’m trying again, I revert the code without parallel and works as expected, thank a lot, something mysterious happened today at morning

Due to some limitation, a Shelly TRV doesn’t come back to the initial setting (temperature). Is it possible to toggle the preset instead of the HVAC (“operation” in UI)? Or do you think of a workaround? Thanks in advance.

Interesting! Thanks for Testing my blueprint with Shelly TVR.
I think here is the problem as the thermostat does not have an ‘off’ state.


I need to think how we can handle it.

  1. Storing the temperature needs an additional helper that needs to be created manually.
  2. Setting the temperature to its minimum is a solution but it would be exclusive for Shelly.
  3. Ask shelly to upgrade their firmware.

I have the same behaviour with a Zwave thermostat that is 8 years old. Turning off should be supported and I think more users will claim it

Hi. I’m using your blueprint and you’ve done a wonderful work!
I wonder if there was a way to detect when the door/window is open for a given time (e.g. 2 minutes) and then stop the cycle of the automation.
Better explained, I want it to work as it is intended to be, so I open the door and the climate stops, I close it and it restores the previous HVAC mode but I wanted to stop the automation if the door was open for more than X time and keep the climate device off.

Regards,
Handryck

You can use the optional action part for that. Choose a delay e.g. 5 min and then a call service ‘automation turn off’ and choose the automation (you need to create the automation first)!

How are you going to turn on the automation again?

Thanks.
Well, I don’t actually know how to turn it on again, I didn’t think of that. Would that work if instead of calling the service for automation stop I just use a normal “stop” command after the given delay of time under an if-else condition?
For instance, as the normal “stop command” I mean the one that can be chosen under the actions button.

That’s my actual idea.
“Aperto” means “Open”.

Okay, is that what you want:

  1. Door is opened and turns off the climate/heater
  2. After 5 minutes the climate/heater should be turned on again unless the door is still open

I am not sure what you want to stop.
The heater not heating?