Battery Level and Temperature Offset for Tado

I dont know tbh, I set up homekit but as I already had Tado set up I removed it as I was getting this all working. My understanding is the same APIs are available locally through Homekit, so in theory yes it should be possible.

Thank you so much for this!
I’ve been looking for a solution for so long now.

One thing, I had to comment out the below section to get Home Assistant to play ball.

  # Conditions to check initially and cancel out the run if needed.
  # NB they will be recheck again in action in case anything changed while waiting to run
  #    so if you decide to remove any, make sure you remove in both
#  condition:
#  # Only run if temp states are a number i.e. hasn't become 'unavailable'
#  - "{{ states(sensor_id)|int != 0 or states(sensor_id) == '0' }}"
#  - "{{ states(climate_sensor_id)|int != 0 or states(climate_sensor_id) == '0' }}"
#  # Only run if the climate device is set to 'auto' and preset is 'home'
#  - "{{ states(climate_id) == 'auto' and state_attr(climate_id, 'preset_mode') == 'home' }}"
#  # Queuing only queues the action section so some variables need to be created here so caculated at relevant time

I’m not sure if Home Assistant was seeing two conditions and getting upset, although I will admit to not fully understanding the code yet as I’m still going through it all.

Automation is working though and it’s regulating the Tado TRV temperatures, it just throws up this error in the logs:

Error while executing automation automation.regulate_heating: TypeError: unsupported operand type(s) for -: 'NoneType' and 'NoneType'

@chris_avfc that looks like you haven’t input your settings correctly. sensor_id and climate_sensor_id are worked out from your settings…

Maybe you have a different namespace or left some of my default in when adding your settings?

Just realised my mistake I think.
I had the below for one of my rooms:

sensor.hall_temperature
sensor.hall_temperature_measurement
climate.heating

climate.heating is the standard Tado Wall Thermostate, I’ve now renamed it to

climate.hall

Will leave it running now and see what happens.

yep that should sort it

The thread is already a bit older, but I still have the issue that battery_state for all my tado° thermostats (not a central one, but one thermostat for every radiator) only show “Off”, and the icon is a battery with a question mark.
The tado° app shows battery status as good, and I don’t mind if there is no percentage value, but “Off” seems like it isn’t working.
image

I have had exactly the same problem today. To have a “percentage” (0% or 100%), I have created a template sensor:

template:
  - sensor:
      - name: "XXX Heizung Batterie"
        unique_id: heizung_xxx_battery_percentage
        unit_of_measurement: "%"
        device_class: battery
        availability: "{{ states('sensor.xxx_battery_state') in ('unknown', 'unavailable') }}"
        state: >
            {% if is_state('binary_sensor.xxx_battery_state', 'off') %}
                100
            {% elif states('climate.heizung_xxx') not in ('unknown', 'unavailable') %}
                10
            {% else %}
                0
            {% endif %}

Edit:
I’ve changed the template sensor a bit to have 3 possible percentages because I usually let such devices run until they die and no longer work and not just change the battery because of some low battery message:

LB = off → 100%
LB = on → 10% (since the battery is only “low” and not completely empty)
Thermostat not connected → 0% (These are actually “0%”)

However still not fully tested. I might do some improvements to the code when I have tested it more.
There also comes the problem that if the thermostat is offline for whatever reason, it will also show 0% instead of unavailable - because how can we know the reason for it beeing offline. It could just be an bad connection. For this we would have to check if the sensor was on 10% before it has disconnected.

Thanks a lot!
I was simply not aware of the template sensor, and your example works great!