Tesla integration not working

I am quite sure it will be back soon.

I read on Github that the new API would require to use a scraper to keep the integration as a native integration.

The problem is that HA does not allow scraping in native integrations.

So my bet would be that unless HA makes an exception, we will see Tesla integration as an integration through Hacs shortly :slight_smile:

Can’t wait to get it back, I was just about done with my logic for pre heating the car in the mornings :slight_smile:

It’s working again with the latest Supervisor update! Woohoo!

1 Like

Too bad it doesn’t support MFA…

1 Like

I am on

Host Operating System	Home Assistant OS 5.11
Update Channel	stable
Supervisor Version	supervisor-2021.02.11

and when I try to add the Tesla integration, after typing in my Tesla email + pw I get:

Unknown error occurred

Note, when I log on to the Tesla site I am asked for a verification code from Google Authenticator app. Not sure if that means I have setup 2FA and this is what is causing the issue. I don’t see where on Tesla’s site I can remove it.

That does indeed mean you have 2fa enabled. You have to disable it right now to get it working.

You have to disable it right now to get it working

ok thanks - I removed 2FA by going to Tesla Account > Account > Login Credentials > Multi-factor Authentication > Manage, and then remove the device I had registered. HA integration is now working.

Integration was fixed in 2021.2.3, but stopped working again… Deleting and reinstalling integration, with new login, does not work.
Python Venv on RPi.

Logger: aiohttp.server
Source: components/tesla/config_flow.py:157
First occurred: 0.05.19 (5 occurrences)
Last logged: 6.40.21

Error handling request
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
    resp = await self._request_handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_app.py", line 499, in _handle
    resp = await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/aiohttp/web_middlewares.py", line 118, in impl
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
    return await handler(request)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/view.py", line 129, in handle
    result = await result
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/config/config_entries.py", line 169, in post
    return await super().post(request, flow_id)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
    result = await method(view, request, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/helpers/data_entry_flow.py", line 106, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 155, in async_configure
    result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
    result: Dict = await getattr(flow, method)(user_input)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/tesla/config_flow.py", line 57, in async_step_user
    info = await validate_input(self.hass, user_input)
  File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/components/tesla/config_flow.py", line 157, in validate_input
    (config[CONF_TOKEN], config[CONF_ACCESS_TOKEN]) = await controller.connect(
  File "/srv/homeassistant/lib/python3.9/site-packages/teslajsonpy/controller.py", line 268, in connect
    cars = await self.get_vehicles()
  File "/srv/homeassistant/lib/python3.9/site-packages/backoff/_async.py", line 133, in retry
    ret = await target(*args, **kwargs)
  File "/srv/homeassistant/lib/python3.9/site-packages/teslajsonpy/controller.py", line 357, in get_vehicles
    return (await self.__connection.get("vehicles"))["response"]
  File "/srv/homeassistant/lib/python3.9/site-packages/teslajsonpy/connection.py", line 78, in get
    return await self.post(command, "get", None)
  File "/srv/homeassistant/lib/python3.9/site-packages/teslajsonpy/connection.py", line 96, in post
    self.code = await self.get_authorization_code(
  File "/srv/homeassistant/lib/python3.9/site-packages/teslajsonpy/connection.py", line 372, in get_authorization_code
    code_url = URL(resp.history[-1].url)
IndexError: tuple index out of range

I don’t have 2FA enabled on my Tesla account and I’m still not able to have Home Assistant sync with the Tesla APIs. I’m on the most recent version, core-2021.2.3.

same. it was broken on me for 2021.1.X. just upgraded to 2021.2.3. still broken. no 2FA.

For me its working just fine on 2021.2.3

still not working. I am using Home Assistant on synology

Any updates on this?

For me, it is only working if I reload the Tesla integration and then restart the HA server. Have to do this every time. Very cumbersome. Anyone had any luck with tweaking the “seconds between scans” or “force awake on startup” settings?

Don’t know what’s going on there… For me the integration is running fine. I’m just using the default settings and I’m on version 2021.3.4 (Running on an Intel Nuc with ESXi)

2FA is probably the reason for some of us

1 Like

Strange. I am also running core-2021.3.4. 2FA is disabled. Just looks like this most of the time (“utilgjengelig” means “unavailiable” in Norwegian):

Are you aware that it will show unavailable when the car is asleep? It also does that for me. Whenever the car sleeps data becomes unavailable. But whenever I wake the car or drive it, it starts updating again.

You could work around this by not letting your car go to sleep but that will drain the battery unnecessarily.

Yes, but the integration newer updates, even though I know for sure that the car is not sleeping anymore?

Have you tried to completely remove the integration from your config, reboot without it and then set it up again?

Will try that, thx!

Now I’m not even able to set up the integration. “Unknown error occured” :thinking: