Open dentex opened 4 months ago
I had the same issue. It was resolved when I updated Home Assistant to the latest version of Home Assistant Core 2024.7.3.
I've the same issue: Raspberry 5, Python3.12 Home assistant Core 2024.7.3 Error recorded on the log is "ERROR (MainThread) [custom_components.toyota.config_flow] An unknown error occurred during login request: [Errno 13] Permission denied: '.cache'"
I have the same issue in HA Core 2024.8.0, but it was the same in 2024.7.x as well. In debug mode it says:
2024-08-15 19:23:15.470 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open with args ('/home/me/.cache/toyota_credentials_cache_contains_secrets', 'r') inside the event loop by custom integration 'toyota' at custom_components/toyota/config_flow.py, line 38: client = MyT( (offender: /home/me/ha_venv3_12/lib/python3.12/site-packages/mytoyota/controller.py, line 56: with open(str(CACHE_FILENAME), "r", encoding="utf-8") as f:), please create a bug report at https://github.com/DurgNomis-drol/ha_toyota/issues
followed by a long stack trace. Because of this in non-debug mode it says:
:
File "/home/atticus/ha_venv3_12/lib/python3.12/site-packages/homeassistant/data_entry_flow.py", line 516, in _async_handle_step
result: _FlowResultT = await getattr(flow, method)(user_input)
File "/home/atticus/homeassistant_conf/custom_components/toyota/config_flow.py", line 38, in async_step_user
client = MyT(
2024-08-15 19:23:15.531 ERROR (MainThread) [custom_components.toyota.config_flow] An unknown error occurred during login request: [Errno 13] Permission denied: '.cache'
while the file is readable:
(ha_venv3_12)~/homeassistant_conf $ls -l ../.cache/toyota_credentials_cache_contains_secrets
-rw-r--r-- 1 me me 2831 Jul 24 19:36 ../.cache/toyota_credentials_cache_contains_secrets
(ha_venv3_12) ~/homeassistant_conf $ file ../.cache/toyota_credentials_cache_contains_secrets
../.cache/toyota_credentials_cache_contains_secrets: JSON data
(ha_venv3_12) ~/homeassistant_conf $
According to the dev guides, file i/o operations should not be done inside the event loop, thus initialization of the MyT client should not be done on the event loop.
Same with latest V2.0.4
I updated python to v3.12.4, HA to latest 2024.8.3 and still same issue... Then, someone suggested me to delete this integration's cache, so I did
cd /home/homeassistant/.cache/
rm -rf toyota_credentials_cache_contains_secrets
and now it's working... Just for you to know.
My comment from Aug 15 is still valid even if I remove the $HOME/.cache/toyota_credentials_cache_contains_secrets.
(ha_venv3_12) thin620t:~/homeassistant_conf $tail -1 home-assistant.log
2024-09-01 19:35:46.736 ERROR (MainThread) [custom_components.toyota.config_flow] An unknown error occurred during login request: [Errno 13] Permission denied: '.cache'
(ha_venv3_12) thin620t:~/homeassistant_conf $curl -H @hass_header.txt http://192.168.1.32:8123/api/states/update.toyota_connected_services_europe_update
{"entity_id":"update.toyota_connected_services_europe_update","state":"off","attributes":{"auto_update":false,"installed_version":"v2.0.5","in_progress":false,"latest_version":"v2.0.5","release_summary":null,"release_url":"https://github.com/DurgNomis-drol/ha_toyota/releases/v2.0.5","skipped_version":null,"title":null,"entity_picture":"https://brands.home-assistant.io/_/toyota/icon.png","friendly_name":"Toyota Connected Services Europe update","supported_features":23},"last_changed":"2024-08-31T18:19:11.052714+00:00","last_reported":"2024-08-31T18:19:11.052714+00:00","last_updated":"2024-08-31T18:19:11.052714+00:00","context":{"id":"01J6MTK7ACQA68JW2R9AVNABC3","parent_id":null,"user_id":null}}
(ha_venv3_12) thin620t:~/homeassistant_conf $curl -H @hass_header.txt http://192.168.1.32:8curl -H @hass_header.txt http://192.168.1.32:8123/api/states/sensor.current_version
{"entity_id":"sensor.current_version","state":"2024.8.3","attributes":{"friendly_name":"Current Version"},"last_changed":"2024-08-31T18:19:10.096740+00:00","last_reported":"2024-08-31T18:19:10.096740+00:00","last_updated":"2024-08-31T18:19:10.096740+00:00","context":{"id":"01J6MTK6CG7VXC1H17M771R38E","parent_id":null,"user_id":null}}
(ha_venv3_12) thin620t:~/homeassistant_conf $
Describe the bug Cannot perform login, at the beginning of the integration's setup. Please see the Additional context section below.
To Reproduce Steps to reproduce the behavior:
Expected behavior Successful login or more clear error message.
Screenshots![hacs_toyota](https://github.com/DurgNomis-drol/ha_toyota/assets/2931982/563dd3af-2512-4ff4-8585-854b578f53fa)
Additional context
I'm running HASS on a Raspberry Pi 4