Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bklaesener/e836e1fbd37cdfb42d9b9672be29c92c to your computer and use it in GitHub Desktop.
Save bklaesener/e836e1fbd37cdfb42d9b9672be29c92c to your computer and use it in GitHub Desktop.
Sync TRV with external sensor blueprint
blueprint:
name: Sync TRV temperature
description: Sync external temperature sensor with TRV temperature
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
selector:
entity:
domain: sensor
device_class: temperature
climate_name:
name: Climate entry
description: This will be the TRV it self in home assistant
selector:
entity:
domain: climate
alias: Calibrate Thermostat
description: ''
variables:
target_device: !input 'ieeeaddressoftrv'
climate_device: !input 'climate_name'
external_temperature: !input 'external_temp'
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: "{{ state_attr(climate_device,'local_temperature_calibration')|float(0) | round(0) !=( states(external_temperature)|float(0) | round(1) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) }}"
- condition: or
conditions:
- condition: template
value_template: "{{ state_attr(climate_device,'local_temperature_calibration')|float(0) | round(0) >-9 }}"
- condition: template
value_template: "{{ (states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) >-9 }}"
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,'local_temperature')|float(0) | round(0))*((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0))>=-9)+((states(external_temperature)|float(0) | round(0) - state_attr(climate_device,'local_temperature')|float(0) | round(0)) <-9)*-9}}
- delay: 5
mode: single
max_exceeded: silent
@bruvv
Copy link

bruvv commented Apr 8, 2022

If someone is able to do it yes but for now I will not be able to do it since I am not using it anymore

@mediaNen
Copy link

I have added the blueprint to HASS and run it and the log shows that its running fine. Do I have to setup an automation for it to to run this or will it run by itself? Sorry if this is perhaps to easy, but I am quite new and these moes thermostats are overshooting like crazy, so wanted to give this a try.

@bruvv
Copy link

bruvv commented Nov 14, 2022

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment