peterbuga / HASS-sonoff-ewelink

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

Error during setup of component sonoff #284

Open davidwang2000 opened 3 years ago

davidwang2000 commented 3 years ago

HASSIO Core 2021.4.5 Home Assistant OS 5.13

Call Stack:

Log Details (ERROR) Logger: homeassistant.setup Source: util/async_.py:139 First occurred: April 18, 2021, 5:49:33 PM (1 occurrences) Last logged: April 18, 2021, 5:49:33 PM

Error during setup of component sonoff Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 242, in _async_setup_component result = await task File "/config/custom_components/sonoff/init.py", line 53, in async_setup hass.data[DOMAIN] = Sonoff(hass, config) File "/config/custom_components/sonoff/init.py", line 100, in init self.do_login() File "/config/custom_components/sonoff/init.py", line 175, in do_login r = requests.post('https://{}-api.coolkit.cc:8080/api/user/login'.format(self._api_region), File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 119, in post return request('post', url, data=data, json=json, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/api.py", line 61, in request return session.request(method=method, url=url, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request resp = self.send(prep, send_kwargs) File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send r = adapter.send(request, kwargs) File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send resp = conn.urlopen( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 699, in urlopen httplib_response = self._make_request( File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 394, in _make_request conn.request(method, url, httplib_request_kw) File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 234, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.8/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.8/http/client.py", line 1266, in _send_request self.putrequest(method, url, skips) File "/usr/local/lib/python3.8/site-packages/urllib3/connection.py", line 214, in putrequest return HTTPConnection.putrequest(self, method, url, *args, **kwargs) File "/usr/src/homeassistant/homeassistant/util/async.py", line 150, in protected_loop_func checkloop() File "/usr/src/homeassistant/homeassistant/util/async.py", line 139, in check_loop raise RuntimeError( RuntimeError: I/O must be done in the executor; Use await hass.async_add_executor_job() at custom_components/sonoff/init.py, line 175: r = requests.post('https://{}-api.coolkit.cc:8080/api/user/login'.format(self._api_region),

cjaferre commented 3 years ago

Happen to me as well when I upgraded Core version. I reverted back to core-2021.3.4 and it's working again.

It's definitely not the solution, but it'll keep your integrations until a proper solution is available.

hansharhoff commented 3 years ago

I believe this is due to the breaking changes listed in the latest home assistant update. There has been a deprecation warning for a year. The question is whether this repo is abandoned and/or if we can find another maintainer for it.

titogarrido commented 3 years ago

Same issue here... I have reverted the upgrade...

hansharhoff commented 2 years ago

I tested this version which works for me: https://github.com/devbis/HASS-sonoff-ewelink PR here: https://github.com/peterbuga/HASS-sonoff-ewelink/pull/248