TRV Calibrator - Calibrate your valve with an external sensor (probably TRV agnostic)

@tbandras I really doubt to be honest. BT afaik goes beyond just calibrate the valve but also operate it somehow.

I’m not sure how exactly they do that but in my experience each valve works differently which makes things really complicate. In my case, after a lot of attempts I ended up using my valve as a on/off switch and now I’m using the generic thermostat to control it.

1 Like

Hi Felipe, can u maybe help me out. I am bit of a noob. But the next happened. I imported your blueprint, because i also have the same trv. So i followed the blueprint but the automation was not visible in my automations, so i tried again and still not there so i search in entities and there they where. So i did not know if it was working properly and everything so i changed the id and everything, i tried to delete the entities, but i can’t delete them anymore. I deleted the blueprint and tried again by manually filling in the automation with yaml, and now i have 2 automations and 2 entities i can’t delete anymore. I already deleted the device from Z2M, and tried again, but still not working. Can u explain how to delete those and can you shortly explain, what should happen when filling in the blueprint, and how i can check how it works. And can i just use the thermostat card like before? Sorry for the trouble

Hey Serot. Blueprints don’t create any entity but just an automation.

If you can’t remove the entity go to Developer Tools > Statistics, it will display all the issues and give a one click solution.

If you want to start fresh I’d remove the device and add again. If you are using Z2M you should remove the device there first not in home assistant.

Just realized that you may be talking about the automation entity. You should go to logs and check why the blueprint failed to start. HA just don’t display the automation if for some reason it’s misconfigured and the blueprint fails to load.

The hack to access those failed blueprints is through the automation yamls. You can change it directly there (restart required) or get the automation id and manipulate the url to get to the automation.

I.E.: https://your-ha-address/config/automation/edit/1666513059312 (you can replace those numbers with the automation id from the automations.yaml).

For reference, this is my configuration:

alias: Bedroom TRV Calibrator
description: ""
use_blueprint:
  path: rotilho/trv_calibrator.yaml
  input:
    trv: climate.bedroom_trv
    temperature_sensor: sensor.bedroom_temperature
    trv_calibration_number: number.bedroom_trv_local_temperature_calibration

Hi thanks for your respond, i will try that. I had them already deleted in the config and rebooted more then 20 times, but they don’t dissappear. But i deleted the tvr from z2m, re added and gave it a different name, and tried it again. Now it seems to like to work, but i dont get how many times it requests a calibration. It also has to do with the fact i think, that the calibration of 5 degrees is not enough in my case. The difference is more, but it seems limited to 5 degrees. Is there any fix for this? Because i turned of the trv before sleeping and when i came to the room in the morning it was 21,5 degrees or so and the temperature sensor was showing 16,21 so it turned it self on because of the calibration is off i think

There’s a limit and for this sensor it’s 5 degrees. You can check the in the developer tools the max and min the calibration number can go.

I changed it in the developer tool, at the state, he accepts it, but does not actually apply it in the ui or z2m settings. I also rebooted HA a couple times, but unfortunately no difference.

You can’t change it, it’s for reference. Each device has a max/min.

Ok, thank u for your hard work and explanations!

Hello Felipe,
Thank you for your great work.
Before discovering your blueprint I’ve been using a complex automation compensating the TRV measured temperature with an external sensor and explaining to my family that I’m not in fact trying to warm the room to 33 degrees or whatever…
One question - I can see that you’re using a change in the state of any of the variables. Doesn’t this happen too often? Have you considered limiting this to lets say changes above 0.5 degrees or something similar to save battery life?

That’s something I pondered while developing this blueprint. Initially, there were a bunch of parameters, and “minimal difference” was one of them.

Later, I realized that the engine is the most likely thing that drains the battery, not the Zigbee exchanging messages (just a guess, I didn’t test this hypothesis). So, I reduced the complexity of the blueprint.

The blueprint was still quite smart and only updated when the minimal difference was above twice the calibration step (i.e., if the calibration step is 0.1, the temperature difference should be above 0.2 to trigger an update). However, I had to evaluate a lot of parameters much earlier, causing sometimes a race condition.

The blueprint now always updates when there’s an update as you pointed out, but so far, this seems to work quite okay. My TRV is working fine for about 8 months and my expectation is that it should work 10 more months. If I get much shorter life I’ll definitely tweak the blueprint.

Btw, it worth to mention that my TRV is quite dumb and I ended up using it as on/off so the blueprint is just for correctness, I don’t really need the calibration to operate my valve.

Do you mean 8 months on the same set of batteries?
My TS0601s flash the ‘low battery’ light after about ~2 weeks on a pair of re-chargable eneloop AAs :frowning:

rechargeable s always have less power according to couple manufacturers

They usually give out 1,2v versus 1,5 for alkaline even when fully charged so this should be expected

Yep, same battery.

Awesome blueprint and this is exactly what I need! However, I’m getting errors. Looks like my TRV’s (TuYa TS0601_thermostat) can only be calibrated with stepsize 1 but the automation sends a float. How can I adjust this?
This is the error I get in the log:

Error while executing automation automation.trv_calibrator_woonkamer_voorzijde: Error rendering data template: ValueError: Template error: float got invalid input ‘unavailable’ when rendering template ‘{% set room_temperature = states(temperature_sensor) | float %} {% set trv_temperature = state_attr(trv, “current_temperature”) | float(0) %} {% set trv_calibration = states(trv_calibration_number) | float %} {% set trv_calibration_min = state_attr(trv_calibration_number, “min”) | float(-5) %} {% set trv_calibration_max = state_attr(trv_calibration_number, “max”) | float(5) %} {% set trv_calibration_step = state_attr(trv_calibration_number, “step”) | float(1) %} {% set step = trv_calibration_step | string %} {% if step.split(".") | length > 1 -%} {% set trv_calibration_step_decimals = step.split(".")[1] | length %} {%- else -%} {% set trv_calibration_step_decimals = 0 %} {%- endif %} {% set new_trv_calibration = room_temperature - trv_temperature + trv_calibration %} {% set new_trv_calibration_bounded = [ [ (new_trv_calibration - new_trv_calibration % trv_calibration_step) | round(trv_calibration_step_decimals), trv_calibration_min ] | max, trv_calibration_max ] | min %} {% if new_trv_calibration_bounded < trv_calibration - trv_calibration_step or trv_calibration + trv_calibration_step < new_trv_calibration_bounded -%} {{ new_trv_calibration_bounded }} {%- else -%} {{ states(trv_calibration_number) }} {%- endif %}’ but no default was specified

The blueprint uses the step provided by the calibration number, I suspect it may have some misalignment. Can you post it here together with the blueprint configuration?

It should be something like that:

number.living_room_trv_local_temperature_calibration

min: -5
max: 5
step: 0.1
mode: auto
unit_of_measurement: °C
device_class: temperature
icon: mdi:math-compass
friendly_name: Living Room TRV local temperature calibration

blueprint

alias: Living Room TRV Calibrator
description: ""
use_blueprint:
  path: rotilho/trv_calibrator.yaml
  input:
    trv: climate.living_room_trv
    temperature_sensor: sensor.ground_floor_temperature
    trv_calibration_number: number.living_room_trv_local_temperature_calibration

Hello, I just came across this post. I was a Better thermostat user but unluckily it never worked fine for me, too many bugs. So I’m testing your blueprint, but I have a problem, I have HAMA TRV which are really bad coded, they could have as much as a tolerance of 2°C which means they never open or close before external temperature is ever reached. Is there a way to fix this issue?
Thanks!

I have Hama (Tuya) TRV TS0601 TZE200_h4cgnbzg but my TRV is not listed in the blueprint. My TRV supports calibration.

I have removed the device_class: temperature for “number” now i can see my offset for the TRV

1 Like