Skip to content

Instantly share code, notes, and snippets.

@f45tb00t
Forked from r3mcos3/heating.yaml
Last active November 3, 2023 14:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save f45tb00t/eab416909ff6d125d7f3c6170ab017a9 to your computer and use it in GitHub Desktop.
Save f45tb00t/eab416909ff6d125d7f3c6170ab017a9 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint For Heating
blueprint:
name: Heating Control and Window Sensor and boolean
description: Control your heating with options for group home, if temp is below
a specific value, set temp, and heating between specific times.
domain: automation
input:
heating:
name: Climate Device
description: The climate device to use.
selector:
entity:
domain: climate
temp_sensor:
name: Temperature Sensor
description: Temperature Sensor to check.
selector:
entity:
domain: sensor
device_class: temperature
window_sensor_1:
name: Door or Window Sensor
description: Check if window or door is open
selector:
entity:
domain: binary_sensor
#because new sensors of aqara device_class: opening
groupname:
name: Person Group
description: The group of people that have to be home.
default: []
selector:
entity:
domain: group
group_presence:
name: Group Presence
description: Heat only if Person of Group was present in a given amount of time
default: 07:30:00
selector:
time: {}
heating_boolean:
name: Heating Boolean
description: Check if Boolean is off for automation
selector:
entity:
domain: input_boolean
min_temp:
name: Minimum Temp
description: If temperature is below this value and someone is home, It turns
heating on.
default: 15
selector:
number:
min: 11.0
max: 25.0
step: 0.1
mode: slider
set_temp:
name: Temperature Target
description: If the heating turns on, It heats to this target temperature.
default: 20
selector:
number:
min: 14.0
max: 25.0
step: 0.1
mode: slider
energy_temp:
name: Energy Saving Temperature
description: When away, keep the Energy Saving Temperature
default: 17
selector:
number:
min: 14.0
max: 25.0
step: 0.1
mode: slider
time_after:
name: Time After
description: After this time the heating turns on, so it's warm in the morning
default: 07:30:00
selector:
time: {}
time_before:
name: Time Before
description: After this time the heating turns off, This to prevent the heating
is on in the middle of the night
default: '21:30:00'
selector:
time: {}
source_url: https://gist.github.com/f45tb00t/eab416909ff6d125d7f3c6170ab017a9
variables:
set_temp: !input 'set_temp'
energy_temp: !input 'energy_temp'
window_sensor_1: !input 'window_sensor_1'
heating_boolean: !input 'heating_boolean'
trigger:
- platform: homeassistant
event: start
- platform: event
event_type: automation_reloaded
- platform: time_pattern
minutes: /1
condition:
- condition: state
entity_id: !input 'heating_boolean'
state: 'off'
action:
- choose:
- conditions:
- condition: numeric_state
entity_id: !input 'temp_sensor'
below: !input 'min_temp'
- condition: time
before: !input 'time_before'
after: !input 'time_after'
- condition: state
entity_id: !input 'window_sensor_1'
state: 'off'
- condition: not
conditions:
- condition: state
entity_id: !input 'groupname'
for: !input 'group_presence'
state: not_home
sequence:
- service: climate.set_temperature
data:
entity_id: !input 'heating'
hvac_mode: heat
temperature: '{{ set_temp }}'
- conditions:
- condition: state
entity_id: !input 'window_sensor_1'
state: 'on'
sequence:
- service: climate.set_hvac_mode
data:
hvac_mode: 'off'
entity_id: !input 'heating'
default:
- service: climate.set_temperature
data:
entity_id: !input 'heating'
temperature: '{{ energy_temp }}'
mode: single
@f45tb00t
Copy link
Author

I've changed the code a bit to my needs.
Instead of only heating when a person is at home, with this blueprint its possible to even heat the house/flat, when you are away for x hours.
This works for example when you go shopping for x hours in the winter, so when you come back the flat/house is still warm and you don't have to wait until it's warm again

@f45tb00t
Copy link
Author

  • Added (27.08.2021) Due to issues with the energy saving function using prior set temperature, I've implemented the option to set the energy saving temperature.

@f45tb00t
Copy link
Author

f45tb00t commented Sep 9, 2021

Added some other things. Now we have

  • Group presence detection
  • Group delayed presence detection (e.g if you leave the house to go shopping and you won't have your house cool down)
  • Window Sensor (if open, turn of heating)
  • new boolean check (to not interfere with other settings you might have done via voice commands. e.g. heat room x for x minutes to temperature z)

To achieve different things, I've added some if-else statements as well. If anyone else is using this and you find a bug, please let me know.

@thefunkygibbon
Copy link

thefunkygibbon commented Oct 14, 2021

this is good. thanks. but i am having an issue in that it turns itself off if the 1minute auto re-trigger runs and it is over the min_temp number (but not got up to the set_temp level).
so for example. I want it to start heating if it is less than 17degrees and heat it up to 21. It starts all well and good, but if it say hit 17.5 degrees in a few mins, the next time it runs, it turns off again. It never goes up to the 21degrees temp that is desirable.

I did fork it and make a few small changes, the only one that could have caused this was

    sequence:
    - service: climate.set_preset_mode
      data:
        entity_id: !input 'heating'
        preset_mode: none

I changed to

   - service: climate.turn_on
      data:
        entity_id: !input 'heating'

because the heating didn't ever turn on with the preset mode service. I'm not sure what it is really supposed to do.

@f45tb00t
Copy link
Author

f45tb00t commented Oct 16, 2021

@thefunkygibbon Which thermostats do you have? If it's not Eurotronic Spririt (Z-Wave Version) that yours does not support that. For me it's working.

I needed to add the


    - service: climate.set_preset_mode
      data:
        entity_id: !input 'heating'
        preset_mode: none

because the default would be

  - service: climate.set_preset_mode
    data:
      entity_id: !input 'heating'
      preset_mode: Energy heat


So when triggered it would not change the energy heating back to none.

I gave all Eurotronic Z-Wave thermostats back to the seller, as I had a lot of trouble with them. I've replaced them with the zigbee Versions. The Zigbee Versions have less functionality. See below:

hvac_modes: off, heat
min_temp: 5
max_temp: 30
current_temperature: 21.5
temperature: 17
hvac_action: idle
system_mode: [4]/heat
occupied_cooling_setpoint: 2600
occupied_heating_setpoint: 1700
pi_heating_demand: 0
unoccupied_cooling_setpoint: 1600
friendly_name: Heizung_Badezimmer thermostat
supported_features: 1


So basically there is no energy heating, but the v4 still works for me

@thefunkygibbon
Copy link

ah ok. i'm using with a 'generic thermostat' (which connects a thermometer i have with a smartplug).
personally i'm not bothered about the energy heating aspect, i'm ok with it just being 'off' until i need it on. I'll look in to trying to make some more tweaks to it, and if needs be i guess i can just set the min/max temp to be the same. although i guess that will make for a lot of turning on and off which prob isn't good for any of the hardware involved.

@f45tb00t
Copy link
Author

Due to the fact that the maintainer changed the behavior onwards from Home Assistant 2022.04. I needed to remove some settings, as the Blueprint and therefore the automation did not work anymore.

Should be affected by this: home-assistant/core#68394

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment