Connection from Home Assistant keeps failing

I have a working ESPHome Starter Kit that’s reachable on Wifi and displaying the built-in web page. But the last step, adding it to Home Assistant, fails.

In the HA logs I see this:

Logger: aioesphomeapi.connection
Source: /usr/local/lib/python3.14/site-packages/aioesphomeapi/client.py:371
First occurred: 10:51:04 (10 occurrences)
Last logged: 11:29:15

    192.168.168.117: Connection error occurred: Error while finishing connection: aioesphomeapi.connection.APIConnection size changed, may indicate binary incompatibility. Expected 240 from C header, got 232 from PyObject
    192.168.168.117: Connection error occurred: Error while finishing connection: '__reduce_cython__'

Traceback (most recent call last):
  File "aioesphomeapi/connection.py", line 866, in aioesphomeapi.connection.APIConnection.finish_connection
  File "aioesphomeapi/connection.py", line 869, in aioesphomeapi.connection.APIConnection.finish_connection
    klass = UnhandledAPIConnectionError
  File "aioesphomeapi/connection.py", line 851, in _do_finish_connect
    if isinstance(ex, APIConnectionError):
  File "aioesphomeapi/connection.py", line 560, in _connect_init_frame_helper
    self._socket.setsockopt(
  File "aioesphomeapi/connection.py", line 108, in _async_load_noise_frame_helper
    async with lock:
  File "aioesphomeapi/connection.py", line 112, in aioesphomeapi.connection._async_load_noise_frame_helper
    return await loop.run_in_executor(None, _import_noise_frame_helper)
  File "/usr/local/lib/python3.14/concurrent/futures/thread.py", line 86, in run
    result = ctx.run(self.task)
  File "/usr/local/lib/python3.14/concurrent/futures/thread.py", line 73, in run
    return fn(*args, **kwargs)
  File "aioesphomeapi/connection.py", line 85, in aioesphomeapi.connection._import_noise_frame_helper
    from ._frame_helper.noise import APINoiseFrameHelper  # noqa: PLC0415
  File "aioesphomeapi/_frame_helper/noise.py", line 1, in init aioesphomeapi._frame_helper.noise
ValueError: aioesphomeapi.connection.APIConnection size changed, may indicate binary incompatibility. Expected 240 from C header, got 232 from PyObject

On the Starter Kit side I see this:

11:29:15 [D] [api:255] Accept 192.168.168.27
11:29:15 [W] [component:313] api cleared Warning flag
11:29:15 [W] [api.connection:2599] 192.168.168.27 (192.168.168.27): Socket operation failed CONNECTION_CLOSED errno=128
11:29:15 [W] [component:290] api set Warning flag: waiting for client connection

I am running the latest HA (2026.8.3) on the latest HA OS (18.2) on dedicated hardware. HA is connected via Ethernet, the Starter Kit is on Wifi and reachable by browser.

@jensv Do you have an integration called Geberit AquaClean enabled on your HA?

@debtquity Yes I do.

@jensv I would try disabling it (removing it entirely, if possible!) then restarting your HA instance. You should then be able to connect to the esphome device.

There is a known bug with this integration that causes your exact issue. There’s a proposed fix, but seems maintainer of this integration has not responded.

alternatively, in that same gh issue you can keep it enabled, but you would have to edit some files on the machine hosting HA, and perform manual rebuild and restart of HA.

good luck!

Thank you very much for pointing me to that issue! I am seeing the intermittent nature as well, sometimes it seems to just work and sometimes not at all. That explains everything.