core icon indicating copy to clipboard operation
core copied to clipboard

Tado integration - 2024.1 gives issues with multiple tado instances

Open ditisdirkdewit opened this issue 1 year ago • 13 comments

The problem

After upgrading to 2024.1 one Tado integration loads from the start the other does not. When manually reloading the integration it works, however it shows intermitted behavior: image

See below the logs

What version of Home Assistant Core has the issue?

2024.1.2

What was the last working version of Home Assistant Core?

2023.12.4

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Tado

Link to integration documentation on our website

No response

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 88, in <lambda>
    lambda now: tadoconnector.update(),
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/__init__.py", line 190, in wrapper
    result = method(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 194, in update
    self.update_devices()
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 228, in update_devices
    device_short_serial_no = device["shortSerialNo"]
                             ~~~~~~^^^^^^^^^^^^^^^^^
TypeError: string indices must be integers, not 'str'

Logger: homeassistant
Source: components/tado/__init__.py:207
First occurred: 10:23:37 (7 occurrences)
Last logged: 10:26:37

Error doing job: Future exception was never retrieved
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 94, in <lambda>
    lambda now: tadoconnector.update_mobile_devices(),
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/tado/__init__.py", line 207, in update_mobile_devices
    self.data["mobile_device"][mobile_device["id"]] = mobile_device
                               ~~~~~~~~~~~~~^^^^^^
TypeError: string indices must be integers, not 'str'

Additional information

No response

ditisdirkdewit avatar Jan 11 '24 09:01 ditisdirkdewit

Hey there @chiefdragon, @erwindouna, mind taking a look at this issue as it has been labeled with an integration (tado) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of tado can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign tado Removes the current integration label and assignees on the issue, add the integration domain after the command.
  • @home-assistant add-label needs-more-information Add a label (needs-more-information, problem in dependency, problem in custom component) to the issue.
  • @home-assistant remove-label needs-more-information Remove a label (needs-more-information, problem in dependency, problem in custom component) on the issue.

(message by CodeOwnersMention)


tado documentation tado source (message by IssueLinks)

home-assistant[bot] avatar Jan 11 '24 09:01 home-assistant[bot]

Patch 2024.1.3 will provide robust handling of errors in the situation where users have multiple accounts, homes and mobile devices connected. I am currently investigating how the mitigate the startup issue.

erwindouna avatar Jan 11 '24 09:01 erwindouna

There might be a better way to handle this but I've just popped this automation into place for the time being. Not tested rigourously but seems to work. It just reloads the integration after home assistant starts. Might not need the 1 minute delay but added it to be safe.

alias: Tado reload
description: ""
trigger:
  - platform: homeassistant
    event: start
condition: []
action:
  - delay:
      hours: 0
      minutes: 1
      seconds: 0
      milliseconds: 0
  - service: homeassistant.reload_config_entry
    target:
      device_id: xxxxxxxxxxxxxx
    data: {}
mode: single

Device ID is the integration that fails to load (search for it in 'devices')

p-fraser avatar Jan 12 '24 22:01 p-fraser

Nice work. Do you have the debug logging? I can use this to elaborate with a developer from Tado to get this hopefully solved very soon.

erwindouna avatar Jan 13 '24 08:01 erwindouna

I‘m afraid there is now a new bug. I updated to 2024.01.3 which included the fix. Now I find

Logger: homeassistant.components.tado Source: components/tado/init.py:249 Integration: Tado (documentation, issues) First occurred: 12. Januar 2024 um 21:01:21 (154 occurrences) Last logged: 09:51:21


Error for home ID XXXXX while updating devices: [{'code': 'accessDenied', 'title': 'current user is not allowed to access home XXXXX (user is not a resident)'}]
Error for home ID YYYYYYY while updating devices: [{'code': 'accessDenied', 'title': 'current user is not allowed to access home YYYYYYY (user is not a resident)'}]

And also operating the climate cards in Lovelace does not change anything on the Tados

Kugelfang666 avatar Jan 13 '24 08:01 Kugelfang666

Same issue, and same error in the logs. As noted, the integration now seems completely broken as the second bridge doesn't receive any commands even after reloading and apparently successfully starting up.

p-fraser avatar Jan 13 '24 11:01 p-fraser

Same issue, and same error in the logs. As noted, the integration now seems completely broken as the second bridge doesn't receive any commands even after reloading and apparently successfully starting up.

Having more than one unique Tado account?

erwindouna avatar Jan 13 '24 12:01 erwindouna

Yes, I have one Tado account with a distinct email address per bridge.

Tado Bridge 1, emailadress A Tado Bridge 2, emailadress B

Kugelfang666 avatar Jan 13 '24 12:01 Kugelfang666

Yep, same here. For background, it's because one bridge doesn't have the range to penetrate my home's stone walls to reach all of the radiators, so I use a second bridge, that calls for heat via a thermostat paired with the bridge connected to the boiler, using Home Assistant to facilitate this. I'm not sure how easy it would be to test things if you don't have a similar setup yourself, so happy to help test if I can.

p-fraser avatar Jan 13 '24 15:01 p-fraser

Any help is greatly appreciated. One thing that's an option, if you're willing, is that I would be allowed to use your setup on my development environment. This allows me to use breakpoints and tracing what exactly happens in HA and with the communication between Tado's API. Keep in mind the API is reversed engineered and this means it's mostly developed via trial and error. If I would be able to use your setup for testing, I can more precisely see what's happening. Would you be willing to help around via this route?

erwindouna avatar Jan 13 '24 15:01 erwindouna

Absolutely. You'll need to guide me in how to do that though

p-fraser avatar Jan 13 '24 19:01 p-fraser

Absolutely. You'll need to guide me in how to do that though

What would help, if we can make an agreement I would be allowed to get the login credentials for your Tado instances. This way I can temporary hook them up in my development environment and more precisely pinpoint what's going on and work on a solution this way. Would you be ok with this approach?

erwindouna avatar Jan 14 '24 09:01 erwindouna

Absolutely. Drop me a line at [email protected] and I can set up some temporary credentials.

p-fraser avatar Jan 14 '24 18:01 p-fraser