Turn off HVAC/thermostat when window/ door open

Seems like my code is starting to become dated… I haven’t been messing with home assistant too much so I’ll look into the new style groups from your previous comment. As far as making it persistent across restarts unless there has been some updates that make it easier there is not really a nice way to make it persistent using a blueprint. To make it persistent you would have to create a couple state values that track the status of the HVAC system and last time I checked I can’t include that in a blueprint. I have done it that way and can help you, it’s just a lot more custom and not terribly user friendly. I’ll also look into the newer versions of home assistant and see if maybe something was added that lets me create a simple blueprint you can download.

Edit: Unfortunately looking through the updates it appears the same problem exists if you are updating or restarting home assistant. The problem is the automations and created scenes are not persistent through a restart but adding the variables is still a usable workaround it just can’t be included directly in the blueprint. This is an excerpt from the scenes documentation that highlights the issues. (Also they have a new example of doing what my blueprint does that wasn’t there before, kind of funny.)

" Create a new scene without having to configure it by calling the scene.create service. This scene will be discarded after reloading the configuration."

Pretty good blueprint!

Could you please consider expanding this so that the HVAC will be paused if the door/window sensor(s)group(s) are already opened when the HVAC device is turned on?

Hi!

This blueprint is lovely but seems a bit inconsistent for me. Maybe about half the time, this doesn’t turn my HVAC back on. It leaves it in the off position. I’m noticing it mostly when the door or windows have been open for a while. Is there some sort of a timeout either in Home Assistant or this automation?

Thanks!

Hey glad you like the idea of the automation. There is no timeout in either homeassistant or in the automation. Some possible scenarios that could cause the issue would be if you are restarting either homeassistant or whatever you have homeassistant running on while the HVAC system is in the ‘paused’ state. It will not pick up where it left off due to current limitations with the scene creation process in homeassistant.
The other possibility I could see is if your sensors don’t have the greatest connection and become unavailable while the HVAC system is in the ‘paused’ state. To possibly correct this scenario you could try to edit the code by going to the

- wait_for_trigger:

section towards the bottom and where it says

from: on
to: off

try deleting the part that says

from: on

If you decide to edit the code don’t forget to either reload the automations or just restart homeassistant.

Hope this helps you out.

1 Like

Is it possible to create 2 automations based on this blueprint for 2 different HVAC at home?
For what I see the scene_id is fixed, so when the second automation is triggered, if the other one is already triggered it tries to create the same scene_id so it doesn’t works.

It is possible to setup the scene_id name based on the HVAC entity that is controlling?

Thanks for the reply! I’m actually experiencing a slightly different issue now (and I’m not sure when it changed). This blueprint is, indeed, successfully stopping and restarting my HVAC but it’ll only return my ecobee to a permanent “hold” state, and not the comfort setting that it was set to before the automation occurred. Any ideas?

Thanks again! This is definitely one of my favorite automations I have going, even if just to turn the HVAC off.

Hey sorry for the late reply. I’m not terribly certain on if it is possible but I will definitely look into that. I like the idea.

Hey glad to hear it is working so I had the same issue but I was able to fix it using the ‘Resume Action’ built into the blueprint. In HA for ecobee there is a button press to ‘clear hold’. Using the ‘Resume Action’ I added in a ‘wait for trigger’ to look for when the ecobee goes ‘from off’ leaving the ‘to’ field blank and then an action after that which triggers the ‘clear hold’ button. The wait for trigger option is probably not necessary but it catches any issues if there is a slow down on the network. I also made the ‘continue on timeout’ option in the ‘wait for trigger’ action 5 seconds just to make sure it triggers. Once the ‘clear hold’ button is triggered your ecobee will resume the normal schedule.

Your suggestion has been implemented in version 1.5. Thank you for the idea! Let me know if you decide to use it how it works for you!

Thanks so much for the reply! This seems to be exactly what I’m looking for. However, I’m not seeing the “from off” field. Only Home, Away, and Sleep. Screenshot attached. Thanks again!

Update: I edited the YAML, so will test to see if that works. Thanks!!

I believe you are currently using the ‘select’ entity, you want the ‘climate’ entity, which is the ecobee itself, then you should have the ‘off’ option.
The device should be ‘climate.main_floor’ instead of ‘select.main_floor_current_mode’

1 Like

Awesome blueprint, and here’s a request: Add the ability to trigger extra actions immediately when the door opens (flash some lights, notify) and then if it stayed open for the entire delay run the already existing actions. Maybe have two triggers?

Would be nice if the climate entity gets adjusted while it’s still paused to cancel returning it to old state when it gets triggered by sensor being off. hope that makes sense. here’s an example: my ac was set to cool, then I opened a window and it got paused, while it was paused I have turned it on and set it to “fan” mode to improve air circulation. but when I close the window it goes back to cool mode, I’d rather keep it at “fan” to avoid confusion.

I have it already set to look at the status of the HVAC system to make sure it is off but checking it, the fan status apparently is not taken into account when determining if it is off. I can add in a line to verify the fan is in auto as well.
Sorry I have been away from this all for a while, been busy moving and I am just now getting all my automations restored.

I think the best way to achieve what you are looking for would be to manually edit some code. If you take this section:

action:
- service: scene.create
  data:
    scene_id: "{{ name_id }}"
    snapshot_entities: !input climate_device
- service: climate.set_hvac_mode
  target:
    entity_id: !input climate_device
  data:
    hvac_mode: 'off'
- choose:
  - conditions: '{{ pause_action is defined }}'
    sequence: !input pause_action

And re-order it as this:

action:
- choose:
  - conditions: '{{ pause_action is defined }}'
    sequence: !input pause_action
- service: scene.create
  data:
    scene_id: "{{ name_id }}"
    snapshot_entities: !input climate_device
- service: climate.set_hvac_mode
  target:
    entity_id: !input climate_device
  data:
    hvac_mode: 'off'

Your custom pause actions will happen before anything is changed. Doing this you can set up the blueprint pause delay to 0 and then create custom choose actions for your pause_action in the blueprint to do exactly as you described.

This is my first Blueprint added to my HA, and this is awesome. I really appreciate the work you’ve done with this one. I saw the comment where someone else had asked for a timeout where if the window is not closed after a certain amount of time, it requires manual input to the thermostat to turn it back on. This would be an amazing feature, but doesn’t make or break this blueprint.

Thank you for your feedback! Since there are multiple requests I’ll look into adding this as an optional selector.

1 Like

Can you not add a trigger to the blueprint that would restore the saved state upon restart of ha? That would at least restore the thermostat to an “on” state in the correct mode for the season. As it stands, if ha is restarted while a window is opened, the thermostat will remain off until manually turned on.

Great blueprint, BTW. Thanks for publishing it.

This is in response to how it handles states through ha restarts.

Can you not add a trigger to the blueprint that would restore the saved state upon restart of ha?

Can’t speak for the creator, but I think in order to do this, there’d need to be a feature in ad hoc scenes/scene.create to allow it to persist over restart. I don’t think there is currently because then it’d be considered a manually created scene.

I’ve thought of this, the issue would be that it would have to assume the system always wants to be on when HA restarts which isn’t always the case and then it’s also taking it’s best guess on if it needs to be heat or cool. It might be summer but a cooler night where you wouldn’t want heat but the system wouldn’t know that. If HA implements a way to have persistent scenes it would be easy.
The other way would be to create another variable to save the current setting to, but then it starts to complicate the blueprint and forces users to create the variable exactly right to work with the blueprint.