All Entities not available
michas79 opened this issue · comments
Hi,
at first thanks for all your good work. I have a problem with this integration. It happend now the 3rd time. So maybe it is worth to have a look at it.
After reboot of my HA Hardware the VWID integration won't work any more. I get the following errors:
2021-11-26 10:44:31 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up vwid platform for sensor
Traceback (most recent call last):
File "/config/custom_components/vwid/sensor.py", line 65, in async_update_data
data = await api.get_status()
File "/config/custom_components/vwid/libvwid.py", line 145, in get_status
response = await self.session.get(API_BASE + "/vehicles/" + self.vin + "/status", headers=self.headers)
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 520, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 535, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 892, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 1020, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.9/site-packages/aiohttp/connector.py", line 969, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore # noqa
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1081, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1111, in _create_connection_transport
await waiter
asyncio.exceptions.CancelledError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/config/custom_components/vwid/sensor.py", line 70, in async_update_data
_LOGGER.exception("Error retrieving data")
File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 55, in __aexit__
self._do_exit(exc_type)
File "/usr/local/lib/python3.9/site-packages/async_timeout/__init__.py", line 92, in _do_exit
raise asyncio.TimeoutError
asyncio.exceptions.TimeoutError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 187, in _async_refresh
self.data = await self._async_update_data()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 147, in _async_update_data
return await self.update_method()
File "/config/custom_components/vwid/sensor.py", line 71, in async_update_data
except ApiAuthError as err:
NameError: name 'ApiAuthError' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 249, in _async_setup_platform
await asyncio.shield(task)
File "/config/custom_components/vwid/sensor.py", line 87, in async_setup_entry
await coordinator.async_config_entry_first_refresh()
File "/usr/src/homeassistant/homeassistant/helpers/update_coordinator.py", line 161, in async_config_entry_first_refresh
raise ex
homeassistant.exceptions.ConfigEntryNotReady: name 'ApiAuthError' is not defined
After that I have to delete the integratio and add it again. Then everything works until next restart my Pi.
Do you have any idea, what I do wrong?
Kind Regards
Micha
Not sure why this happens on your system specifically, but anyways it seems like I should handle that exception better. I will make a bugfix branch for you to try. Not sure when I can have it ready, but I will keep you updated here.
@michas79 Before I have a look at this; do you still have this issue if you pull the latest changes?
@skagmo I can't say. I reinstalled that component but now nothing works. I only get errors and no entity is visible anymore.
Logger: homeassistant.components.sensor
Source: custom_components/vwid/libvwid.py:88
Integration: Sensor ([documentation](https://www.home-assistant.io/integrations/sensor), [issues](https://github.com/home-assistant/home-assistant/issues?q=is%3Aissue+is%3Aopen+label%3A%22integration%3A+sensor%22))
First occurred: 13:03:23 (1 occurrences)
Last logged: 13:03:23
vwid: Error on device update!
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 431, in _async_add_entity
await entity.async_device_update(warning=False)
File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 684, in async_device_update
await task
File "/config/custom_components/vwid/sensor.py", line 92, in async_update
data = await self.api.get_status()
File "/config/custom_components/vwid/libvwid.py", line 196, in get_status
if await self.reconnect():
File "/config/custom_components/vwid/libvwid.py", line 88, in reconnect
response = await self.session.get(LOGIN_BASE + '/authorize', params=payload)
File "/usr/local/lib/python3.9/site-packages/aiohttp/client.py", line 621, in _request
raise ValueError("Can redirect only to http or https")
ValueError: Can redirect only to http or https