dkarv / hacs-bwt-perla

Custom HA integration for BWT Perla devices
MIT License
14 stars 1 forks source link

Connection problem #3

Closed mat-l closed 9 months ago

mat-l commented 9 months ago

Thanks a lot for developing this integration which I am looking for since a while.

I have connected my BWT Perla Home to Wifi and tested the login-code in the VNC client and logging in works fine. Data is als send via Wifi to their severs and is visible in their app.

Unfortunately, if I would like to connect to Perla Home with your integration from Homeassistant I am getting a "connection problem" message, but no entries in the logs.

image

Any idea what is going wrong?

dkarv commented 9 months ago

Can you enable the debug logging for the integration: https://www.home-assistant.io/docs/configuration/troubleshooting/#enabling-debug-logging Afterwards it should print something to the logs to give us a better hint what is going on.

mat-l commented 9 months ago

Unfortunately I cannot activate debug logging as the integration does not yet appear in the "devices & services" place as the configuration fails beforehand. Is there any other way to activate logging?

dkarv commented 9 months ago

I think you can go to http:///config/integrations/integration/bwt_perla and enable it there

mat-l commented 9 months ago

Hmm, a bit closer, but sadly it just shows a link to documentation and to known issues, but no possibility to enable debugging. Screenshot_20240105_204313_org mozilla firefox_edit_54029820591233

dkarv commented 9 months ago

I pushed a new version now with more logging. It should show an error now in the logs, even without debugging enabled. Please update and try again.

mat-l commented 9 months ago

All right, thanks. Here you go:

Dieser Fehler wurde von einer benutzerdefinierten Integration verursacht

Logger: custom_components.bwt_perla.config_flow
Source: custom_components/bwt_perla/config_flow.py:50
Integration: BWT Perla (documentation, issues)
First occurred: 22:30:58 (1 occurrences)
Last logged: 22:30:58

Connection error setting up the Bwt Api
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 992, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
    raise exceptions[0]
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
    sock = await self._connect_sock(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
    await self.sock_connect(sock, address)
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 628, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 668, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
ConnectionRefusedError: [Errno 111] Connect call failed ('192.168.178.62', 8080)

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/bwt_api/api.py", line 48, in __get_data
    async with self._session.get(f"http://{self._host}:8080/api/{endpoint}") as response:
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 1187, in __aenter__
    self._resp = await self._coro
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/client.py", line 574, in _request
    conn = await self._connector.connect(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 544, in connect
    proto = await self._create_connection(req, traces, timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 911, in _create_connection
    _, proto = await self._create_direct_connection(req, traces, timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1235, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1204, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/connector.py", line 1000, in _wrap_create_connection
    raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host 192.168.178.62:8080 ssl:default [Connect call failed ('192.168.178.62', 8080)]

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

Traceback (most recent call last):
  File "/config/custom_components/bwt_perla/config_flow.py", line 50, in async_step_user
    info = await validate_input(self.hass, user_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/config/custom_components/bwt_perla/config_flow.py", line 32, in validate_input
    await api.get_current_data()
  File "/usr/local/lib/python3.11/site-packages/bwt_api/api.py", line 74, in get_current_data
    raw = await self.__get_data("GetCurrentData")
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/bwt_api/api.py", line 63, in __get_data
    raise ConnectException from e
bwt_api.exception.ConnectException
mat-l commented 9 months ago

As a side note: if I open the IP address of the device, e.g. 192.168.178.62 then in the browser I get forwarded to http://192.168.178.62:6080/vnc.html?resize=scale&autoconnect=true&show_dot=true

After some while, not on mobile, the browser based login appears, where I entered the login-code, which worked. Screenshot_20240105_224623_org mozilla firefox

dkarv commented 9 months ago

Can you check your firmware version and if the local API is enabled? You need at least firmware 2.02xx which adds the local API.

Then activate it in Einstellungen > Verbindung > API If you open 192.168.178.62:8080 in the browser it should display Not Found.

If all of this works, there is a connection issue between HA and your Bwt device. You could try to ping or access it somehow from within HA to see if this works.

mat-l commented 9 months ago

Oh man - I am sorry I missread the firmware version. I have 2.0018 and thought I just need 2.x Will wait a few weeks until I get the update (hopefully it arrives soon) and will then recheck your integration. Thanks a lot for your help.

dkarv commented 9 months ago

No problem! To get the update, you can contact the customer service. I don't want to put the email here, but another user recently was successful with this one: https://community.home-assistant.io/t/bwt-best-water-tech-nology-support/270745/118 Just add your serial number and they will push it to your device. It seems this version is still not officially rolled out.