-
-
Save bklaesener/e836e1fbd37cdfb42d9b9672be29c92c to your computer and use it in GitHub Desktop.
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 |
thanks @bklaesener for this change, I will also change it in my blueprint since HAOS is now only talking from -9 uptill 9. So good change!
@bruvv, Ideally, the max/min values and increments (1 or 0.5) should be user-selectable when setting up the automation. If either of us finds the time...
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
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.
@mediaNen please use this: https://github.com/KartoffelToby/better_thermostat
The Blueprint is optimized for the Moes BRT-100-TRV with a calibration range of -9 to 9 in full increments.
The original blueprint did not work with this device as it provided for adding the current value of the calibration to the newly measured temperature delta. This resulted in a "race to the bottom" where the calibration was continuously adjusted downward, and soon MQTT appeared overwhelmed with messages, resulting in my Zigbee devices becoming unresponsive. That behavior was observed by other users, as well. The optimized blueprint therefore does not add the current calibration value to the temperature delta.
The new calibration value is also capped at the -9 minimum. There is no cap at the maximum, as this does not appear to be a practical scenario.
In order to prevent excessive MQTT traffic caused by repeatedly setting the minimum calibration value (in case the actual temperature delta is lower than the minimum), the blueprint checks whether the minimum calibration setting of -9 has already been reached and in that case only proceeds if the new calibration setting would be above -9.