p0l0 / hapetwalk

Home Assistant integration for petWALK.control
MIT License
5 stars 2 forks source link

Unexpected error when trying to add integration #146

Open Tywele opened 1 day ago

Tywele commented 1 day ago

Checklist

Describe the issue

When trying to add the integration to my Home Assistant I get an Unexpected Error. 192.168.178.108 is the IP address of my PetWalk door.

Reproduction steps

  1. Click on Add Integration
  2. Input internal IP address of PetWalk door
  3. Enter credentials of PetWalk account
  4. See Unexpected Error

Debug logs

2024-12-02 10:53:00.030 ERROR (MainThread) [pypetwalk.api.api] Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]
2024-12-02 10:53:00.033 ERROR (MainThread) [custom_components.petwalk.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1109, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.178.108', 8080)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 101, in send_command
    async with self.__get_session().get(url) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1360, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 663, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 538, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1050, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1384, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1353, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1124, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]

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

Traceback (most recent call last):
  File "/config/custom_components/petwalk/config_flow.py", line 84, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/petwalk/config_flow.py", line 44, in validate_input
    await api.get_system_state()
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/pypetwalk.py", line 291, in get_system_state
    return await self.__api_get_state(API_STATE_SYSTEM)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/pypetwalk.py", line 299, in __api_get_state
    resp = await getattr(self.api_client, method)()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 66, in get_states
    return await self.send_command("state", None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 111, in send_command
    raise PyPetWALKClientConnectionError(ex) from ex
pypetwalk.exceptions.PyPetWALKClientConnectionError: Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]
2024-12-02 10:53:36.440 ERROR (MainThread) [pypetwalk.api.api] Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]
2024-12-02 10:53:36.440 ERROR (MainThread) [custom_components.petwalk.config_flow] Unexpected exception
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1109, in _wrap_create_connection
    sock = await aiohappyeyeballs.start_connection(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 104, in start_connection
    raise first_exception
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 82, in start_connection
    sock = await _connect_sock(
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohappyeyeballs/impl.py", line 174, in _connect_sock
    await loop.sock_connect(sock, address)
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 641, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.12/asyncio/selector_events.py", line 681, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.178.108', 8080)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 101, in send_command
    async with self.__get_session().get(url) as resp:
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 1360, in __aenter__
    self._resp: _RetType = await self._coro
                           ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client.py", line 663, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 538, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1050, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1384, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1353, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/aiohttp/connector.py", line 1124, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]

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

Traceback (most recent call last):
  File "/config/custom_components/petwalk/config_flow.py", line 84, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/petwalk/config_flow.py", line 44, in validate_input
    await api.get_system_state()
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/pypetwalk.py", line 291, in get_system_state
    return await self.__api_get_state(API_STATE_SYSTEM)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/pypetwalk.py", line 299, in __api_get_state
    resp = await getattr(self.api_client, method)()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 66, in get_states
    return await self.send_command("state", None)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pypetwalk/api/api.py", line 111, in send_command
    raise PyPetWALKClientConnectionError(ex) from ex
pypetwalk.exceptions.PyPetWALKClientConnectionError: Cannot connect to host 192.168.178.108:8080 ssl:default [Connect call failed ('192.168.178.108', 8080)]