config.ymal
# Modified from: gt4020 Giovanni https://community.home-assistant.io/t/yahwt-heating-week-timer/148789
#--------------Create Boiler thermostat-------------------------------
#virtual thermostat using sensor value from downstairs thermostat and boiler switch.
climate:
- platform: generic_thermostat
name: HA thermo
heater: switch.700574032462ab3b7e49 #Boiler Switch
target_sensor: sensor.current_temp #Boiler room sensor currently reading downstairs zone thermostat
min_temp: 10
max_temp: 24
ac_mode: false
# target_temp: 17
cold_tolerance: 0.3
hot_tolerance: 0
min_cycle_duration:
seconds: 5
keep_alive:
minutes: 1
# initial_hvac_mode: "off"
# away_temp: 12
precision: 0.1
#Immersion Thermostat
- platform: generic_thermostat
name: HW thermostat
heater: switch.bfd019f305520a0591hgke #Immersion Switch
target_sensor: sensor.temperature_sensor_31_0 #HW Boiler sensor
min_temp: 0
max_temp: 65
ac_mode: false
# target_temp: 17
cold_tolerance: 0.3
hot_tolerance: 0
min_cycle_duration:
seconds: 5
keep_alive:
minutes: 1
# initial_hvac_mode: "off"
# away_temp: 12
precision: 0.1
binary_sensor:
- platform: workday
country: 'IE'
name: 'workday_today'
workdays: [mon, tue, wed, thu, fri, sat]
excludes: [sun, holiday]
#---------------------------input temperatures--------------------------
input_number: # input number
#night temps
t0_temp:
name: T night
min: 10
max: 20
step: 0.5
initial: 16
mode: box
icon: mdi:home-thermometer
#weekday temps
t1_work: # temperature preset T1
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t2_work: # temperature preset T2
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
t3_work: # temperature preset T3
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t4_work: # temperature preset T4
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t5_work: # temperature preset T5
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t6_work: # temperature preset T6
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t7_work: # temperature preset T7
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t8_work: # temperature preset T8
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
#sat temps
t1_sat: # temperature preset T1
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t2_sat: # temperature preset T2
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
t3_sat: # temperature preset T3
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t4_sat: # temperature preset T4
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t5_sat: # temperature preset T5
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t6_sat: # temperature preset T6
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t7_sat: # temperature preset T7
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t8_sat: # temperature preset T8
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
#Sunday/Holiday temps
t1_sun: # temperature preset T1
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t2_sun: # temperature preset T2
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
t3_sun: # temperature preset T3
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t4_sun: # temperature preset T4
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t5_sun: # temperature preset T5
name: °C
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:blank
t6_sun: # temperature preset T6
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t7_sun: # temperature preset T7
name: °C
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:blank
t8_sun: # temperature preset T8
name: °C
min: 10
max: 25
step: 0.5
initial: 18
mode: box
icon: mdi:blank
#immersion heater
immersion_temp:
name: Immersion °C
min: 30
max: 65
step: 0.5
initial: 50
mode: box
icon: mdi:hot-tub
immersion_timer: # set time for immersion heater
name: Minutes
initial: 60
min: 10
max: 120
step: 1
mode: box
icon: mdi:timer-sand
#zone temperature inputs
temp_up: # temperature preset Upstairs
name: Temp Upstairs Timer
min: 10
max: 25
step: 0.5
initial: 20
mode: box
icon: mdi:home-thermometer-outline
temp_down: # temperature preset Downstairs
name: Temp Downstairs Timer
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:home-thermometer-outline
#Boost timer settings
boiler_timer: # set time for boost heating start
name: Minutes
initial: 60
min: 10
max: 120
step: 1
mode: box
icon: mdi:timer-sand
temp_boost: # temperature preset boost
name: Temp Boost
min: 10
max: 25
step: 0.5
initial: 22
mode: box
icon: mdi:home-thermometer-outline
#-----------------boolean switches-------------
input_boolean:
heating_master: # if ON enable heating week timer
name: Heating Auto timer
icon: mdi:av-timer
switch_boiler_timer: # if ON start heating for xxx minutes (input_number.boiler_timer). Override week timer.
name: Boost Timer
initial: off
icon: mdi:radiator
switch_immersion_timer:
name: Immersion timer
initial: off
icon: mdi:hot-tub
#-----------------------------sensors----------------------------------------------------------------
#weather sensor
sensor:
- platform: yr
name: Weather
forecast: 1
monitored_conditions:
- temperature
#time sensor
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
- 'beat'
#program 8 time slots for weekday, saturday and sunday/holiday
- platform: template
sensors:
heating_program:
friendly_name: "Heating Program"
value_template: >- # ok 141119
{% set t = states('sensor.time') %}
{% if is_state('binary_sensor.workday_today', 'on') %}
{% if now().weekday() in (0,1,2,3,4) %}
{% if states('input_datetime.p1_weekday_on') <= t <= states('input_datetime.p2_weekday_on') %} p1_weekday
{% elif states('input_datetime.p2_weekday_on') <= t <= states('input_datetime.p3_weekday_on') %} p2_weekday
{% elif states('input_datetime.p3_weekday_on') <= t <= states('input_datetime.p4_weekday_on') %} p3_weekday
{% elif states('input_datetime.p4_weekday_on') <= t <= states('input_datetime.p5_weekday_on') %} p4_weekday
{% elif states('input_datetime.p5_weekday_on') <= t <= states('input_datetime.p6_weekday_on') %} p5_weekday
{% elif states('input_datetime.p6_weekday_on') <= t <= states('input_datetime.p7_weekday_on') %} p6_weekday
{% elif states('input_datetime.p7_weekday_on') <= t <= states('input_datetime.p8_weekday_on') %} p7_weekday
{% elif states('input_datetime.p8_weekday_on') <= t < '23:59' %} p8_weekday
{% elif '00:00' <= t <= states('input_datetime.p1_weekday_on') %} p0_weekday
{% else %} error
{% endif %}
{% else %}
{% if states('input_datetime.p1_saturday_on') <= t <= states('input_datetime.p2_saturday_on') %} p1_saturday
{% elif states('input_datetime.p2_saturday_on') <= t <= states('input_datetime.p3_saturday_on') %} p2_saturday
{% elif states('input_datetime.p3_saturday_on') <= t <= states('input_datetime.p4_saturday_on') %} p3_saturday
{% elif states('input_datetime.p4_saturday_on') <= t <= states('input_datetime.p5_saturday_on') %} p4_saturday
{% elif states('input_datetime.p5_saturday_on') <= t <= states('input_datetime.p6_saturday_on') %} p5_saturday
{% elif states('input_datetime.p6_saturday_on') <= t <= states('input_datetime.p7_saturday_on') %} p6_saturday
{% elif states('input_datetime.p7_saturday_on') <= t <= states('input_datetime.p8_saturday_on') %} p7_saturday
{% elif states('input_datetime.p8_saturday_on') <= t <= '23:59' %} p8_saturday
{% elif '00:00' <= t <= states('input_datetime.p1_saturday_on') %} p0_saturday
{% else %} error
{% endif %}
{% endif %}
{% else %}
{% if states('input_datetime.p1_holiday_on') <= t <= states('input_datetime.p2_holiday_on') %} p1_holiday
{% elif states('input_datetime.p2_holiday_on') <= t <= states('input_datetime.p3_holiday_on') %} p2_holiday
{% elif states('input_datetime.p3_holiday_on') <= t <= states('input_datetime.p4_holiday_on') %} p3_holiday
{% elif states('input_datetime.p4_holiday_on') <= t <= states('input_datetime.p5_holiday_on') %} p4_holiday
{% elif states('input_datetime.p5_holiday_on') <= t <= states('input_datetime.p6_holiday_on') %} p5_holiday
{% elif states('input_datetime.p6_holiday_on') <= t <= states('input_datetime.p7_holiday_on') %} p6_holiday
{% elif states('input_datetime.p7_holiday_on') <= t <= states('input_datetime.p8_holiday_on') %} p7_holiday
{% elif states('input_datetime.p8_holiday_on') <= t <= '23:59' %} p8_holiday
{% elif '00:00' <= t <= states('input_datetime.p1_holiday_on') %} p0_holiday
{% else %} error
{% endif %}
{% endif %}
#define temperature sensors
- platform: template
sensors:
current_temp:
value_template: "{{ states.climate.bfb4fbcb25305e7371a3yn.attributes.current_temperature }}" #read downstairs temp as a sensor
upstairs_temp:
value_template: "{{ states.climate.bf0dca95cb90411960fl8n.attributes.current_temperature }}" #read upstairs temp as a sensor
hvac_temperature_knob:
value_template: "{{ states.climate.ha_thermo.attributes.temperature }}" #read boler stat temp as a sensor
#---------------------------------Time inputs------------------------------------------------------
input_datetime:
p1_weekday_on:
name: P1
has_time: true
initial: '06:00:00'
icon: mdi:clock-start
p2_weekday_on:
name: P2
has_time: true
initial: '09:00:00'
icon: mdi:clock-end
p3_weekday_on:
name: P3
has_time: true
initial: '13:00:00'
icon: mdi:clock-end
p4_weekday_on:
name: P4
has_time: true
initial: '15:00:00'
icon: mdi:clock-end
p5_weekday_on:
name: P5
has_time: true
initial: '17:00:00'
icon: mdi:clock-end
p6_weekday_on:
name: P6
has_time: true
initial: '19:00:00'
icon: mdi:clock-end
p7_weekday_on:
name: P7
has_time: true
initial: '20:00:00'
icon: mdi:clock-end
p8_weekday_on:
name: P8
has_time: true
initial: '22:00:00'
icon: mdi:clock-end
p1_saturday_on:
name: P1
has_time: true
initial: '06:00:00'
icon: mdi:clock-start
p2_saturday_on:
name: P2
has_time: true
initial: '09:00:00'
icon: mdi:clock-end
p3_saturday_on:
name: P3
has_time: true
initial: '13:00:00'
icon: mdi:clock-end
p4_saturday_on:
name: P4
has_time: true
initial: '15:00:00'
icon: mdi:clock-end
p5_saturday_on:
name: P5
has_time: true
initial: '17:00:00'
icon: mdi:clock-end
p6_saturday_on:
name: P6
has_time: true
initial: '19:00:00'
icon: mdi:clock-end
p7_saturday_on:
name: P7
has_time: true
initial: '20:00:00'
icon: mdi:clock-end
p8_saturday_on:
name: P8
has_time: true
initial: '22:00:00'
icon: mdi:clock-end
p1_holiday_on:
name: P1
has_time: true
initial: '06:00:00'
icon: mdi:clock-start
p2_holiday_on:
name: P2
has_time: true
initial: '09:00:00'
icon: mdi:clock-end
p3_holiday_on:
name: P3
has_time: true
initial: '13:00:00'
icon: mdi:clock-end
p4_holiday_on:
name: P4
has_time: true
initial: '15:00:00'
icon: mdi:clock-end
p5_holiday_on:
name: P5
has_time: true
initial: '17:00:00'
icon: mdi:clock-end
p6_holiday_on:
name: P6
has_time: true
initial: '19:00:00'
icon: mdi:clock-end
p7_holiday_on:
name: P7
has_time: true
initial: '20:00:00'
icon: mdi:clock-end
p8_holiday_on:
name: P8
has_time: true
initial: '22:00:00'
icon: mdi:clock-end
immersion_auto_on:
name: Imerrsion Auto On
has_time: true
initial: '19:00:00'
icon: mdi:clock-end
Automation.ymal
#-------------------Boost Automation-------------------------
- alias: boiler timed on
trigger:
- platform: state
entity_id: input_boolean.switch_boiler_timer
to: 'on'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: '{{ states.input_number.temp_boost.state }}'
id: 26cdd0087f934e38b4cdf050e6df5031
- alias: boiler timed off
trigger:
- platform: state
entity_id: input_boolean.switch_boiler_timer
to: 'off'
- platform: state
entity_id: input_boolean.switch_boiler_timer
to: 'on'
for:
minutes: '{{ states.input_number.boiler_timer.state | int }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_boiler_timer
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: '{{ states.input_number.t0_temp.state }}'
id: e08c0d734ef24fcc97e04643a71b60b1
#---------------------------Week timer Automation----------------------
- alias: weektimer_program
trigger:
- platform: state
entity_id: sensor.heating_program
condition:
- condition: state
entity_id: input_boolean.heating_master
state: 'on'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: '{% if is_state(''sensor.heating_program'', ''p1_weekday'') %}
{{ states.input_number.t1_work.state }} {% elif is_state(''sensor.heating_program'',
''p2_weekday'') %} {{ states.input_number.t2_work.state }} {% elif is_state(''sensor.heating_program'',
''p3_weekday'') %} {{ states.input_number.t3_work.state }} {% elif is_state(''sensor.heating_program'',
''p4_weekday'') %} {{ states.input_number.t4_work.state }} {% elif is_state(''sensor.heating_program'',
''p5_weekday'') %} {{ states.input_number.t5_work.state }} {% elif is_state(''sensor.heating_program'',
''p6_weekday'') %} {{ states.input_number.t6_work.state }} {% elif is_state(''sensor.heating_program'',
''p7_weekday'') %} {{ states.input_number.t7_work.state }} {% elif is_state(''sensor.heating_program'',
''p8_weekday'') %} {{ states.input_number.t8_work.state }} {% elif is_state(''sensor.heating_program'',
''p0_weekday'') %} {{ states.input_number.t0_temp.state }}
{% elif is_state(''sensor.heating_program'', ''p1_saturday'') %} {{ states.input_number.t1_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p2_saturday'') %} {{ states.input_number.t2_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p3_saturday'') %} {{ states.input_number.t3_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p4_saturday'') %} {{ states.input_number.t4_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p5_saturday'') %} {{ states.input_number.t5_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p6_saturday'') %} {{ states.input_number.t6_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p7_saturday'') %} {{ states.input_number.t7_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p8_saturday'') %} {{ states.input_number.t8_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p0_saturday'') %} {{ states.input_number.t0_temp.state
}}
{% elif is_state(''sensor.heating_program'', ''p1_holiday'') %} {{ states.input_number.t1_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p2_holiday'') %} {{ states.input_number.t2_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p3_holiday'') %} {{ states.input_number.t3_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p4_holiday'') %} {{ states.input_number.t4_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p5_holiday'') %} {{ states.input_number.t5_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p6_holiday'') %} {{ states.input_number.t6_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p7_holiday'') %} {{ states.input_number.t7_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p8_holiday'') %} {{ states.input_number.t8_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p0_holiday'') %} {{ states.input_number.t0_temp.state
}} {% endif %}'
id: c36e140dfbd04679bf7b4788fa4a6af9
- alias: temp_lock
trigger:
- platform: state
entity_id: sensor.hvac_temperature_knob
- platform: state
entity_id: input_boolean.heating_master
to: 'on'
condition:
- condition: state
entity_id: input_boolean.switch_boiler_timer
state: 'off'
- condition: state
entity_id: input_boolean.heating_master
state: 'on'
action:
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: '{% if is_state(''sensor.heating_program'', ''p1_weekday'') %}
{{ states.input_number.t1_work.state }} {% elif is_state(''sensor.heating_program'',
''p2_weekday'') %} {{ states.input_number.t2_work.state }} {% elif is_state(''sensor.heating_program'',
''p3_weekday'') %} {{ states.input_number.t3_work.state }} {% elif is_state(''sensor.heating_program'',
''p4_weekday'') %} {{ states.input_number.t4_work.state }} {% elif is_state(''sensor.heating_program'',
''p5_weekday'') %} {{ states.input_number.t5_work.state }} {% elif is_state(''sensor.heating_program'',
''p6_weekday'') %} {{ states.input_number.t6_work.state }} {% elif is_state(''sensor.heating_program'',
''p7_weekday'') %} {{ states.input_number.t7_work.state }} {% elif is_state(''sensor.heating_program'',
''p8_weekday'') %} {{ states.input_number.t8_work.state }} {% elif is_state(''sensor.heating_program'',
''p0_weekday'') %} {{ states.input_number.t0_temp.state }}
{% elif is_state(''sensor.heating_program'', ''p1_saturday'') %} {{ states.input_number.t1_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p2_saturday'') %} {{ states.input_number.t2_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p3_saturday'') %} {{ states.input_number.t3_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p4_saturday'') %} {{ states.input_number.t4_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p5_saturday'') %} {{ states.input_number.t5_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p6_saturday'') %} {{ states.input_number.t6_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p7_saturday'') %} {{ states.input_number.t7_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p8_Saturday'') %} {{ states.input_number.t8_sat.state
}} {% elif is_state(''sensor.heating_program'', ''p0_saturday'') %} {{ states.input_number.t0_temp.state
}}
{% elif is_state(''sensor.heating_program'', ''p1_holiday'') %} {{ states.input_number.t1_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p2_holiday'') %} {{ states.input_number.t2_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p3_holiday'') %} {{ states.input_number.t3_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p4_holiday'') %} {{ states.input_number.t4_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p5_holiday'') %} {{ states.input_number.t5_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p6_holiday'') %} {{ states.input_number.t6_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p7_holiday'') %} {{ states.input_number.t7_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p8_holiday'') %} {{ states.input_number.t8_sun.state
}} {% elif is_state(''sensor.heating_program'', ''p0_holiday'') %} {{ states.input_number.t0_temp.state
}} {% endif %}'
id: 47141d0a7f8d420885cd15bc3cbb5888
#-------------------------------Heat valve protection----------------
- id: '1577612881345'
alias: valves on
description: ''
trigger:
- entity_id: switch.700574032462ab3b7e49
from: 'off'
platform: state
to: 'on'
condition: []
action:
- service: climate.set_temperature
data_template:
entity_id: climate.bf0dca95cb90411960fl8n
temperature: '{{ states.input_number.temp_up.state }}'
- service: climate.set_temperature
data_template:
entity_id: climate.bfb4fbcb25305e7371a3yn
temperature: '{{ states.input_number.temp_down.state }}'
- id: '1577612972092'
alias: valves off
description: ''
trigger:
- entity_id: switch.700574032462ab3b7e49
from: 'on'
platform: state
to: 'off'
condition: []
action:
- service: climate.set_temperature
data_template:
entity_id: climate.bf0dca95cb90411960fl8n
temperature: '{{ states.input_number.t0_temp.state }}'
- service: climate.set_temperature
data_template:
entity_id: climate.bfb4fbcb25305e7371a3yn
temperature: '{{ states.input_number.t0_temp.state }}'
#---------------------Immersion Timer Automation------------------------------------
- id: '1578520268091'
alias: Immersion Timer
description: ''
trigger:
- entity_id: input_boolean.switch_immersion_timer
platform: state
to: 'on'
condition: []
action:
- service: climate.set_hvac_mode
entity_id: climate.hw_thermostat
data_template:
hvac_mode: "heat"
- service: climate.set_temperature
data_template:
entity_id: climate.hw_thermostat
temperature: '{{ states.input_number.immersion_temp.state }}'
- id: '1578521662871'
alias: Immersion timed off
trigger:
- platform: state
entity_id: input_boolean.switch_immersion_timer
to: 'off'
- platform: state
entity_id: input_boolean.switch_immersion_timer
to: 'on'
for:
minutes: '{{ states.input_number.immersion_timer.state | int }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_immersion_timer
- service: climate.set_hvac_mode
entity_id: climate.hw_thermostat
data:
hvac_mode: "off"
- id: '1578653513704'
alias: Immersion On Time
description: ''
trigger:
- platform: template
value_template: "{{ states.sensor.time.state == states.input_datetime.immersion_auto_on.state[0:5] }}"
condition: []
action:
- entity_id: input_boolean.switch_immersion_timer
service: input_boolean.turn_on