-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TLS v1 Fix in v 6.3 causing issues - rollback to 6.2 fixes issue #114
Comments
Hi @ColinSainsbury I wrote the patch for tls v1 so I can help you and you can help me solve the problem. |
@samuelecarpene thanks for coming back to me. My configuration is that I have an EHS Mono Quiet AE120BXYDEG/EU ASHP connected via the MIM-H04EN. I will run the test scenarios you suggest and report back. |
Hopefully these logs will help. I have a secondary connection to the REST API running through a Climate Template https://github.com/jcwillox/hass-template-climate which I discovered before the MIM-H04EN connectivity was added to this integration. |
I think I understand the problem.
if 'cert' in self._params :
tls_version = '1' with if not self._params.url.startwith('https://api.smartthings.com')
if 'cert' in self._params :
tls_version = '1' Pay attention to correct indentation. I can't test this code right now because I'm having router issues. Can you try these 2 things and let me know the result? If there are errors the logs are helpful. Thanks. |
The bad news is that neither worked. I tried them independently. Removing reference to the certificate PEM file appeared to have no obvious effect. The code change above caused the integration not to start. I have attempted to capture logs. Logger: homeassistant.util.loop Detected blocking call to load_default_certs with args (<ssl.SSLContext object at 0x7fb2267f4050>, <Purpose.SERVER_AUTH: _ASN1Object(nid=129, shortname='serverAuth', longname='TLS Web Server Authentication', oid='1.3.6.1.5.5.7.3.1')>) inside the event loop by custom integration 'climate_ip' at custom_components/climate_ip/connection_request.py, line 29: ssl_context = ssl.create_default_context() (offender: /usr/local/lib/python3.12/ssl.py, line 713: context.load_default_certs(purpose)), please create a bug report at https://github.com/atxbyea/samsungrac/issues For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#load_default_certs Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 189, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1990, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/config/custom_components/climate_ip/climate.py", line 125, in async_setup_platform device_controller = await create_controller( File "/config/custom_components/climate_ip/controller.py", line 71, in create_controller if await c.initialize(): File "/config/custom_components/climate_ip/controller_yaml.py", line 177, in initialize self.update_state() File "/config/custom_components/climate_ip/controller_yaml.py", line 229, in update_state self._state_getter.update_state(self._state_getter.value, debug) File "/config/custom_components/climate_ip/properties.py", line 254, in update_state device_state = self.get_connection(None).execute( File "/config/custom_components/climate_ip/connection_request.py", line 180, in execute j, ok, code = self.execute_internal(template, value, device_state) File "/config/custom_components/climate_ip/connection_request.py", line 123, in execute_internal session.mount("https://", SamsungHTTPAdapter()) File "/config/custom_components/climate_ip/connection_request.py", line 26, in init super().init(*args, **kwargs) File "/usr/local/lib/python3.12/site-packages/requests/adapters.py", line 222, in init self.init_poolmanager(pool_connections, pool_maxsize, block=pool_block) File "/config/custom_components/climate_ip/connection_request.py", line 29, in init_poolmanager ssl_context = ssl.create_default_context() |
@ColinSainsbury i noticed that there are other pieces of code related to cert configuration. Here the first one So, try to set None to default here instead of string empty. I don't know if this can be a problem. Give it a try. PS: For the second test I posted in the previous comment i saw that i made 1 or more mistakes. if not self._params.url.startwith('https://api.smartthings.com') :
if 'cert' in self._params :
tls_version = '1' But i'm not very familiar with python so try this that i think it works. if not 'https://api.smartthings.com' in self._params.url :
if 'cert' in self._params :
tls_version = '1' I will try to debug my installation in the next few days. Let me know. |
@samuelecarpene I made all the changes you suggested above except the indent you suggested for line 76 in connection_request.py but the integration failed to start. I was uncertain about the change you were looking for to the indentation so left it alone. Here are the error messages from the log: |
try using string. cert_file = hass_config.get(CONF_CERT, "")
if cert_file != "" and cert_file is not None: please try these things separately so we can understand where is the problem. |
OK - I reverted to the original 6.3 download Error message: Request result exception: HTTPSConnectionPool(host='api.smartthings.com', port=443): Max retries exceeded with url: /v1/devices/MY_DEVICE_ID/status/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1000)'))) |
I will try to investigate and study the problem. The fact is that there seems to be 2 scenarios:
|
I noticed that for 2878 devices there is a specific connection parameter
So, for MIM-H04EN i think there can be a similar solution. Basically, to create a specific connection that these devices can use. I will try to write the connection and let you know. Maybe @MichaelMraka that made this pull request #97 can help us. |
@ColinSainsbury try this samuelecarpene@d8554f7 and let me know. |
@samuelecarpene Thank you so much for your efforts here. The integration failed to start. The log output is below: Logger: homeassistant.components.climate Error while setting up climate_ip platform for climate This error originated from a custom integration. Logger: custom_components.climate_ip Traceback (most recent call last): File "/config/custom_components/climate_ip/climate.py", line 126, in async_setup_platform device_controller = await create_controller( ^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/climate_ip/controller.py", line 71, in create_controller if await c.initialize(): ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/climate_ip/controller_yaml.py", line 141, in initialize connection = create_connection(connection_node, self._config, self._logger) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/climate_ip/connection.py", line 44, in create_connection c = conn(config, logger) ^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/climate_ip/connection_request_tls_auto.py", line 161, in init super(ConnectionRequest, self).init(hass_config, logger) ^^^^^^^^^^^^^^^^^ NameError: name 'ConnectionRequest' is not defined. Did you mean: 'ConnectionRequestBase'? |
Maybe these modifications fix the problem. |
@samuelecarpene That works for me - you are an absolute star - thank you so much. I will leave the issue open for a couple of days in case others have issues and then close. I will put a beer in an email for you. |
Don't close the issue, I will make a pull request for this issue. Then when the pull request is accepted the issue will be closed. Thank you for the beer! |
I'm having the same or similar issue also with I think the same samsung hardware and running HAOS
But it's strange because @samuelecarpene fix seems to be in the latest code and I've checked the file in my installation. My configuration: climate:
# hot water controller
- platform: climate_ip
name: Samsung EHS DHW
config_file: /config/custom_components/climate_ip/samsung_smartthings_dhw.yaml
ip_address: api.smartthings.com
device_id: edited
token: !secret smartthings_token
# heating controller
- platform: climate_ip
name: Samsung EHS Heating
config_file: /config/custom_components/climate_ip/samsung_smartthings_hvac.yaml
ip_address: api.smartthings.com
device_id: edited
token: !secret smartthings_token |
Just a bump since my last comment was during the holidays |
v 6.3 update causes HTTPS errors
Logger: custom_components.climate_ip
Source: custom_components/climate_ip/connection_request.py:163
integration: climate_ip (documentation, issues)
First occurred: 13:55:46 (653 occurrences)
Last logged: 15:17:04
Request result exception: HTTPSConnectionPool(host='api.smartthings.com', port=443): Max retries exceeded with url: /v1/devices/XXXXXXXXXXXXXXXXXXXXXX/status/ (Caused by SSLError(SSLError(1, '[SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:1000)')))
I have obscured my device ID . This was working fine before the update to 6.3 and rolling back to 6.2 fixes the issue.
The text was updated successfully, but these errors were encountered: