Here is something else you can take away for potential diagnostics too:
alias: Heating Timer
description: Make sure heating doesn't run longer than 2 hours.
trigger:
- platform: event
id: timer_finish
event_type: timer.finished
event_data:
entity_id: timer.heating_timer
- platform: state
entity_id: switch.house_boiler
id: heating_off
to: 'off'
- platform: state
entity_id: switch.house_boiler
id: heating_on
to: 'on'
condition: []
action:
- choose:
- conditions:
- condition: trigger
id: heating_on
sequence:
- service: timer.cancel
target:
entity_id: timer.heating_timer
- service: timer.start
data:
duration: '02:00:00'
target:
entity_id: timer.heating_timer
- conditions:
- condition: trigger
id: heating_off
sequence:
- service: timer.cancel
target:
entity_id: timer.heating_timer
- conditions:
- condition: trigger
id: timer_finish
sequence:
- choose:
- conditions:
- condition: template
value_template: >-
{% set presence =
states('binary_sensor.livingroom_presence') %}
{{ presence == 'off' }}
sequence:
- service: notify.tg_house_group
data:
title: Heating Temperature Reset!
message: >
{% set ct =
state_attr('climate.lower_house','current_temperature')|float(0)
%}
{% set tt =
state_attr('climate.lower_house','temperature')|float(0)
%}
{% set nt = (ct - 0.4)|round(1) %}
The house heating has been running for longer than 2
hours!
The target temperature was {{ tt }}C and the current
temperature is now {{ ct }}C.
The new target temperature has been reset to {{ nt }}C
- service: climate.set_temperature
target:
entity_id: climate.lower_house
data:
temperature: >-
{% set ct =
state_attr('climate.lower_house','current_temperature')|float(0)
%} {% set tt = (ct - 0.4)|round(1) %} {{ tt }}
default:
- service: timer.start
data:
duration: '00:15:00'
target:
entity_id: timer.heating_timer
- service: notify.tg_house_group
data:
title: Heating Temperature Max Runtime!
message: >
{% set ct =
state_attr('climate.lower_house','current_temperature')|float(0)
%}
{% set tt =
state_attr('climate.lower_house','temperature')|float(0) %}
The house heating has been running for longer than 2 hours!
The target temperature was {{ tt }}C and the current
temperature is now {{ ct }}C.
Presence was detected in the Living Room, so the timer has
been reset.
default: []
mode: single
So the background to this, is that lately I have been waking up to find that the heating has been running for 6 hours overnight. Obviously this is expensive, but also pointless because if it hasn’t heated the house in 2 hours, it’s never going to. So I now have a timer that is started when the heating turns on, it is cancelled when the heating turns off. If however the timer reaches it’s 2 hour runtime (AND the livingroom is not occupied), then the target temperature is changed to the current temperature - 0.4C which ensures that the heating will turn off.
Because I use Schedy in appdaemon, the automatic temperature control will kick back in after 2 hours.