jfarmer08 / ha-sengledapi

Home Assistant Integration for Sengled Bulbs. This is a custom component to allow control of Sengled Bulbs in Homeassistant using the unofficial Sengled API. Please note this mimics the Sengled app and therefore Sengled may cut off access at anytime.
Apache License 2.0
104 stars 34 forks source link

Home Assistant - Sengled Bulb Integration #88

Open shdashley opened 1 year ago

shdashley commented 1 year ago

After "Home Assistant 2023.6.0" version install I can no longer start this integration anymore. Up to this update, the integration would not (failed) to start BUT I could always 'reload' it and it would happily run and work.

Would be really good if someone smarter than me (humble network eng) to take on the support for this add-on.

Regards, Stephen

Valdorama commented 1 year ago

Hey @shdashley, is the integration still broken? I don't want to upgrade to 2023.6.0 if it permanently breaks this integration.

Anything useful in the logs?

shdashley commented 1 year ago

Still broken. I can't work out how to 'reload' each HACS addon. Used to be able to do this. I've tried the 'reload' of the whole HACS integration. But the Sengled integration does not reload (again). Although it did for a reboot (only tried one reboot so far).

Log (breif) - Error during setup of component sengledapi June 8, 2023 at 07:18:22 – (ERROR) util/async_.py

Detected blocking call to putrequest inside the event loop. This is causing stability issues. Please report issue to the custom integration author for sengledapi doing blocking calls at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self.payload) June 8, 2023 at 07:18:22 – (WARNING) util/async.py

Setup of sengledapi is taking over 10 seconds. June 8, 2023 at 07:18:20 – (WARNING) runner.py

Logs Full -

Log Details (ERROR) Logger: homeassistant.setup Source: util/async_.py:153 First occurred: June 8, 2023 at 07:18:22 (1 occurrences) Last logged: June 8, 2023 at 07:18:22

Error during setup of component sengledapi Traceback (most recent call last): File "/config/custom_components/sengledapi/sengledapi/sengledapi.py", line 253, in async_do_request return await Request(url, payload).async_get_response(jsessionId) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sengledapi/sengledapi/devices/request.py", line 57, in async_get_response data = await resp.json() ^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/aiohttp/client_reqrep.py", line 1104, in json raise ContentTypeError( aiohttp.client_exceptions.ContentTypeError: 0, message='Attempt to decode JSON with unexpected mimetype: ', url=URL('https://element.cloud.sengled.com/zigbee/device/getDeviceDetails.json')

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 283, in _async_setup_component result = await task ^^^^^^^^^^ File "/config/custom_components/sengledapi/init.py", line 64, in async_setup sengledapi_devices = await sengledapi_account.async_get_devices() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sengledapi/sengledapi/sengledapi.py", line 182, in async_get_devices data = await self.async_do_request(url, payload, SESSION.jsession_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sengledapi/sengledapi/sengledapi.py", line 255, in async_do_request return Request(url, payload).get_response(jsessionId) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/sengledapi/sengledapi/devices/request.py", line 40, in get_response r = requests.post(self._url, headers=self._header, data=self._payload) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 115, in post return request("post", url, data=data, json=json, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request return session.request(method=method, url=url, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request resp = self.send(prep, send_kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send r = adapter.send(request, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen httplib_response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 415, in _make_request conn.request(method, url, httplib_request_kw) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request super(HTTPConnection, self).request(method, url, body=body, headers=headers) File "/usr/local/lib/python3.11/http/client.py", line 1283, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/local/lib/python3.11/http/client.py", line 1294, in _send_request self.putrequest(method, url, skips) File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 219, in putrequest return HTTPConnection.putrequest(self, method, url, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/src/homeassistant/homeassistant/util/async.py", line 166, in protected_loop_func checkloop(func, strict=strict) File "/usr/src/homeassistant/homeassistant/util/async.py", line 153, in check_loop raise RuntimeError( RuntimeError: Blocking calls must be done in the executor or a separate thread; Use await hass.async_add_executor_job(); at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self._payload)

DeeDubs7 commented 1 year ago

Following - I have the exact same error