Window/Door controlled heater - saves now previous temp - also groups of windows sensors can be added

Tags: #<Tag:0x00007fc409594938> #<Tag:0x00007fc409594848> #<Tag:0x00007fc409594780> #<Tag:0x00007fc409594668>

Just a small blueprint to switch heater on or off bepending on window or door sensor:

2 Likes

I updatet the blueprint. The previous et temperature is now saved and will be set after window is closed again.

that’s very useful and thx for sharing. Also would it be possible to add conditions based on presence detection that can turn on and off the heater.

Very nice and useful blueprint, I was looking for this kind of function for a long time.
I’ve extended the blueprint with a configurable timer.
With this timer, the heater is not turned off and on many times if you open/close the door/window more often in a short time.
This saves the battery of your heater thermostat.

The extension is inspired by this blueprint example.

Hi, thanks for the reply. Unfortenately I have no usecase for that ans also not the right setup for testing.

I extended your blueprint with a second timer.
As I am using sensors on my windows and door to the balcony, I wanted the heating to wait X seconds before turning off (for walking through the door and closing after a few seconds). This saves closing cycles of the valve in the first place. Otherwise on every opening event the valve would move instantly.

3 Likes

It’s wonderfull solution but there is not heater previous state control. If heater was powered off and you close window, always will power on…

2 Likes

Hello,
Yes i just came here to point out that. if the heater was already turned off, then once we close the window, it will turn it on

I like it!

Is there a way to add more heater? I have 2 heat pump to control with a sensor group.

i realy like it.
the only thing that bothers me is that when the window is closed, the hvac turns on the heat.
is there a way to set the hvac to auto mode when a window is closed?

There is ,

blueprint:
  name: window controlled heater Summer GAVEAS
  description: Raise heater temp to 26 when opening window and bring back with delay
  domain: automation
  source_url: https://gist.github.com/govido/4aaa213e6209d3b76ec0e65d576e3701
  input:
    heating_target:
      name: Heater
      selector:
        entity:
          domain: climate
    window_entity:
      name: Window Sensor
      selector:
        entity: {}
    window_closed_wait:
      name: Wait time open
      description: Time to leave the heating on after window or door is opened.
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
    window_opened_wait:
      name: Wait time closed
      description: Time to leave the heating off after window or door is closed.
      default: 120
      selector:
        number:
          min: 0.0
          max: 3600.0
          unit_of_measurement: seconds
          mode: slider
          step: 1.0
mode: restart
max_exceeded: silent
variables:
  heating_target: !input 'heating_target'
  heating_temperature: '{{ state_attr(heating_target, ''temperature'') }}'
trigger:
  platform: state
  entity_id: !input 'window_entity'
  from: 'off'
  to: 'on'
action:
- delay: !input 'window_opened_wait'
- service: climate.set_temperature
  entity_id: !input 'heating_target'
  data:
    temperature: 26
- wait_for_trigger:
    platform: state
    entity_id: !input 'window_entity'
    from: 'on'
    to: 'off'
- delay: !input 'window_closed_wait'
- service: climate.set_temperature
  entity_id: !input 'heating_target'
  data:
    temperature: 22
- service: climate.set_temperature
  entity_id: !input 'heating_target'
  data:
    temperature: '{{heating_temperature}}'

ive addapted mine to only raise or lower the temp.

i have made an edit to the script (forked?) to set HVAC mode.
it kinda works, with an warning in the log about data set value.

here is mine, pherhaps i am missing something or did it totaly wrong.
but hey, i have hass running for 2 months now on a Pi3b so i am a newby to al of this and working on trail and error base here :crazy_face:

blueprint:
  name: window controlled heater
  description: turn off heater when opening window and turn on with delay
  domain: automation
  source_url: https://gist.github.com/govido/4aaa213e6209d3b76ec0e65d576e3701
  #forked 2nd time from  https://gist.github.com/gresie/476f1169ddd4a1bbbb12662f5b20e383
  #forked from https://gist.github.com/dirkk1980/8ba849b480844b32e9ca484e6de5d552
  #inspired by https://github.com/home-assistant/core/blob/973f59e42305fba73ec3da5986eb3639afa373c9/homeassistant/components/automation/blueprints/motion_light.yaml
  input:
    heating_target:
      name: Heater
      selector:
        entity:
          domain: climate
    window_entity:
      name: Window Sensor
      selector:
        entity: {}
    window_closed_wait:
      name: Wait time open
      description: Time to leave the heating on after window or door is opened.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
    window_opened_wait:
      name: Wait time closed
      description: Time to leave the heating off after window or door is closed.
      default: 120
      selector:
        number:
          min: 0
          max: 3600
          unit_of_measurement: seconds
# If window or door is closed within the delay,
# we restart the script.
mode: restart
max_exceeded: silent

variables:
  heating_target: !input 'heating_target'
  heating_temperature: '{{ state_attr(heating_target, ''temperature'') }}'
trigger:
  platform: state
  entity_id: !input 'window_entity'
  from: 'off'
  to: 'on'
action:
# timer waiting for door or window being open for X seconds (not turning the heater off if just walking through a door)
- delay: !input window_opened_wait
- service: climate.set_hvac_mode
  entity_id: !input 'heating_target'
  data:
    hvac_mode: 'off'
- wait_for_trigger:
    platform: state
    entity_id: !input 'window_entity'
    from: 'on'
    to: 'off'
# timer is reset is door is closed within this delay
- delay: !input window_closed_wait
- service: climate.set_hvac_mode
  entity_id: !input 'heating_target'
  data:
    hvac_mode: auto

Hi all,

Just starting this thread into life again this works really well for me using a Nest thermostat. What is a problem though is that the family know they only need to adjust the thermostat and the heating starts with the back door wide open.
Is there a way of stopping this from happening?