peterbuga / HASS-sonoff-ewelink

Home Assistant component to control Sonoff/eWeLink devices with original firmware
MIT License
797 stars 294 forks source link

https://cn-disp.coolkit.cc:8080/ certificate expired #257

Open x-Felix opened 4 years ago

x-Felix commented 4 years ago

I am trying to setup a new hassio and met sonoff setup issue.

Logger: homeassistant.setup
Source: custom_components/sonoff/__init__.py:326
First occurred: 1:09:00 PM (1 occurrences)
Last logged: 1:09:00 PM

Error during setup of component sonoff
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 936, in _wrap_create_connection
    return await self._loop.create_connection(*args, **kwargs)  # type: ignore  # noqa
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1050, in create_connection
    transport, protocol = await self._create_connection_transport(
  File "/usr/local/lib/python3.8/asyncio/base_events.py", line 1080, in _create_connection_transport
    await waiter
  File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 529, in data_received
    ssldata, appdata = self._sslpipe.feed_ssldata(data)
  File "/usr/local/lib/python3.8/asyncio/sslproto.py", line 189, in feed_ssldata
    self._sslobj.do_handshake()
  File "/usr/local/lib/python3.8/ssl.py", line 944, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 191, in _async_setup_component
    result = await task
  File "/config/custom_components/sonoff/__init__.py", line 74, in async_setup
    await hass.data[DOMAIN].do_login()
  File "/config/custom_components/sonoff/__init__.py", line 317, in do_login
    await self.set_wshost()
  File "/config/custom_components/sonoff/__init__.py", line 326, in set_wshost
    async with session.post('https://%s-disp.coolkit.cc:8080/dispatch/app' % self._api_region, headers=self._headers) as r:
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 1012, in __aenter__
    self._resp = await self._coro
  File "/usr/local/lib/python3.8/site-packages/aiohttp/client.py", line 480, in _request
    conn = await self._connector.connect(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 523, in connect
    proto = await self._create_connection(req, traces, timeout)
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 858, in _create_connection
    _, proto = await self._create_direct_connection(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 1004, in _create_direct_connection
    raise last_exc
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 980, in _create_direct_connection
    transp, proto = await self._wrap_create_connection(
  File "/usr/local/lib/python3.8/site-packages/aiohttp/connector.py", line 938, in _wrap_create_connection
    raise ClientConnectorCertificateError(
aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host cn-disp.coolkit.cc:8080 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: certificate has expired (_ssl.c:1108)')]

And then noticed https://cn-disp.coolkit.cc:8080 certificate expired two days ago.

Screen Shot 2020-09-10 at 13 25 35

Not sure who is owning that server and how to sort it out? Any option to ignore ssl cert verification? Thanks.

x-Felix commented 4 years ago

My temporary workaround is to modify __init__.py file to replace https://%s-disp.coolkit.cc:8080/dispatch/app with https://%s-api.coolkit.cc:8080/dispatch/app and it works for me now. I don’t know the difference of cn-api.coolkit.cc and cn-disp.coolkit.cc. But seems like same function to me. Hope eWeLink can renew the server certificate soon.