home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.78k stars 30.88k forks source link

Tesla integration fails with an unknown error #49491

Closed premanandc closed 3 years ago

premanandc commented 3 years ago

The problem

I am trying to enable the Tesla integration. I get this unknown error on the UI: image

It is possible I am doing this wrong. I originally had it working about a week or so ago. But all the entities became unavailable. So I deleted the integration and tried again.

What is version of Home Assistant Core has the issue?

System Health version | core-2021.4.6 -- | -- installation_type | Home Assistant OS dev | false hassio | true docker | true virtualenv | false python_version | 3.8.7 os_name | Linux os_version | 5.4.83-v8 arch | aarch64 timezone | America/New_York
Home Assistant Community Store GitHub API | ok -- | -- Github API Calls Remaining | 4828 Installed Version | 1.11.3 Stage | running Available Repositories | 843 Installed Repositories | 14
AccuWeather can_reach_server | ok -- | -- remaining_requests | 32
Home Assistant Cloud logged_in | false -- | -- can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Home Assistant Supervisor host_os | Home Assistant OS 5.13 -- | -- update_channel | stable supervisor_version | supervisor-2021.04.0 docker_version | 19.03.15 disk_total | 28.6 GB disk_used | 5.6 GB healthy | true supported | true board | rpi4-64 supervisor_api | ok version_api | ok installed_addons | Duck DNS (1.12.5), Visual Studio Code (3.3.0), AdGuard Home (4.0.0), Check Home Assistant configuration (3.6.0), SSH & Web Terminal (8.2.0), Mosquitto broker (5.1.1)
Lovelace dashboards | 2 -- | -- resources | 5 views | 4 mode | storage

What was the last working version of Home Assistant Core?

No response

What type of installation are you running?

Home Assistant OS

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?

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 119, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 74, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 135, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 131, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 155, in post
    return await super().post(request, flow_id)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 107, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 156, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 214, in _async_handle_step
    result: dict = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/tesla/config_flow.py", line 57, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/usr/src/homeassistant/homeassistant/components/tesla/config_flow.py", line 159, in validate_input
    (config[CONF_TOKEN], config[CONF_ACCESS_TOKEN]) = await controller.connect(
  File "/usr/local/lib/python3.8/site-packages/teslajsonpy/controller.py", line 268, in connect
    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_
probot-home-assistant[bot] commented 3 years ago

Hey there @zabuldon, @alandtse, mind taking a look at this issue as its been labeled with an integration (tesla) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

skrenes commented 3 years ago

I think this is the same as #49354

premanandc commented 3 years ago

Yup.. should've looked harder. This is a dup. I'll track #49354 We can close this one. Thanks!