python-sagemcom-api icon indicating copy to clipboard operation
python-sagemcom-api copied to clipboard

Add support to 5360

Open jsongerber opened this issue 1 year ago • 0 comments

This is a continuation of this discussion on the ha integration.

Model information

Key Value
Model name 5360
Hardware Version 1.0
Software Version SG4D10001914

Used by Sunrise in Switzerland

Describe the bug

Get Cannot connect to host 192.168.1.1:443 ssl:default [[SSL: SSLV3_ALERT_HANDSHAKE_FAILURE] ssl/tls alert handshake failure (_ssl.c:1006)] error when trying to connect

To make it work, we can use those SSL settings:

import ssl

ssl_context = ssl.create_default_context()
ssl_context.check_hostname = False
ssl_context.verify_mode = ssl.CERT_NONE
ssl_context.set_ciphers("DEFAULT:@SECLEVEL=1")

And then we have to change the ClientSession instantiation to pass those new settings:

ClientSession(
  headers={"User-Agent": f"{DEFAULT_USER_AGENT}"},
  timeout=ClientTimeout(DEFAULT_TIMEOUT),
  connector=TCPConnector(
    ssl=ssl, # here we replace `verify_ssl` by `ssl`, which probably have unwanted side effects on other routers connection settings
  ),
)

Since I don't have experience with this library and not a python expert, I would appreciate your guidance as how to integrate this change if you're interested and if you want me to create a PR.

jsongerber avatar Nov 03 '24 18:11 jsongerber