core: Tesla integration goes unavailable (with traceback)

The problem

Unexpected error fetching tesla data: tuple index out of range

What is version of Home Assistant Core has the issue?

dev

What was the last working version of Home Assistant Core?

dev

What type of installation are you running?

Home Assistant Core

Integration causing the issue

tesla

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tesla/

Example YAML snippet

No response

Anything in the logs that might be useful for us?

2021-04-17 19:15:21 ERROR (MainThread) [homeassistant.components.tesla] Unexpected error fetching tesla data: tuple index out of range
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 179, in _async_refresh
    self.data = await self._async_update_data()
  File "/usr/src/homeassistant/homeassistant/components/tesla/__init__.py", line 262, in _async_update_data
    return await self.controller.update()
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 661, in update
    cars = await self.get_vehicles()
  File "/usr/local/lib/python3.8/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 357, in get_vehicles
    return (await self.__connection.get("vehicles"))["response"]
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 78, in get
    return await self.post(command, "get", None)
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 96, in post
    self.code = await self.get_authorization_code(
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/connection.py", line 372, in get_authorization_code
    code_url = URL(resp.history[-1].url)
IndexError: tuple index out of range

Additional information

No response

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 58 (10 by maintainers)

Commits related to this issue

Most upvoted comments

Same issue here with 2014.4.4 and .5, I see the issue is fixed and waits for merge teslajsonpy, hope this gets merged into a HA bugfix release

Custom component is out. I may have to change the name since it conflicts with core.

Use HACS to install. If you’re replacing core, you will need to remove your existing core integration and add the custom component. This will force a new login using the new method.

If you’re using my Alexa Media Player component, make sure you’ve signed in recently to AMP as the login will be broken in AMP until the next release.

Same here, reinstall the integration result in being unable to sign-in withe error mentioned above and the error message on the login screen: “Unknown error occurred”. Not using MFA.

Same here, reinstall the integration result in being unable to sign-in withe error mentioned above and the error message on the login screen: “Unknown error occurred”. Not using MFA.

Yeah same here, also not using MFA.

Just adding in here since everyone is probably looking for a solution for now. I also switched to Teslamate. Provides read-only values for my usecase. Setting up the docker instance was super easy. If I need to interact with the Tesla I think someone else was using TeslaPy or something was suggested.

I took out the MQTT mosquitto server from the docker-compose and linked it up to a pre-existing mosca mqtt instance that was already running on my machine.

Works great, the grafana dashboard and statistics is fantastic. @skrenes I just put the mqtt sensors in rather than doing the addon, was easy enough.