tschamm / boschshcpy

Bosch Smart Home Controller API Python Library
BSD 3-Clause "New" or "Revised" License
56 stars 17 forks source link

SSLError when trying to creat a session #28

Open ceedee666 opened 1 year ago

ceedee666 commented 1 year ago

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

hh-it-co commented 10 months ago

+1

tschamm commented 3 weeks ago

still occurs?