Hi,
As my zigbee TRV’s sometimes don’t register the command that HA sends I’m trying to make some kind of check so my heater isn’t burning for hours while the TRV is closed.
What it’s supposed to do:
When the thermostat goes from idle to heating, the TRV’s temperature should go from 5° to 30°. The opposite happens when the thermostat goes from heating to idle. This works perfectly (with a bit of overshooting but that’s not the issue here).
What I want to accomplish:
When I’m sending the change in temperature to the TRV, HA should check after let’s say 5min if the TRV’s temperature is set to 30°, if not it should retry setting the temperature. I want to repeat this twice. If the temperature isn’t 30° after the total of 3 attempts, HA should put the thermostat from heating to idle (stopping the heater from burning without purpose) and send a notification to my phone that the TRV isn’t responding and that the thermostat is turned off.
Via the HA facebook group someone made me this script:
alias: Slaapkamer ClimateTRV Aan
description: ''
trigger:
- platform: state
entity_id: climate.slaapkamer
attribute: hvac_action
from: idle
to: heating
condition: []
action:
- service: climate.set_temperature
data:
temperature: 30
entity_id: climate.trv_slaapkamer
- alias: >-
Check every 5 mins for TRV to not be 30, repeat twice if needed, then
notify
repeat:
while:
- condition: template
value_template: '{{ state_attr(''climate.trv_slaapkamer'', ''temperature'') != 30 }}'
- condition: template
value_template: '{{ repeat.index <= 2 }}'
sequence:
choose:
- conditions:
- condition: template
value_template: '{{ repeat.index == 2 }}'
sequence:
- service: notify.mobile_app_iphone
data:
message: >-
De radiatorkraan heeft 2x niet gereageerd! De verwarming is
uitgeschakeld in de slaapkamer!
- service: climate.turn_off
target:
entity_id: climate.slaapkamer
default:
- service: climate.set_temperature
data:
temperature: 30
entity_id: climate.trv_slaapkamer
- delay: '00:05:00'
mode: single
However there are some issues with the code.
- Somehow it does not reattempt to set the temperature to 30° but it immediately send a notification after 5min and it does not change the thermostat from heating to idle.
- Sometimes it just doesn’t do anything at all and the heater keeps on burning while the TRV is set at 5° and I’m not getting a notification.
This script is way over my capabilities to adapt it so I’m hoping that someone will be able to push me in the right direction.
Thanks in advance!