Last active
September 18, 2022 18:56
-
-
Save robsonke/850ca17a2ca3417601ae0f73d523cc34 to your computer and use it in GitHub Desktop.
Home Assistant Blueprint for controlling your heater. Based on https://community.home-assistant.io/t/another-heating-control/259363 but without the person checks and using simple switch entities instead of climate control but plus checks on window sensors to avoid useless heating and price checks for dynamic energy pricing.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blueprint: | |
name: Heating Control | |
description: Control your heating with options if temp is below a specific value, | |
set temp, and heating between specific times. | |
domain: automation | |
input: | |
heating: | |
name: Climate Switch | |
description: The climate switch to use. | |
selector: | |
entity: | |
domain: switch | |
temp_sensor: | |
name: Temperature Sensor | |
description: Temperature Sensor to check. | |
selector: | |
entity: | |
domain: sensor | |
device_class: temperature | |
price_level_sensor: | |
name: Energy Price Level Sensor | |
description: Energy Price Level Sensor to check. | |
selector: | |
entity: | |
domain: sensor | |
price_level_percentage: | |
name: Maximum Price Level Percentage | |
description: The price level sensor should have an attribute called percentage, what should be the max based on the overall average price today | |
default: 100 | |
selector: | |
number: | |
min: 0 | |
max: 150 | |
step: 10 | |
mode: slider | |
min_temp: | |
name: Minimum Temp | |
description: If temperature is below this value it turns heating on. | |
default: 15 | |
selector: | |
number: | |
min: 15.0 | |
max: 25.0 | |
step: 1.0 | |
mode: slider | |
window_sensor: | |
description: Window Binary Sensor to check if opened, only start heating when the window is closed. Entity can also be a group of window/door entities. | |
selector: | |
entity: | |
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: {} | |
run_on_monday: | |
name: Run on Monday | |
default: true | |
selector: | |
boolean: {} | |
run_on_tuesday: | |
name: Run on Tuesday | |
default: true | |
selector: | |
boolean: {} | |
run_on_wednesday: | |
name: Run on Wednesday | |
default: true | |
selector: | |
boolean: {} | |
run_on_thursday: | |
name: Run on Thursday | |
default: true | |
selector: | |
boolean: {} | |
run_on_friday: | |
name: Run on Friday | |
default: true | |
selector: | |
boolean: {} | |
run_on_saturday: | |
name: Run on Saturday | |
default: true | |
selector: | |
boolean: {} | |
run_on_sunday: | |
name: Run on Sunday | |
default: true | |
selector: | |
boolean: {} | |
source_url: https://gist.github.com/robsonke/850ca17a2ca3417601ae0f73d523cc34 | |
variables: | |
current_day: '{{ now().weekday() | int }}' | |
price_level_percentage: !input price_level_percentage | |
price_level_sensor: !input price_level_sensor | |
run_on_monday: !input run_on_monday | |
run_on_tuesday: !input run_on_tuesday | |
run_on_wednesday: !input run_on_wednesday | |
run_on_thursday: !input run_on_thursday | |
run_on_friday: !input run_on_friday | |
run_on_saturday: !input run_on_saturday | |
run_on_sunday: !input run_on_sunday | |
window_sensor: !input window_sensor | |
trigger_variables: | |
run_on_monday: !input run_on_monday | |
run_on_tuesday: !input run_on_tuesday | |
run_on_wednesday: !input run_on_wednesday | |
run_on_thursday: !input run_on_thursday | |
run_on_friday: !input run_on_friday | |
run_on_saturday: !input run_on_saturday | |
run_on_sunday: !input run_on_sunday | |
trigger: | |
- platform: homeassistant | |
event: start | |
- platform: event | |
event_type: automation_reloaded | |
- platform: time_pattern | |
minutes: /10 | |
- platform: state | |
entity_id: !input price_level_sensor | |
condition: | |
- condition: template | |
value_template: "{{ \n (current_day == 0 and run_on_monday) or \n (current_day\ | |
\ == 1 and run_on_tuesday) or \n (current_day == 2 and run_on_wednesday) or\n\ | |
\ (current_day == 3 and run_on_thursday) or \n (current_day == 4 and run_on_friday)\ | |
\ or\n (current_day == 5 and run_on_saturday) or\n (current_day == 6 and run_on_sunday)\n\ | |
}}" | |
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: template | |
value_template: "{{ window_sensor is not defined or states[window_sensor].state == 'off' }}" | |
- condition: numeric_state | |
entity_id: !input price_level_sensor | |
attribute: percentage | |
below: !input price_level_percentage | |
sequence: | |
- service: switch.turn_on | |
data: | |
entity_id: !input 'heating' | |
default: | |
- service: switch.turn_off | |
data: | |
entity_id: !input 'heating' | |
mode: single | |
max_exceeded: silent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment