pawlizio / my_velux

Custom component of velux integration for Home Assistant
31 stars 9 forks source link

SSL handshake is taking longer than 5 seconds #5

Closed enricozocca closed 2 years ago

enricozocca commented 3 years ago

Hello, after upgrade to HA 2020.12.1 velux component doesn't work. There is an SSL handshake issue, only way to bring online again is to physically reboot KLF200 but it work only for a few minute, after hang again.

Regards Enrico

2020-12-21 19:34:23 WARNING (MainThread) [custom_components.velux] Unable to connect to KLF200: SSL handshake is taking longer than 5 seconds: aborting the connection 2020-12-21 19:34:23 WARNING (MainThread) [homeassistant.config_entries] Config entry for velux not ready yet. Retrying in 10 seconds 2020-12-21 19:34:33 DEBUG (MainThread) [custom_components.velux] Setting up velux entry: {'host': '192.168.1.84', 'password': 'xxxxx'} 2020-12-21 19:34:33 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:34:38 WARNING (MainThread) [custom_components.velux] Unable to connect to KLF200: SSL handshake is taking longer than 5 seconds: aborting the connection 2020-12-21 19:34:38 WARNING (MainThread) [homeassistant.config_entries] Config entry for velux not ready yet. Retrying in 20 seconds 2020-12-21 19:34:58 DEBUG (MainThread) [custom_components.velux] Setting up velux entry: {'host': '192.168.1.84', 'password': 'xxxx'} 2020-12-21 19:34:58 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:35:03 WARNING (MainThread) [custom_components.velux] Unable to connect to KLF200: SSL handshake is taking longer than 5 seconds: aborting the connection 2020-12-21 19:35:03 WARNING (MainThread) [homeassistant.config_entries] Config entry for velux not ready yet. Retrying in 40 seconds 2020-12-21 19:35:08 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:35:18 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:35:33 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:35:43 DEBUG (MainThread) [custom_components.velux] Setting up velux entry: {'host': '192.168.1.84', 'password': 'xxxxxx} 2020-12-21 19:35:43 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:35:48 WARNING (MainThread) [custom_components.velux] Unable to connect to KLF200: SSL handshake is taking longer than 5 seconds: aborting the connection 2020-12-21 19:35:48 WARNING (MainThread) [homeassistant.config_entries] Config entry for velux not ready yet. Retrying in 80 seconds 2020-12-21 19:35:58 WARNING (MainThread) [pyvlx] Connecting to KLF 200. 2020-12-21 19:36:43 WARNING (MainThread) [pyvlx] Connecting to KLF 200.

pawlizio commented 3 years ago

This is a known issue of KLF200. It freezes after connection interuptions with Home Assistant, for example in case of HA reboot, i.e. after an update. Only a power reset solves that issue.

In order to avoid that I recommend to create an automation which forces the KLF200 to a reboot before HA restarts:

alias: KLF reboot on hass stop event
description: 'Reboots the KLF200 in order to avoid SSL Handshake issue'
trigger:
  - event_data: {}
    event_type: homeassistant_stop
    platform: event
condition: []
action:
  - data: {}
    service: velux.reboot_gateway
mode: single

Regards, Paul

enricozocca commented 3 years ago

Thank you for reply, I created and it worked until I upgraded HA to 2020.12.1. Now when I restart HA integration works for a few minutes, after it doesn't responde. I rollback to HA 118.5 and velux component version 1.5 and work like a charm.

enricozocca commented 3 years ago

Hello Paul, After upgrade to 2021.3.x KLF200 stop working! HA return -23% as position value. It seems that after a few minute KLF totaly stop responding (it's hang), also i'm not be able to test open/close (locate) from klf web management it respond with an error device is busy. Only way to restore functionality is to disconnect KLF from network (or shutdown HA), reboot it and after I can do a "test locate" for web gui. When I reconnect it on network it stop working. with core-2021.2.3 it's working like a charm. Same issue if I try to install your my_velux custom component.

Enrico

pawlizio commented 2 years ago

I'm not sure if this is still open, but please note that the events has been renamed by HA, so the automation in order to reboot the KLF200 has to be renamed:

alias: KLF reboot on hass stop event
description: Reboots the KLF200 in order to avoid SSL Handshake issue
trigger:
  - platform: homeassistant
    event: shutdown
condition: []
action:
  - service: velux.reboot_gateway
    data: {}
mode: single
pawlizio commented 2 years ago

Finally this issue is the same as #11, so I'll close this one.