Apologies if this is in the wrong place, as it’s a feature request for the existing Tado integration.
The Tado integration is useful, but doesn’t include the functionality to change the thermostat offset, although it is available via the Tado API. The advantage of doing this is that it allows a separate (DIY / cheap) room thermostat to be used away from, and unaffected by, the direct heat from the radiator.
There would need to be 2 additions - an extra ‘sensor’ that contained the current offset for a device, and a service that would put the offset to a device.
If it helps the explanation, at present I’m doing it in a very clunky way using cURL in a command line sensor to both get the existing offset, and put the desired one.
Below is how I’ve bodged it in my config - sadly I have no knowledge of Python (yet…). The sensor “sensor.front_bedroom_temperature_display” is my separate MQTT sensor.
I use some automations to call the service that updates sensor.tado_front_bedroom_put_offset
whenever ‘sensor.front_bedroom_offset_difference’ is out by enough to warrant sending, rather than just on a timed basis.
# Tado login, retrieve token - as attribute, due to length. Scope used as value arbitrarily
- platform: command_line
name: Tado Auth
scan_interval: 500
json_attributes:
- access_token
- token_type
- refresh_token
- expires_in
- scope
- jti
command: 'curl -s "https://auth.tado.com/oauth/token" -d client_id=tado-web-app -d grant_type=password -d scope=home.user -d username="********" -d password="*******" -d client_secret=*******************'
value_template: '{{ value_json.scope }}'
############################ Front Bedroom #####################################
# Get Temperature Offset from Tado
- platform: command_line
name: Tado_Front_Bedroom_Offset
scan_interval: 120
unit_of_measurement: '°C'
json_attributes:
- celsius
- fahrenheit
command: 'curl -s "https://my.tado.com/api/v2/devices/VA*******/temperatureOffset" -H "Authorization: Bearer {{ state_attr(''sensor.tado_auth'', ''access_token'') }}"'
value_template: '{{ value_json.celsius }}'
# Calculate radiator temperature
- platform: template
sensors:
front_bedroom_radiator:
friendly_name: "Tado Front Bedroom Radiator Sensor"
unit_of_measurement: '°C'
value_template: "{{ ((states('sensor.front_bedroom_temperature_2')|float ) - (state_attr('sensor.tado_front_bedroom_offset','celsius')|float))|round(2)}}"
# Calculate radiator offset required
- platform: template
sensors:
front_bedroom_calculated_offset:
friendly_name: "Front Bedroom Calculated Offset"
unit_of_measurement: '°C'
value_template: "{% if (states('sensor.front_bedroom_temperature_display')|float ) > 0 -%} {{((states('sensor.front_bedroom_temperature_display')|float ) - (states('sensor.front_bedroom_radiator')|float))| round(2)}} {%- else -%} 0 {%- endif %}"
# Calculate offset difference
- platform: template
sensors:
front_bedroom_offset_difference:
friendly_name: "Front Bedroom Offset Difference"
unit_of_measurement: '°C'
value_template: "{{ ((states('sensor.front_bedroom_calculated_offset')|float ) - (states('sensor.tado_front_bedroom_put_offset')|float))| round(2)}}"
# Put Offset to Tado
- platform: command_line
name: Tado_Front_Bedroom_Put_Offset
scan_interval: 300000
unit_of_measurement: '°C'
json_attributes:
- celsius
- fahrenheit
command: 'curl -X PUT "https://my.tado.com/api/v2/devices/VA******/temperatureOffset" -H "Authorization: Bearer {{ state_attr(''sensor.tado_auth'', ''access_token'') }}" -H "Content-Type: text/plain" --data-raw "{celsius: {{ ((states(''sensor.front_bedroom_calculated_offset'')|float))| round(2)}} }" '
value_template: '{{ value_json.celsius }}'
Useful sources of info: -
In case it proves to be of any help I also wrote this for the ESP32, that calls the API directly, rather than using HA: -
Jonathan
Edited 17/7/2020 to remove backslashes (for escaping) before quotes in command line sensors, due to change in HA