LCN Integration fails to connect after upgrade from 2021.x version to 2023.07.01

Hi,
I’ve got a home assistant instance running at a friends house which is only used to control switches and covers using the lcn integration. LCN - Home Assistant

This worked for the last two years with a version 2021.x. This week home assistant was updated to 2023.07.01 and after that the lcn integration does not work anymore. It can’t connect to the LCN PKE anymore.

Following error message is thrown on startup:

Logger: homeassistant
Source: components/lcn/config_flow.py:61
First occurred: 21:53:55 (1 occurrences)
Last logged: 21:53:55

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 856, in async_init
    flow, result = await task
                   ^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 884, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 393, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/lcn/config_flow.py", line 78, in async_step_import
    await validate_connection(host_name, data)
  File "/usr/src/homeassistant/homeassistant/components/lcn/config_flow.py", line 61, in validate_connection
    await connection.async_connect(timeout=5)
  File "/usr/local/lib/python3.11/site-packages/pypck/connection.py", line 332, in async_connect
    raise awaitable.exception()  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pypck/connection.py", line 89, in async_connect
    self.reader, self.writer = await asyncio.open_connection(self.host, self.port)
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/streams.py", line 48, in open_connection
    transport, _ = await loop.create_connection(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 634, in sock_connect
    return await fut
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
    raise OSError(err, f'Connect call failed {address}')
OSError: [Errno 113] Connect call failed ('192.168.178.31', 4114

the minimal lcn config looks like this:

lcn:
  connections:
    - name: myhome
      host: 192.168.178.31
      port: 4114
      username: username
      password: password

We tried a complete fresh install of Home Assistant 2023.07.01 and only used the minimal config from above for lcn but the same error occured.

Did something in the network settings change in Home Assistant in the last versions which could lead to this problem? e.g. may it be that the ip address is now resolved differently?

How can I analyse this problem? E.g. can I eliminate that it is a home assistant problem and a network problem instead?

Does someone else had similiar issues?

Thanks,
Sven

Hi @sven1,

I have not noticed any problems with the LCN integration in 2023.07.01. Currently I‘m on 2023.07.02 which is also fine.
It seems that there are already problems connecting the PKE at the specified address. That could mean that your network setup has changed or the PKE is broken.
You could try to ping the PKE. In case it does not work ensure the IP address is right (could have changed if you use DHCP).
Can you connect with the LCN-Pro software?
Does a telnet connection to the host at port 4114 show up something?

Andre

Hi @alengwenus ,
sorry for the late reply. You were right the PKE was broken. We switched it for a new one, this broke after 5 days of use, now we have another one and it is looking good so far.

Thanks for your help,
Sven