I installed around 25 inexpensive Zigbee GTZ06 thermostats.
I wanted to group the radiators, but the solutions I found didn’t work well for me. I also wanted the thermostats to use an external temperature sensor. After trying a few existing addons without success, I decided to create a simple automation.
This automation, which can run every minute (or at any interval you prefer), checks each radiator’s internal temperature and the temperature from its assigned external sensor. It then adjusts the offset (calibration value) to align them.
I set up the Scheduler to handle desired temperature changes. After testing the whole setup for 48 hours, it works effectively.
You can use one external sensor for multiple thermostats without needing to group them.
alias: Adjust thermostats offsets with external temp sensors
description: >-
Version 1.1
thermostat - thermostat entity
calibration - thermostat's offset value
sensor_exte - external sensor's temperature value
New offset is calculated as: external_sensor_temp - thermostat_actual_temp.
Since the thermostat's actual temperature (before offset) is not available as an
attribute, it must be calculated (current_temp - current_offset). Therefore,
the equation for the new offset is: external_sensor_temp - (current_temp -
current_offset).
If the external sensor returns an unknown value, the script sets the offset to 0
(using the internal temp sensor). The default float value for
external_sensor_temp is set to float(current_temp - current_offset), so in that
case, the equation is: (current_temp - current_offset) - (current_temp -
current_offset) = 0.
The offset must be rounded to 1 decimal place.
trigger:
- platform: time_pattern
minutes: /1
action:
- repeat:
for_each:
- thermostat: climate.termostat1
calibration: number.termostat1_local_temperature_calibration
sensor_exte: sensor.room1_temperature
- thermostat: climate.termostat2
calibration: number.termostat2_local_temperature_calibration
sensor_exte: sensor.room1_temperature
- thermostat: climate.termostat3
calibration: number.termostat3_local_temperature_calibration
sensor_exte: sensor.room2_temperature
sequence:
- service: number.set_value
data:
entity_id: "{{ repeat.item.calibration }}"
value: >
{{ (states(repeat.item.sensor_exte) |
float((state_attr(repeat.item.thermostat, 'current_temperature') |
float -
states(repeat.item.calibration) | float)) -
(state_attr(repeat.item.thermostat, 'current_temperature') | float -
states(repeat.item.calibration) | float)) | round(1) }}
To monitor each thermostat’s performance, I added a template sensor in YAML (which is faster to add in batch than using a helper).
template:
- sensor:
- name: "thermostat1 External Sensor Diff"
unit_of_measurement: "°C"
state: >
{{ ( state_attr('climate.termostat1', 'current_temperature') | float - states('sensor.temp_sensor') | float ) | round(1) }}
Then, you can set a filtered view to show only devices that are off by 0.2 degrees or more, which could signal a problem or just an open window/door. This will be corrected after the next repeat. Setting show_empty to false will hide the card if all entities are within range.
type: entity-filter
entities:
- sensor.thermostat1_external_sensor_diff
- sensor.thermostat2_external_sensor_diff
- sensor.thermostat3_external_sensor_diff
- sensor.thermostat4_external_sensor_diff
state_filter:
- operator: '>='
value: 0.2
- operator: <=
value: -0.2
card:
type: entities
title: Thermostats off by more than 0.2 degree
show_empty: false
Additionally, you can track the differences over time to identify any potential issues. I created a history view with all of them, including 1-hour and 24-hour views.