Forked from mmackowiak/sync_trv_with_external_sensor.yaml
Last active
February 2, 2022 18:14
-
-
Save denysdovhan/24ddcfc1e35aba2a0e4e79d058d5d9ce to your computer and use it in GitHub Desktop.
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
# based on: https://community.home-assistant.io/t/tuya-radiator-valve-ts0601-calibration-from-external-sensor-via-zigbee2mqtt/337991 | |
# alternative: https://community.home-assistant.io/t/sync-trv-with-external-tempature-sensor/298024 | |
blueprint: | |
name: Calibrate TRV temperature | |
description: Temperature calibration for Zigbee valve TS0601, according to external temperature sensor | |
domain: automation | |
input: | |
valve: | |
name: Valve | |
selector: | |
entity: | |
domain: climate | |
temp_sensor: | |
name: Temperature Sensor | |
selector: | |
entity: | |
domain: sensor | |
device_class: temperature | |
mode: single | |
max_exceeded: silent | |
variables: | |
valve: !input valve | |
temp_sensor: !input temp_sensor | |
external_temp: "{{ states(temp_sensor) | float(0) | round(1, 'half') }}" | |
device_addr: "{{ state_attr(valve, 'device').ieeeAddr }}" | |
current_temp: "{{ state_attr(valve, 'current_temperature') | float(0) | round(1, 'half') }}" | |
local_calibration: "{{ state_attr(valve, 'local_temperature_calibration') | float(0) | round(1, 'half') }}" | |
trigger: | |
- platform: time_pattern | |
minutes: '/10' | |
- platform: state | |
entity_id: climate.living_room_heater | |
attribute: current_temperature | |
to: ~ | |
for: | |
seconds: 15 | |
- platform: state | |
entity_id: sensor.living_room_temperature | |
to: ~ | |
for: | |
seconds: 15 | |
condition: | |
condition: and | |
conditions: | |
- condition: template | |
value_template: "{{ states(valve) != 'unavailable' }}" | |
- condition: template | |
value_template: "{{ states(valve) != 'unknown' }}" | |
- condition: template | |
value_template: "{{ states(temp_sensor) != 'unavailable' }}" | |
- condition: template | |
value_template: "{{ states(temp_sensor) != 'unknown' }}" | |
- condition: template | |
value_template: '{{ external_temp - (current_temp - local_calibration) != local_calibration }}' | |
action: | |
- service: mqtt.publish | |
data_template: | |
topic: 'zigbee2mqtt/{{ device_addr }}/set/local_temperature_calibration' | |
payload_template: '{{ external_temp - (current_temp - local_calibration) }}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment