Restart velux integration?

Hello,
I have a KLF200 to open/close my velux window system. It is a bit temperamental. I sometime have to restart the KLF for the connection between HA and the KLF to be reestablished. It works, sometime too.
I wonder if there is a way to restart the velux integration to “start fresh” between HA and the KLF?

When the connection fails I typically have this in the log:


I'm running HA Container 2022.12.8. 
2023-02-07 07:08:01.107 ERROR (MainThread) [homeassistant.core] Error executing service: <ServiceCall cover.close_cover
(c:01GRN7R5ZBKSV3KNGXJ0SKB1CE): entity_id=['cover.volet_cuisine']>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/core.py", line 1763, in catch_exceptions
    await coro_or_task
  File "/usr/src/homeassistant/homeassistant/core.py", line 1782, in _execute_service
    await cast(Callable[[ServiceCall], Awaitable[None]], handler.job.target)(
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 213, in handle_service
    await service.entity_service_call(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 678, in entity_service_call
    future.result()  # pop exception if have
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 943, in async_request_call
    await coro
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 715, in _handle_entity_call
    await result
  File "/usr/src/homeassistant/homeassistant/components/velux/cover.py", line 96, in async_close_cover
    await self.node.close(wait_for_completion=False)
  File "/usr/local/lib/python3.10/site-packages/pyvlx/opening_device.py", line 73, in close
    await self.set_position(
  File "/usr/local/lib/python3.10/site-packages/pyvlx/opening_device.py", line 47, in set_position
    await command_send.do_api_call()
  File "/usr/local/lib/python3.10/site-packages/pyvlx/api/api_event.py", line 21, in do_api_call
    await self.send_frame()
  File "/usr/local/lib/python3.10/site-packages/pyvlx/api/api_event.py", line 33, in send_frame
    await self.pyvlx.send_frame(self.request_frame())
  File "/usr/local/lib/python3.10/site-packages/pyvlx/pyvlx.py", line 66, in send_frame
    await self.connect()
  File "/usr/local/lib/python3.10/site-packages/pyvlx/pyvlx.py", line 43, in connect
    await self.connection.connect()
  File "/usr/local/lib/python3.10/site-packages/pyvlx/connection.py", line 86, in connect
    self.transport, _ = await self.loop.create_connection(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
    await waiter
ConnectionAbortedError: SSL handshake is taking longer than 60.0 seconds: aborting the connection

Thanks!

Have you tried this to reestablish the connection between KLF and HA?

I use the SERVICE VELUX.REBOOT_GATEWAY (that complex1 mentioned) using an automation during HA shutdown. It does seem to improve the situation, but it doesn’t fix it (at least not for me). I have a smart switch that I use to power cycle the KLF as a fall back.

Thank you both. I also have a switch to power cycle the KLF. It works. But not always. I was wondering if a restart of the integration itself could help.
I’ll try to combine both the restart from HA and then from the switch to see whether it improves the reliability of the solution.