Tuya radiator valve (TS0601) calibration from external sensor (via zigbee2mqtt)

This one will react to a change that stays for 30’s

blueprint:
  name: Sync TRV tempature
  description: Sync external tempature sensor with TRV tempature
  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 badkamer_thermostat
description: ''

variables:
  target_device: !input 'ieeeaddressoftrv'
  climate_device: !input 'climate_name'
  temperature: !input 'external_temp'
  adjust: "{{state_attr(climate_device, 'current_temperature')}}"
trigger:
  - platform: state
    entity_id: !input 'external_temp'
    for: '00:00:30'
condition: []
action:
  - service: mqtt.publish
    data_template:
      topic: zigbee2mqtt/{{ target_device }}/set/local_temperature_calibration
      payload_template: >-
        {{states(temperature)|float(0) | round(1,'half') - (state_attr(climate_device,'current_temperature')|float(0) | round(1, 'half') - state_attr(climate_device,'local_temperature_calibration')|float(0) | round(1, 'half'))}}
mode: single
1 Like