tschamm / boschshcpy

Bosch Smart Home Controller API Python Library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SSLError when trying to creat a session

ceedee666 opened this issue · comments

I'm currently trying to add support for tilting blinds in boschshcpy. However, I'm facing the problem that whenever I try to create a session I get a SSLError.

This is the code I'm using to create a session:

session = boschshcpy.SHCSession(controller_ip="192.168.178.15", certificate='examples/keystore/dev-cert.pem', key='examples/keystore/dev-key.pem')

Executing it leads to the following error:

ERROR:root:Failed to get public information from SHC controller: API call returned SSLError: HTTPSConnectionPool(host='192.168.178.15', port=8446): Max retries exceeded with url: /smarthome/public/information (Caused by SSLError(SSLCertVerificationError(1, "[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: IP address mismatch, certificate is not valid for '192.168.178.15'. (_ssl.c:1002)"))).
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/christian/Documents/development/boschshcpy/boschshcpy/session.py", line 44, in __init__
    self._enumerate_all()
  File "/Users/christian/Documents/development/boschshcpy/boschshcpy/session.py", line 55, in _enumerate_all
    self.authenticate()
  File "/Users/christian/Documents/development/boschshcpy/boschshcpy/session.py", line 276, in authenticate
    self._shc_information = SHCInformation(api=self._api, zeroconf=self._zeroconf)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/christian/Documents/development/boschshcpy/boschshcpy/information.py", line 77, in __init__
    raise SHCConnectionError
boschshcpy.exceptions.SHCConnectionError

Using the same certificate I can connect using Postman to the controller without problems.
Also, I already tried to set the ssl.VerifyMode to CERT_NONE.

Any ideas how to solve this?

Christian