FEATURES
-
Week timer with 6 periods + night time per day, each with its own temperature.
-
3 different day type: Weekday timer (working days), saturday and holidays (sunday included). Holidays are automatically detected based on own country.
-
Switch to enable the week timer (Week timer switch). if it is enabled, heating temperature is automatically selected based on day and time. Manual temperature modification on thermostat temperature knob is inhibited to prevent accidental temperature change.
-
Tnight input: set the night temperature (after midnight and until the first period of the next day). Tnight is common for all the days (working, sat and holidays).
-
Heating timer: timer to turn on heating manually for a predetermined time (the “Minutes” input below). When enabled it is possible to select desired temperature in the thermostat knob. Week timer settings are overrided. At the end of the Heating timer temperature is set accordingly to the week timer current period. Heating timer can be switched off in any moment.
-
Heating lock Timer: timer to turn off heating for a desired time (the “Minutes” input below). It is useful in case you have to open doors or windows unless you have sensors on them. When enabled thermostat is turned off completely, Week timer and Heating Timer are overrided. At the end of the Heating lock timer temperature is set accordingly to the week timer current period. Heating lock timer can be switched off in any moment.
I know related yaml may seem long and articulated, but after you write/copy it, you can forget it and enjoy with the lovelace UI.
Add below code to your configuration(s) file(s) leaving commented lines:
climate:
- platform: generic_thermostat
name: HA thermo
heater: YOUR HEATER DEVICE
target_sensor: YOUR TEMPERATURE SENSOR
min_temp: 5
max_temp: 21
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
Above you have to set your heater device (see ‘heater’) and your temperature sensor (target_sensor).
binary_sensor:
- platform: workday
country: 'IT'
name: 'workday_today'
workdays: [mon, tue, wed, thu, fri, sat]
excludes: [sun, holiday]
Above you have to set your country
input_number: # input number
t0_temp:
name: T night
min: 5
max: 20
step: 0.1
mode: box
icon: mdi:home-thermometer
t1_work: # temperature preset T1
name: T1
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t2_work: # temperature preset T2
name: T2
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t3_work: # temperature preset T3
name: T3
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t4_work: # temperature preset T4
name: T4
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t5_work: # temperature preset T4
name: T5
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t6_work: # temperature preset T4
name: T6
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t1_sat: # temperature preset T1
name: T1
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t2_sat: # temperature preset T2
name: T2
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t3_sat: # temperature preset T3
name: T3
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t4_sat: # temperature preset T4
name: T4
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t5_sat: # temperature preset T4
name: T5
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t6_sat: # temperature preset T4
name: T6
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t1_sun: # temperature preset T1
name: T1
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t2_sun: # temperature preset T2
name: T2
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t3_sun: # temperature preset T3
name: T3
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t4_sun: # temperature preset T4
name: T4
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t5_sun: # temperature preset T4
name: T5
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
t6_sun: # temperature preset T4
name: T6
min: 5
max: 25
step: 0.1
mode: box
icon: mdi:home-thermometer
caldaia_timer: # set time for manual heating start
name: Minutes
initial: 60
min: 10
max: 240
step: 1
mode: box
icon: mdi:timer-sand
heating_lock_timer: # set time for heating lock
name: Minutes
initial: 60
min: 10
max: 240
step: 1
mode: box
icon: mdi:timer-sand
input_boolean:
heating_master: # if ON enable heating week timer
name: Week timer
icon: mdi:av-timer
switch_caldaia_timer: # if ON start heating for xxx minutes (input_number.caldaia_timer). Override week timer.
name: Heating Timer
initial: off
icon: mdi:radiator
switch_heating_lock_timer: # if ON lock heating for xxx minutes (input_number.heating_lock_timer). Override week timer.
name: Heating lock Timer
initial: off
icon: mdi:radiator-off
sensor:
- platform: time_date
display_options:
- 'time'
- 'date'
- 'date_time'
- 'date_time_iso'
- 'time_date'
- 'time_utc'
- 'beat'
- platform: template
sensors:
heating_program:
friendly_name: "Heating Program"
value_template: >- # ok 141119
{% if is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p1_weekday_on.state <= states.sensor.time.state <= states.input_datetime.p2_weekday_on.state) %} p1_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p2_weekday_on.state <= states.sensor.time.state <= states.input_datetime.p3_weekday_on.state) %} p2_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p3_weekday_on.state <= states.sensor.time.state <= states.input_datetime.p4_weekday_on.state) %} p3_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p4_weekday_on.state <= states.sensor.time.state <= states.input_datetime.p5_weekday_on.state) %} p4_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p5_weekday_on.state <= states.sensor.time.state <= states.input_datetime.p6_weekday_on.state) %} p5_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( states.input_datetime.p6_weekday_on.state <= states.sensor.time.state < '23:59') %} p6_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (0,1,2,3,4)) and ( '00:00' <= states.sensor.time.state <= states.input_datetime.p1_weekday_on.state) %} p0_weekday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p1_saturday_on.state <= states.sensor.time.state <= states.input_datetime.p2_saturday_on.state) %} p1_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p2_saturday_on.state <= states.sensor.time.state <= states.input_datetime.p3_saturday_on.state) %} p2_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p3_saturday_on.state <= states.sensor.time.state <= states.input_datetime.p4_saturday_on.state) %} p3_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p4_saturday_on.state <= states.sensor.time.state <= states.input_datetime.p5_saturday_on.state) %} p4_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p5_saturday_on.state <= states.sensor.time.state <= states.input_datetime.p6_saturday_on.state) %} p5_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( states.input_datetime.p6_saturday_on.state <= states.sensor.time.state <= '23:59') %} p6_saturday
{% elif is_state('binary_sensor.workday_today', 'on') and (now().weekday() in (5,)) and ( '00:00' <= states.sensor.time.state <= states.input_datetime.p1_saturday_on.state) %} p0_saturday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p1_holiday_on.state <= states.sensor.time.state <= states.input_datetime.p2_holiday_on.state) %} p1_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p2_holiday_on.state <= states.sensor.time.state <= states.input_datetime.p3_holiday_on.state) %} p2_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p3_holiday_on.state <= states.sensor.time.state <= states.input_datetime.p4_holiday_on.state) %} p3_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p4_holiday_on.state <= states.sensor.time.state <= states.input_datetime.p5_holiday_on.state) %} p4_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p5_holiday_on.state <= states.sensor.time.state <= states.input_datetime.p6_holiday_on.state) %} p5_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( states.input_datetime.p6_holiday_on.state <= states.sensor.time.state <= '23:59') %} p6_holiday
{% elif is_state('binary_sensor.workday_today', 'off') and ( '00:00' <= states.sensor.time.state <= states.input_datetime.p1_holiday_on.state) %} p0_holiday
{% endif %}
- platform: template # sensore che rileva variazioni della temperature impostata nel HA termostato
sensors:
hvac_temperature_knob:
value_template: "{{ states.climate.ha_thermo.attributes.temperature }}"
input_datetime:
p1_weekday_on:
name: P1 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-start
p2_weekday_on:
name: P2 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p3_weekday_on:
name: P3 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p4_weekday_on:
name: P4 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p5_weekday_on:
name: P5 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p6_weekday_on:
name: P6 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p1_saturday_on:
name: P1 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-start
p2_saturday_on:
name: P2 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p3_saturday_on:
name: P3 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p4_saturday_on:
name: P4 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p5_saturday_on:
name: P5 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p6_saturday_on:
name: P6 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p1_holiday_on:
name: P1 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-start
p2_holiday_on:
name: P2 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p3_holiday_on:
name: P3 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p4_holiday_on:
name: P4 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p5_holiday_on:
name: P5 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
p6_holiday_on:
name: P6 ON
has_time: true
#initial: '10:00:00'
icon: mdi:clock-end
automation:
- alias: 'caldaia temporizzata on'
trigger:
- platform: state
entity_id: input_boolean.switch_caldaia_timer
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_heating_lock_timer
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: 19.5
- alias: 'caldaia temporizzata off'
trigger:
- platform: state
entity_id: input_boolean.switch_caldaia_timer
to: 'off'
- platform: state
entity_id: input_boolean.switch_caldaia_timer
to: 'on'
for:
minutes: '{{ states.input_number.caldaia_timer.state | int }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_caldaia_timer
- service: climate.set_temperature
data_template:
entity_id: climate.ha_thermo
temperature: '{{ states.input_number.t0_temp.state }}'
# *********************************** Heating lock timer automation ***********************************
- alias: 'Heating lock Timer On'
trigger: # when Lock switch is turned on, heating is put in away mode
- platform: state
entity_id: input_boolean.switch_heating_lock_timer
to: 'on'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_caldaia_timer
- service: climate.set_hvac_mode
data:
entity_id: climate.ha_thermo
hvac_mode: 'off'
- alias: 'Heating lock Timer'
trigger:
- platform: state
entity_id: input_boolean.switch_heating_lock_timer
to: 'off'
- platform: state
entity_id: input_boolean.switch_heating_lock_timer
to: 'on'
for:
minutes: '{{ states.input_number.heating_lock_timer.state | int }}'
action:
- service: input_boolean.turn_off
entity_id: input_boolean.switch_heating_lock_timer
- service: climate.set_hvac_mode
data:
entity_id: climate.ha_thermo
hvac_mode: 'heat'
- alias: weektimer_program # weektimer
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', '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', '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', 'p0_holiday') %} {{ states.input_number.t0_temp.state }}
{% endif %}
- alias: temp_lock # **************************** avoid temp change in thermostat knob - weektimer rev.2
trigger:
- platform: state # rileva variazione di un template sensor creato appositamente per vedere lo stato dell'attributo temp set del termostato
entity_id: sensor.hvac_temperature_knob
- platform: state # quando attivo il modo auto risetto le temperature
entity_id: input_boolean.heating_master
to: 'on'
condition:
- condition: state
entity_id: input_boolean.switch_caldaia_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', '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', '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', 'p0_holiday') %} {{ states.input_number.t0_temp.state }}
{% endif %}
LOVELACE CARDS
entities:
- entity: input_boolean.heating_master
- entity: input_number.t0_temp
name: 'Tnight (00:00<time<P1)'
- entity: input_boolean.switch_caldaia_timer
- entity: input_number.caldaia_timer
- entity: input_boolean.switch_heating_lock_timer
- entity: input_number.heating_lock_timer
show_header_toggle: false
type: entities
entities:
- entity: input_datetime.p1_weekday_on
- entity: input_number.t1_work
- entity: input_datetime.p2_weekday_on
- entity: input_number.t2_work
- entity: input_datetime.p3_weekday_on
- entity: input_number.t3_work
- entity: input_datetime.p4_weekday_on
- entity: input_number.t4_work
- entity: input_datetime.p5_weekday_on
- entity: input_number.t5_work
- entity: input_datetime.p6_weekday_on
- entity: input_number.t6_work
show_header_toggle: false
title: Weekday timer
type: entities
entities:
- entity: input_datetime.p1_saturday_on
- entity: input_number.t1_sat
- entity: input_datetime.p2_saturday_on
- entity: input_number.t2_sat
- entity: input_datetime.p3_saturday_on
- entity: input_number.t3_sat
- entity: input_datetime.p4_saturday_on
- entity: input_number.t4_sat
- entity: input_datetime.p5_saturday_on
- entity: input_number.t5_sat
- entity: input_datetime.p6_saturday_on
- entity: input_number.t6_sat
show_header_toggle: false
title: Saturday timer
type: entities
entities:
- entity: input_datetime.p1_holiday_on
- entity: input_number.t1_sun
- entity: input_datetime.p2_holiday_on
- entity: input_number.t2_sun
- entity: input_datetime.p3_holiday_on
- entity: input_number.t3_sun
- entity: input_datetime.p4_holiday_on
- entity: input_number.t4_sun
- entity: input_datetime.p5_holiday_on
- entity: input_number.t5_sun
- entity: input_datetime.p6_holiday_on
- entity: input_number.t6_sun
show_header_toggle: false
title: Holiday timer
type: entities
END