Forked from bruvv/sync_trv_with_external_temp_sensor.yaml
Last active
December 13, 2022 14:53
-
-
Save sorryusernameisalreadytaken/0e0ac8502e7349f8c9a579b130e0b0c7 to your computer and use it in GitHub Desktop.
Sync TRV SEA802-Z01 with external sensor blueprint
This file contains hidden or 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
blueprint: | |
name: Sync TRV temperature for SEA802-Z01 | |
description: Sync external temperature sensor with TRV temperature for SEA802-Z01 with a temp-calibration range of -6 to +6. | |
domain: automation | |
input: | |
ieeeaddressoftrv: | |
name: IEEE Address | |
description: This is the address of the TRV found in your zigbee database. Example 0x459877fffe1f2e83 | |
external_temp: | |
name: Select the external temp sensor | |
description: This will be your external temp sensor. Example sensor.ble_temperature_2821 | |
selector: | |
entity: | |
domain: sensor | |
device_class: temperature | |
climate_name: | |
name: Climate entry | |
description: This will be the TRV it self in home assistant. Example climate.valve_1 | |
selector: | |
entity: | |
domain: climate | |
external_climate_calib: | |
name: Select the temperature_calibration of your climate-trv | |
description: This will be your TRV temp sensor calibration. Example number.valve_1_local_temperature_calibration | |
alias: Calibrate Thermostat | |
description: '' | |
variables: | |
target_device: !input 'ieeeaddressoftrv' | |
climate_device: !input 'climate_name' | |
external_temperature: !input 'external_temp' | |
external_climate_calibration: !input 'external_climate_calib' | |
adjust: "{{state_attr(climate_device, 'current_temperature')}}" | |
trigger: | |
- platform: state | |
entity_id: !input 'external_temp' | |
for: | |
hours: 0 | |
minutes: 0 | |
seconds: 15 | |
milliseconds: 0 | |
- platform: state | |
entity_id: !input 'climate_name' | |
for: | |
hours: 0 | |
minutes: 0 | |
seconds: 15 | |
milliseconds: 0 | |
condition: | |
condition: and | |
conditions: | |
- condition: template | |
value_template: "{{ states(external_temperature) != 'unavailable' }}" | |
- condition: template | |
value_template: "{{ states(external_temperature) != 'unknown' }}" | |
- condition: template | |
value_template: "{{ states(external_climate_calibration) != 'unavailable' }}" | |
- condition: template | |
value_template: "{{ states(external_climate_calibration) != 'unknown' }}" | |
- condition: template | |
value_template: "{{ states(external_climate_calibration)|float(0) | round(0) !=( states(external_temperature)|float(0) | round(1) - state_attr(climate_device,'current_temperature')|float(0) | round(0)) }}" | |
- condition: or | |
conditions: | |
- condition: template | |
value_template: "{{ states(external_climate_calibration)|float(0) | round(0) >-6 }}" | |
- condition: template | |
value_template: "{{ (states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'current_temperature')|float(0) | round(0)) >-6 }}" | |
action: | |
- service: mqtt.publish | |
data_template: | |
topic: zigbee2mqtt/{{ target_device }}/set/local_temperature_calibration | |
payload_template: >- | |
{{(states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'current_temperature')|float(0) | round(0))*((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'current_temperature')|float(0) | round(0))>=-6)+((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'current_temperature')|float(0) | round(0)) <-6)*-6}} | |
- delay: 5 | |
mode: single | |
max_exceeded: silent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment