ChessSpider / dvsportal

Home Assistant plugin for DVSPortal. A portal used by Dutch muncipalities for guest parking.
4 stars 0 forks source link

Connection failed #6

Closed 2Wanderer closed 3 weeks ago

2Wanderer commented 1 month ago

Hi! i currently experiencing an issue with the API connection to parkeerloket.zwolle.nl if i recall correctly after the 07-2024 HA update, are there more people having this issue? when i try to reconnect is says unknown error image

image

ChessSpider commented 1 month ago

Hi @2Wanderer , did the DVSPortal integration break first, and after you tried to re-add it which fails?

For me the integration still works without issue.

It seems to be this line throwing the error; https://github.com/ChessSpider/py-dvsportal/blob/main/dvsportal/dvsportal.py#L120C19-L120C56 - I have extended the error logging via this commit https://github.com/ChessSpider/dvsportal/pull/7

Can you update DVSportal to the latest version, retry it, and show me the error? You'll have to click the error in the logs, and more details will show.

When I try it; I get this error aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host parkeerloket.zwolle.nl:443 ssl:default [Network unreachable]. Which I cannot explain, as it should work. But im curious if you get the same error in the traceback

2Wanderer commented 1 month ago

Yes, i noticed it had become unresponsive I then deleted and tried to re-add the integration

i have updated the repo and tried to login again, i throws the following error:

Logger: root
Bron: custom_components/dvsportal/config_flow.py:58
integratie: DVSPortal ([documentatie](https://github.com/chessspider/dvsportal#readme), [problemen](https://github.com/ChessSpider/dvsportal/issues))
Eerst voorgekomen: 16:36:55 (1 gebeurtenissen)
Laatst gelogd: 16:36:55

Error in async step user
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection
    hosts = await self._resolve_host(host, port, traces=traces)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host
    return await asyncio.shield(resolved_host_task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle
    addrs = await self._resolver.resolve(host, port, family=self._family)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve
    infos = await self._loop.getaddrinfo(
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/base_events.py", line 901, in getaddrinfo
    return await self.run_in_executor(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/socket.py", line 964, in getaddrinfo
    for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
socket.gaierror: [Errno -5] Name has no usable address

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 111, in _request
    response = await self._session.request(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection
    raise ClientConnectorError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host https:443 ssl:default [Name has no usable address]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/config/custom_components/dvsportal/config_flow.py", line 58, in async_step_user
    info = await validate_input(self.hass, user_input, self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/dvsportal/config_flow.py", line 38, in validate_input
    await dvs_portal.token()
  File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 152, in token
    await self.fetch_default_type_id()
  File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 142, in fetch_default_type_id
    response = await self._request("login", method="GET")  # Adjust if the URI is different for the GET request.
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 119, in _request
    raise DVSPortalConnectionError(
dvsportal.exceptions.DVSPortalConnectionError: Error occurred while communicating with DVSPortal.
ChessSpider commented 1 month ago

Can you double check you're entering parkeerloket.zwolle.nl as hostname, and not e.g. https://parkeerloket.zwolle.nl or a different value ?

2Wanderer commented 1 month ago

I did, and double checked it again. But it made no difference, still the 'unknow error' popsup.

The log output:

Deze fout is ontstaan door een aangepaste integratie.

Logger: root Bron: custom_components/dvsportal/config_flow.py:58 integratie: dvsportal (documentatie, problemen) Eerst voorgekomen: 12 juli 2024 om 16:36:55 (4 gebeurtenissen) Laatst gelogd: 10:10:21

Error in async step user Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1203, in _create_direct_connection hosts = await self._resolve_host(host, port, traces=traces) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 880, in _resolve_host return await asyncio.shield(resolved_host_task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 917, in _resolve_host_with_throttle addrs = await self._resolver.resolve(host, port, family=self._family) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/resolver.py", line 33, in resolve infos = await self._loop.getaddrinfo( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/asyncio/base_events.py", line 901, in getaddrinfo return await self.run_in_executor( ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run result = self.fn(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/socket.py", line 964, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno -5] Name has no usable address

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 111, in _request response = await self._session.request( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 581, in _request conn = await self._connector.connect( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 544, in connect proto = await self._create_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 944, in _createconnection , proto = await self._create_direct_connection(req, traces, timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1209, in _create_direct_connection raise ClientConnectorError(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host https:443 ssl:default [Name has no usable address]

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/config/custom_components/dvsportal/config_flow.py", line 58, in async_step_user info = await validate_input(self.hass, user_input, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/dvsportal/config_flow.py", line 38, in validate_input await dvs_portal.token() File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 152, in token await self.fetch_default_type_id() File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 142, in fetch_default_type_id response = await self._request("login", method="GET") # Adjust if the URI is different for the GET request. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/dvsportal/dvsportal.py", line 119, in _request raise DVSPortalConnectionError( dvsportal.exceptions.DVSPortalConnectionError: Error occurred while communicating with DVSPortal.

2Wanderer commented 3 weeks ago

I tried again today, and all of a sudden it reconnected and is working like expected again. It must have been something on the server side. Thank for your support anyway!

ChessSpider commented 3 weeks ago

Nice! Happy to hear it's working again

Op ma 5 aug 2024 16:52 schreef 2Wanderer @.***>:

I tried again today, and all of a sudden it reconnected and is working like expected again. It must have been something on the server side. Thank for your support anyway!

— Reply to this email directly, view it on GitHub https://github.com/ChessSpider/dvsportal/issues/6#issuecomment-2269268374, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQRMNASFHHZTTEKUSCSV3DZP6GRXAVCNFSM6AAAAABKXSY6RKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRZGI3DQMZXGQ . You are receiving this because you were assigned.Message ID: @.***>