Core: Pull request 22145 doesn't update PyTado

Created on 20 Mar 2019  路  22Comments  路  Source: home-assistant/core

https://github.com/home-assistant/home-assistant/pull/22145 does not update PyTado version.
/usr/local/lib/python3.7/site-packages/PyTado/interface.py still points to wrong API endpoint.

Most helpful comment

What we can do as a workaround while the fix comes to homeassistant?

All 22 comments

Hi was just about to post that Tado is still not working on 0.90.0b7 but wonder if this is the same issue.

The errors in the log are...

Error 401 on https://auth.tado.com/api/v2/homes/{home_id}/mobileDevices?username={username}&password={password}.

2019-03-20 11:37:26 ERROR (SyncWorker_8) [homeassistant.components.tado] Unable to connect to mytado with username and password
2019-03-20 11:37:26 ERROR (MainThread) [homeassistant.setup] Setup failed for tado: Component failed to initialize.
2019-03-20 11:37:28 ERROR (MainThread) [homeassistant.components.device_tracker] Error setting up platform tado

I have the same errors, but it seems to be a change on Tado鈥檚 side (something with authentication).

Changing line 115 and 140 in PyTado/interface.py from my.tado.xxxxx to auth.tado.xxxxx fixes half of the problems. Heating will work, though device tracking is still broken for me.

Still not working with 0.90 GM.

Apparantly 0.90.0 should have fixed this. However device tracking still isn鈥檛 working for me. Are there any workarounds perhaps? Btw it seems almost no one has this problem as this is the only post I could find about the device tracking part.

PLEASE do not remove our issue template.

@grinco please show me the evidence your PyTado still point to wrong URL, and define what is "wrong"

0.90 still point to the "wrong" url: "https://my.tado.com/oauth/token"
the correct one must be "https://auth.tado.com/oauth/token".

As I saw in PyTado repo, its code already changed to auth. on 0.2.8 tag
https://github.com/wmalgadey/PyTado/blob/95afdde4370c0e363b1d325b00258317a3cec8fc/PyTado/interface.py#L115

Unless they released wrong version.

Unless they released wrong version.

The issue I saw for the device tracker is it just changed api end point to auth to all API calls. Let's assume PyTado is right about API endpoint, then device tracker should not change the endpoints.

https://github.com/home-assistant/home-assistant/blob/01d8b5831ea6fd97dac1beea99844754c4520857/homeassistant/components/tado/device_tracker.py#L54-L58

Moreover, if my understanding is right by following all discussion about this integration, device tracker should 1) update to use oauth too, the username/password way need change 2) this logic should rely on the implementation of PyTado, e.g. device tracker should not define the URL in the first place.

I do not have that device, everything I write might be wrong entirely

Unless they released wrong version.

Then please open an issue to their repo.

I would, but I don't know how to do that :(

I download it from PyPi, and verified they indeed released wrong version.

I submitted one issue in their repo. https://github.com/wmalgadey/PyTado/issues/13

Ok, I have changed the following lines back from https://auth.tado.com/ to https://my.tado.com.

home-assistant/homeassistant/components/tado/device_tracker.py

Lines 54 to 58 in 01d8b58

Seems to be working again. So what I understand from all this is that the only thing that should have been changed are line 115 and 140 in the ~/site-packages/PyTado/interface.py but not these ones.

I'd love to know how to tell the devs to change it :P

So I have done a bit of testing, seems the device tracker is working again and all my automations that depended on it work again as well. So it seems that everything is working again e.g. operation modes and device tracking. However I found another error which it will throw at you if you try to set the operation mode to "off" or "timer" it will throw the following error:

HTTP Error 422: 

Traceback (most recent call last):
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/components/websocket_api/commands.py", line 122, in handle_call_service
    connection.context(msg))
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1138, in async_call
    self._execute_service(handler, service_call))
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/core.py", line 1160, in _execute_service
    await handler.func(service_call)
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/entity_component.py", line 188, in handle_service
    self._platforms.values(), func, call, service_name
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 314, in entity_service_call
    future.result()  # pop exception if have
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 328, in _handle_service_platform_call
    await getattr(entity, func)(**data)
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/components/tado/climate.py", line 225, in set_operation_mode
    self._control_heating()
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/components/tado/climate.py", line 343, in _control_heating
    self._store.set_zone_overlay(self.zone_id, CONST_OVERLAY_MANUAL)
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/homeassistant/components/tado/__init__.py", line 122, in set_zone_overlay
    self.tado.setZoneOverlay(zone_id, mode, temperature, duration)
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/PyTado/interface.py", line 287, in setZoneOverlay
    data = self._apiCall(cmd, "PUT", post_data)
  File "/home/homeassistant/homeassistant/lib/python3.6/site-packages/PyTado/interface.py", line 81, in _apiCall
    response = self.opener.open(req)
  File "/usr/lib/python3.6/urllib/request.py", line 532, in open
    response = meth(req, response)
  File "/usr/lib/python3.6/urllib/request.py", line 642, in http_response
    'http', request, response, code, msg, hdrs)
  File "/usr/lib/python3.6/urllib/request.py", line 570, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 504, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.6/urllib/request.py", line 650, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 422: 

Thanks @awarecan for this link. The thing is I'm a hassio user and I don't think that I can change the file.

The issue is that PyTado isnt maintained.
The repo with the fix is named Python-tado on pypi

https://pypi.org/project/python-tado/

So PyTado is not used anymore. Python-Tado is what is being used now.

so @grinco no it does not update PyTado. It replaces PyTado with Python-Tado

and @jimbob1001 That seem to be another issue. The auth.tado.com adress should work.

So should/can we hassio users do. Just sit there and wait for a fix in the next release?

@bhaap we are using python-tado

Although in PyPi, its project name is python-tado, but its module name (e.g. the directory name) is never changed, it sill is PyTado. Therefore this issue's title is PyTado

I updated python-tado (aka PyTado) to 0.2.9 which finally has the right changes.

PS: PyTado was already taken on pyPi, and I couldn't get in contact with the maintainer!

What we can do as a workaround while the fix comes to homeassistant?

@rafuz you can change the file manually. It will stay there as long as you don't install it again.

I guess the fix will also be backported to a 0.90.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Elmardus picture Elmardus  路  3Comments

MartinHjelmare picture MartinHjelmare  路  3Comments

arangates picture arangates  路  3Comments

i-am-shodan picture i-am-shodan  路  3Comments

ofuangka picture ofuangka  路  3Comments