Replies: 4 comments
-
looks similiar to this issue #56 caused by HA upgrading to python 3.10 and kia having weak ssl cert fixed by the top four commits here https://github.com/dahlb/kia_hyundai_api/commits/master/src/kia_hyundai_api/us_kia.py I don't have a hyundai so i can't verify a fix but if you want to open a pr for https://github.com/dahlb/kia_hyundai_api/blob/master/src/kia_hyundai_api/us_hyundai.py I'll merge it or if your will to test changes I can try to come up with a fix |
Beta Was this translation helpful? Give feedback.
-
I ported the kia fix over to hyundai's code on master, please let me know if that helps you. |
Beta Was this translation helpful? Give feedback.
-
moved this over to issues for easier tracking |
Beta Was this translation helpful? Give feedback.
-
for reference #58 |
Beta Was this translation helpful? Give feedback.
-
Bringing this up here before I resort to poking into the integration internals myself.
In the UI I get "Unknown error occurred" on a login attempt during initial configuration of the integration.
It looks like it is not actually an error with the integration though, the 'dh key too small' in aiohttp I can find multiple discussions around and potential fixes. This is happening on a fresh install of HAOS (aka Alpine 3.16) on a NUC, so it seems like it would be a problem others will hit since this seems to be dependent upon the hyndai back end having weak SSL if I'm understanding things correctly.
This error originated from a custom integration.
Logger: aiohttp.server
Source: custom_components/ha_kia_hyundai/api_cloud_us_hyundai.py:66
Integration: Kia/Hyundai (documentation, issues)
First occurred: 10:08:06 AM (1 occurrences)
Last logged: 10:08:06 AM
Error handling request
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 986, in _wrap_create_connection
return await self._loop.create_connection(*args, **kwargs) # type: ignore[return-value] # noqa
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1089, in create_connection
transport, protocol = await self._create_connection_transport(
File "/usr/local/lib/python3.10/asyncio/base_events.py", line 1119, in _create_connection_transport
await waiter
File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 534, in data_received
ssldata, appdata = self._sslpipe.feed_ssldata(data)
File "/usr/local/lib/python3.10/asyncio/sslproto.py", line 188, in feed_ssldata
self._sslobj.do_handshake()
File "/usr/local/lib/python3.10/ssl.py", line 975, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:997)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
resp = await request_handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
resp = await handler(request)
File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 79, in ban_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
return await handler(request)
File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
result = await result
File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 177, in post
return await super().post(request, flow_id)
File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 62, in wrapper
result = await method(view, request, *args, **kwargs)
File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 109, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 277, in async_configure
result = await self._async_handle_step(
File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 359, in _async_handle_step
result: FlowResult = await getattr(flow, method)(user_input)
File "/config/custom_components/ha_kia_hyundai/config_flow.py", line 141, in async_step_auth
await api_cloud.login()
File "/config/custom_components/ha_kia_hyundai/api_cloud_us_hyundai.py", line 66, in login
self._access_token, _, _ = await self.api.login(
File "/usr/local/lib/python3.10/site-packages/kia_hyundai_api/us_hyundai.py", line 166, in login
await self._post_request_with_logging_and_errors_raised(
File "/usr/local/lib/python3.10/site-packages/kia_hyundai_api/us_hyundai.py", line 31, in request_with_logging_wrapper
response = await func(*args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/kia_hyundai_api/us_hyundai.py", line 134, in _post_request_with_logging_and_errors_raised
return await self.api_session.post(url=url, json=json_body, headers=headers)
File "/usr/local/lib/python3.10/site-packages/aiohttp/client.py", line 535, in _request
conn = await self._connector.connect(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 542, in connect
proto = await self._create_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 907, in _create_connection
_, proto = await self._create_direct_connection(req, traces, timeout)
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1206, in _create_direct_connection
raise last_exc
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 1175, in _create_direct_connection
transp, proto = await self._wrap_create_connection(
File "/usr/local/lib/python3.10/site-packages/aiohttp/connector.py", line 990, in _wrap_create_connection
raise ClientConnectorSSLError(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorSSLError: Cannot connect to host api.telematics.hyundaiusa.com:443 ssl:default [[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:997)]
<<
Beta Was this translation helpful? Give feedback.
All reactions