[SOLVED] ERROR (MainThread) [homeassistant.components.websocket_api.http.connection]

As from yesterday, when I restarted home-assistant, I cannot open Lovelace any more, got this:

image

System: Archlinux
HA: Home Assistant Core 2021.9.7-1 installed directly on OS from Arch community repo

I think it is something related with HA web API, but after lot of googling, I found lot of topics without solution.
On top of this, I think that HA is working, but the problem is that I cannot open the frontend. E.g. I have some automation that turning off lights and other devices, when all person trackers are away (not_home). Before half hour, I drove the kids to school and wife to work, came back to home (working from home :wink: ) and saw that all lights where physical wall switch is turned on, were actually turned off, so this means that automation is working. Also, systemctl status home-assistant is giving me Active: active (running)

This is from log and I will be glad to provide any additional info required. Thanks in advance.

2021-10-12 08:33:45 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /var/lib/hass/configuration.yaml contains duplicate key “service”. Check lines 291 and 294
2021-10-12 08:33:45 WARNING (SyncWorker_0) [homeassistant.util.yaml.loader] YAML file /var/lib/hass/configuration.yaml contains duplicate key “data”. Check lines 292 and 295
2021-10-12 08:33:45 WARNING (SyncWorker_1) [homeassistant.loader] We found a custom integration simpleicons which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-10-12 08:33:45 WARNING (SyncWorker_0) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-10-12 08:33:45 WARNING (SyncWorker_3) [homeassistant.loader] We found a custom integration smartir which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-10-12 08:33:45 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration fontawesome which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2021-10-12 08:33:55 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn’t connect to 192.168.0.6:5555. TcpTimeoutException: Connecting to 192.168.0.6:5555 timed out (1.0 seconds)
2021-10-12 08:33:55 WARNING (MainThread) [homeassistant.components.androidtv.media_player] Could not connect to Orion TV at 192.168.0.6:5555 using Python ADB implementation with adbkey=‘/var/lib/hass/.storage/androidtv_adbkey’
2021-10-12 08:33:55 WARNING (MainThread) [homeassistant.components.media_player] Platform androidtv not ready yet: None; Retrying in background in 30 seconds
2021-10-12 08:33:55 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 422, in _handle_request
resp = await self._request_handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_app.py”, line 499, in _handle
resp = await handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py”, line 89, in forwarded_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/request_context.py”, line 24, in request_context_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 78, in ban_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/auth.py”, line 144, in auth_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/view.py”, line 135, in handle
result = await result
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 93, in handle_req
resp = await func(view, request, *args, **kwargs)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 259, in post
return await self._async_handle_refresh_token(hass, data, request.remote)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 364, in _async_handle_refresh_token
access_token = hass.auth.async_create_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 461, in async_create_access_token
return jwt.encode(
AttributeError: ‘str’ object has no attribute ‘decode’
2021-10-12 08:33:55 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140044575841536] Unexpected error inside websocket API
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/http.py”, line 192, in async_handle
connection = await auth.async_handle(msg_data)
File “/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/auth.py”, line 82, in async_handle
refresh_token = await self._hass.auth.async_validate_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 510, in async_validate_access_token
unverif_claims = jwt.decode(token, verify=False)
TypeError: decode() got an unexpected keyword argument ‘verify’
2021-10-12 08:34:04 WARNING (MainThread) [homeassistant.components.light] Setup of light platform flux_led is taking over 10 seconds.
2021-10-12 08:34:05 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn’t connect to 192.168.0.6:5555. TcpTimeoutException: Connecting to 192.168.0.6:5555 timed out (1.0 seconds)
2021-10-12 08:34:05 WARNING (MainThread) [homeassistant.components.androidtv.media_player] Could not connect to Orion TV at 192.168.0.6:5555 using Python ADB implementation with adbkey=‘/var/lib/hass/.storage/androidtv_adbkey’
2021-10-12 08:34:14 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 422, in _handle_request
resp = await self._request_handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_app.py”, line 499, in _handle
resp = await handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py”, line 211, in forwarded_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/request_context.py”, line 24, in request_context_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 78, in ban_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/auth.py”, line 144, in auth_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/view.py”, line 135, in handle
result = await result
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 93, in handle_req
resp = await func(view, request, *args, **kwargs)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 259, in post
return await self._async_handle_refresh_token(hass, data, request.remote)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 364, in _async_handle_refresh_token
access_token = hass.auth.async_create_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 461, in async_create_access_token
return jwt.encode(
AttributeError: ‘str’ object has no attribute ‘decode’
2021-10-12 08:34:15 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 422, in _handle_request
resp = await self._request_handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_app.py”, line 499, in _handle
resp = await handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py”, line 211, in forwarded_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/request_context.py”, line 24, in request_context_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 78, in ban_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/auth.py”, line 144, in auth_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/view.py”, line 135, in handle
result = await result
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 93, in handle_req
resp = await func(view, request, *args, **kwargs)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 259, in post
return await self._async_handle_refresh_token(hass, data, request.remote)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 364, in _async_handle_refresh_token
access_token = hass.auth.async_create_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 461, in async_create_access_token
return jwt.encode(
AttributeError: ‘str’ object has no attribute ‘decode’
2021-10-12 08:34:15 ERROR (MainThread) [aiohttp.server] Error handling request
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/aiohttp/web_protocol.py”, line 422, in _handle_request
resp = await self._request_handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_app.py”, line 499, in _handle
resp = await handler(request)
File “/usr/lib/python3.9/site-packages/aiohttp/web_middlewares.py”, line 119, in impl
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/security_filter.py”, line 60, in security_filter_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/forwarded.py”, line 211, in forwarded_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/request_context.py”, line 24, in request_context_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 78, in ban_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/auth.py”, line 144, in auth_middleware
return await handler(request)
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/view.py”, line 135, in handle
result = await result
File “/usr/lib/python3.9/site-packages/homeassistant/components/http/ban.py”, line 93, in handle_req
resp = await func(view, request, *args, **kwargs)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 259, in post
return await self._async_handle_refresh_token(hass, data, request.remote)
File “/usr/lib/python3.9/site-packages/homeassistant/components/auth/init.py”, line 364, in _async_handle_refresh_token
access_token = hass.auth.async_create_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 461, in async_create_access_token
return jwt.encode(
AttributeError: ‘str’ object has no attribute ‘decode’
2021-10-12 08:34:15 ERROR (MainThread) [homeassistant.components.websocket_api.http.connection] [140044234523312] Unexpected error inside websocket API
Traceback (most recent call last):
File “/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/http.py”, line 192, in async_handle
connection = await auth.async_handle(msg_data)
File “/usr/lib/python3.9/site-packages/homeassistant/components/websocket_api/auth.py”, line 82, in async_handle
refresh_token = await self._hass.auth.async_validate_access_token(
File “/usr/lib/python3.9/site-packages/homeassistant/auth/init.py”, line 510, in async_validate_access_token
unverif_claims = jwt.decode(token, verify=False)
TypeError: decode() got an unexpected keyword argument ‘verify’
2021-10-12 08:34:27 WARNING (MainThread) [homeassistant.components.ps4.media_player] PS4 could not be reached
2021-10-12 08:35:06 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn’t connect to 192.168.0.6:5555. TcpTimeoutException: Connecting to 192.168.0.6:5555 timed out (1.0 seconds)
2021-10-12 08:35:06 WARNING (MainThread) [homeassistant.components.androidtv.media_player] Could not connect to Orion TV at 192.168.0.6:5555 using Python ADB implementation with adbkey=‘/var/lib/hass/.storage/androidtv_adbkey’
2021-10-12 08:36:37 WARNING (MainThread) [androidtv.adb_manager.adb_manager_async] Couldn’t connect to 192.168.0.6:5555. TcpTimeoutException: Connecting to 192.168.0.6:5555 timed out (1.0 seconds)
2021-10-12 08:36:37 WARNING (MainThread) [homeassistant.components.androidtv.media_player] Could not connect to Orion TV at 192.168.0.6:5555 using Python ADB implementation with adbkey=‘/var/lib/hass/.storage/androidtv_adbkey’

Try to fix these first :

1 Like

Sorry cause I pasted whole log from today, but I already tried this before posting and still not working. This was actually some WIP experiment for make HA to work with Rhasspy, but that is another topic.

No matter, situation in configuration.yaml is as on screenshot below and I just tried one more to do systemctl restart home-assistent , problem is still here, cannot load Lovelace.

1 Like

Ok, so my problem was actually related with python packages upgraded yesterday during my regular sudo pacman -Syu (Archlinux upgrade).
I searched with cat /var/log/pacman.log | grep 2021-10-11 and found following which can be interesting for me (HA is rely on python and it’s modules):

Unfortunatelly, HA is not updated yet in Arch community repo and it is still version 2021.9.7-1 , so I cannot tell if these new python modules are working with latest version of HA. Anyway, I downgraded mentioned 3 python modules to their previous versions, restarted HA and it is working again.

Will se tonight after work to migrate HA to Docker, this is something most stupid I’ve ever done, to keep HA as repo package on bleeding edge distro. Actually, never had lot of troubles with HA on Arch, but from other side, I already learnt a lesson with Nextcloud and started living and feels much better since I moved it to Docker :slight_smile:

Probably not actually solution, but topic closed.

At the end, lot of trouble for nothing. Home Assistant v2021.10.3 just appeared in Arch repo and I done complete Arch upgrade with sudo pacman -Syu
Everything is working as expected :slight_smile: , there is no homeassistant.components.websocket_api.http.connection error in logs, below is summary what was upgraded:

[root@archmedia ~]# cat /var/log/pacman.log | grep 2021-10-12 | grep upgraded
[2021-10-12T18:35:56+0200] [ALPM] upgraded libfilezilla (0.33.0-1 → 0.34.0-1)
[2021-10-12T18:35:56+0200] [ALPM] upgraded filezilla (3.55.1-3 → 3.56.0-1)
[2021-10-12T18:35:56+0200] [ALPM] upgraded python-certifi (2020.12.5-1 → 2021.10.8-1)
[2021-10-12T18:35:56+0200] [ALPM] upgraded python-cryptography (3.4.8-2 → 35.0.0-1)
[2021-10-12T18:35:56+0200] [ALPM] upgraded python-pyjwt (1.7.1-6 → 2.2.0-1)
[2021-10-12T18:35:56+0200] [ALPM] upgraded python-urllib3 (1.26.6-1 → 1.26.7-1)
[2021-10-12T18:36:00+0200] [ALPM] upgraded home-assistant (2021.9.7-1 → 2021.10.3-1)
[2021-10-12T18:36:00+0200] [ALPM] upgraded python-click (8.0.1-1 → 8.0.3-1)
[2021-10-12T18:36:00+0200] [ALPM] upgraded python2-urllib3 (1.26.6-1 → 1.26.7-1)

@admins: I think this topic can go to trash, cause I don’t believe it is useful for anyone.

1 Like