Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication failed since v3.20.2 #898

Closed
jmcollin78 opened this issue Mar 13, 2024 · 17 comments · Fixed by #904
Closed

Authentication failed since v3.20.2 #898

jmcollin78 opened this issue Mar 13, 2024 · 17 comments · Fixed by #904

Comments

@jmcollin78
Copy link

jmcollin78 commented Mar 13, 2024

Since the installation of release 3.20.2, the authentication failed. I try to renew the Refresh Token but I still have issue in the log:

  File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 68, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
    return await func(self, request, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 197, in post
    return await super().post(request, flow_id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
    result = await method(view, request, data, *args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
    result = await self._flow_mgr.async_configure(flow_id, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in async_configure
    result = await self._async_configure(flow_id, user_input)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 405, in _async_configure
    result = await self._async_handle_step(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 502, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tesla_custom/config_flow.py", line 84, in async_step_user
    return await self.async_step_credentials()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tesla_custom/config_flow.py", line 118, in async_step_credentials
    data_schema=self._async_schema(api_proxy_enable=self.use_proxy),
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/tesla_custom/config_flow.py", line 165, in _async_schema
    if not addon_slug:
           ^^^^^^^^^^
UnboundLocalError: cannot access local variable 'addon_slug' where it is not associated with a value

and

2024-03-13 08:19:09.789 WARNING (MainThread) [homeassistant.config_entries] Config entry 'xxxxxx' for tesla_custom integration could not authenticate

Previous working release was 3.19.11. I will rollback.

@jmcollin78 jmcollin78 changed the title Authentication failed since v3.20.0 Authentication failed since v3.20.2 Mar 13, 2024
@jmcollin78
Copy link
Author

Rolling back to 3.19.11 solve the issue.

@FabioDiLorenzo
Copy link

FabioDiLorenzo commented Mar 13, 2024

Same here, updated to 3.20.2 and it stopped working.
Reverted to 3.19.11 and reauthenticated with refresh token and everything is working again (Including sending commands).

(Model 3, 2019)

Edit: I am on 2024.3.0

@teranex
Copy link

teranex commented Mar 13, 2024

Same for me. Updated to 3.20.2 yesterday evening to find a notification this morning that I needed to re-authenticate. Authentication went ok (without using fleet api or a proxy), but then the integration failed to setup. Downgrading to 3.19.11 fixed it (2022 MY)

@Zappo-II
Copy link

FYI
Had to reConfigure and reAuthenticate this Morning but works well with me...
tesla_custom 3.20.2
ha 2024.2.2
Model 3 - 2022

@jmcollin78
Copy link
Author

The stacktrace in the initial bug seems more related to a bug

@DanielWeeber

This comment was marked as duplicate.

@coreGreenberet
Copy link

Same issue here, but I can't reauthenticate even on the old version anymore :(

@jmcollin78
Copy link
Author

Same issue here, but I can't reauthenticate even on the old version anymore :(

Generate a new Refresh token and it should work.

@llamafilm
Copy link
Collaborator

@jmcollin78 please describe your environment. Are you running Home Assistant OS, supervisor, etc.? Are you running the Tesla HTTP Proxy addon?

@coreGreenberet
Copy link

Same issue here, but I can't reauthenticate even on the old version anymore :(

Generate a new Refresh token and it should work.

Interesting...I've tried that yesterday via phone and the token was accepted, but there was an issue with the reauthentication later.
Today over the windows app it was working fine.

@jmcollin78
Copy link
Author

@jmcollin78 please describe your environment. Are you running Home Assistant OS, supervisor, etc.? Are you running the Tesla HTTP Proxy addon?

System Information

version core-2024.3.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 6.1.73-haos-raspi
arch aarch64
timezone Europe/Paris
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4996
Installed Version 1.34.0
Stage running
Available Repositories 1407
Downloaded Repositories 46
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 12.1
update_channel stable
supervisor_version supervisor-2024.03.0
agent_version 1.6.0
docker_version 24.0.7
disk_total 457.7 GB
disk_used 25.1 GB
healthy true
supported true
board rpi4-64
supervisor_api ok
version_api ok
installed_addons Home Assistant Google Drive Backup (0.112.1), Samba share (12.3.1), InfluxDB (5.0.0), Glances (0.21.0), Let's Encrypt (5.0.15), NGINX Home Assistant SSL proxy (3.8.0), SQLite Web (4.1.2), AppDaemon (0.16.4), Piper (1.5.0), Whisper (2.0.0), Mosquitto broker (6.4.0), Zigbee2MQTT (1.36.0-1), Studio Code Server (5.15.0), Silicon Labs Flasher (0.2.0), Zigbee2MQTT Edge (edge)
Dashboards
dashboards 7
resources 26
views 44
mode storage
Recorder
oldest_recorder_run 9 mars 2024 à 12:08
current_recorder_run 14 mars 2024 à 07:30
estimated_db_size 539.32 MiB
database_engine sqlite
database_version 3.44.2
Sonoff
version 3.6.0 (8dd8af9)
cloud_online 9 / 9
local_online 9 / 9
debug failed to load:

@llamafilm
Copy link
Collaborator

Thanks. The exception shown in your log was a bug which is now fixed. But this is still going to fail because you have selected "Use API Proxy" in the Tesla component, and you do not have the Tesla HTTP Proxy addon installed.

@jmcollin78
Copy link
Author

jmcollin78 commented Mar 15, 2024

Thanks. The exception shown in your log was a bug which is now fixed. But this is still going to fail because you have selected "Use API Proxy" in the Tesla component, and you do not have the Tesla HTTP Proxy addon installed.

If I remember well there was one option "use Fleet API" or something like that. Should I check this checkbox ?
What is the Tesla HTTP Proxy addon ? Should I install it ?

If yes that is major compatibility break and should be reported ?

Ok I will read the Readme and try to understand what should I do.

EDIT: I'm not concerned by Fleet API (Model 3 03/2022). So I did not check the "Use fleet API" checkbox and I don't remember to have a "Use API Proxy" option. So I don't understand what I should do.

@darek-margas
Copy link

I had the above but rollback to 3.19 rectified issue. Then, I upgrade to 3.20.3, failed again, rolled back to 3.19 and this time is deauthenticated permanently. 3.19 offers re-authentication but 3.20 does not. Disabled for now, may actually come back once i setup proxy but writing here to flag that maybe 3.20.3 isn't a fix.

@DanielWeeber
Copy link

@jmcollin78 @alandtse this is not solved, please do not close this ticket.

@jmcollin78
Copy link
Author

@jmcollin78 @alandtse this is not solved, please do not close this ticket.

I didn't close the ticket. The issue is still there.

@JHPembs
Copy link

JHPembs commented May 20, 2024

I have the proxy all set up but i still get the the "unknown error" .. any help appreciated

`Logger: aiohttp.server
Source: /usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py:421
First occurred: 12:47:36 AM (4 occurrences)
Last logged: 1:00:46 AM

Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request
resp = await request_handler(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle
resp = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 91, in security_filter_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 25, in request_context_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 235, in auth_middleware
return await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
response = await handler(request)
^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 68, in handle
result = await handler(request, **request.match_info)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 72, in with_admin
return await func(self, request, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 197, in post
return await super().post(request, flow_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 72, in wrapper
result = await method(view, request, data, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 111, in post
result = await self._flow_mgr.async_configure(flow_id, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in async_configure
result = await self._async_configure(flow_id, user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 405, in _async_configure
result = await self._async_handle_step(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 502, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/config_flow.py", line 84, in async_step_user
return await self.async_step_credentials()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/config_flow.py", line 118, in async_step_credentials
data_schema=self._async_schema(api_proxy_enable=self.use_proxy),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/tesla_custom/config_flow.py", line 165, in _async_schema
if not addon_slug:
^^^^^^^^^^
UnboundLocalError: cannot access local variable 'addon_slug' where it is not associated with a value`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants