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
106 stars 35 forks source link

Detected I/O inside the event loop #39

Closed levian05 closed 3 years ago

levian05 commented 4 years ago

Not sure if this is a bug, since everything else seems to work fine (No issue with the light bulbs), but this message keeps popping up in Home Assistant Logs:

Log Details (WARNING) Logger: homeassistant.util.async Source: util/async.py:105 First occurred: 5:43:21 PM (7 occurrences) Last logged: 6:02:51 PM

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sengledapi doing I/O at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self._payload)

levian05 commented 4 years ago

Well, updating Home assistant from 0.115.3 to 0.116.0 seems to have solved the issue. Haven't gotten the warning message for the past hour

Edit: nvm, seems to happen again after my light bulbs turned off at sunrise

jfarmer08 commented 4 years ago

Thank you for reporting this. I will Correct it in the next release.

rpimeekle commented 3 years ago

I have also been receiving this warning. I think it might be primarily when my bulb is offline, that is, when I turn it off at the power point and forget to turn it back on (I have it as a bedside lamp).

Logger: homeassistant.util.async_
Source: util/async_.py:105
First occurred: 8 November 2020, 3:44:44 (9 occurrences)
Last logged: 17:09:54

Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sengledapi doing I/O at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self._payload)
ContVarza commented 3 years ago

I believe it is related and more error info cannot hurt. I've installed it via HACS 1.6.2 on Home Assistant 0.117.2 and it wont start > The following integrations and platforms could not be set up: sengledapi. Here are the logs.

2020-11-16 12:23:41 WARNING (MainThread) [homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sengledapi doing I/O at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self._payload)
2020-11-16 12:23:41 ERROR (MainThread) [homeassistant.setup] Error during setup of component sengledapi
Traceback (most recent call last):
File "/srv/homeassistant/lib/python3.9/site-packages/homeassistant/setup.py", line 213, in _async_setup_component result = await task
File "/home/homeassistant/.homeassistant/custom_components/sengledapi/__init__.py", line 64, in async_setup sengledapi_devices = await sengledapi_account.async_get_devices()
File "/home/homeassistant/.homeassistant/custom_components/sengledapi/sengledapi/sengledapi.py", line 183, in async_get_devices for d in data["deviceInfos"]:
KeyError: 'deviceInfos'

Cheers!

jfarmer08 commented 3 years ago

The way I have this setup is that my fall back call results in a I/O Loop. So when the async errors it falls back to just a standard call. The I/O is not keeping it from running. I am sure in the feature HA will, but not at this time.

As for the real error you have. What type of devices are you using. The call you are using is trying to find devices that use the Sengled Hub. So if you don't have any of those then we would see the error.

You can turn on trace login to help.

ContVarza commented 3 years ago

Thanks for the reply! I'm using a hub indeed (Element V4.4.9). But I've found the issue, it was my fault. A bad password for the Sengled account threw that error, now it starts clean and adds the lightbulbs.

Still cannot controll them, toggling the controlls doesnt do anything, though it seems to read their state (on/off and %) when I toggle the switches... But this is an issue for another thread. Cheers!

jfarmer08 commented 3 years ago

If you want to post your logs while running debug I can try to understand what is happen.

CuongHome commented 3 years ago

I have the same issue as well, not sure what to make of it. just reinstalled with the latest version and this error came up, i have trying various things but nothing work

2020-12-29 15:26:20 INFO (MainThread) [custom_components.sengledapi.sengledapi.sengledapi] Sengledapi: Login 2020-12-29 15:26:20 INFO (MainThread) [custom_components.sengledapi.sengledapi.sengledapi] SengledApi: Login Request. 2020-12-29 15:26:20 INFO (MainThread) [custom_components.sengledapi.sengledapi.devices.request] SengledApi: Sengled Request initializing. 2020-12-29 15:26:20 INFO (MainThread) [custom_components.sengledapi.sengledapi.devices.request] SengledApi: Get Login Response async. 2020-12-29 15:26:21 ERROR (MainThread) [homeassistant.setup] Setup failed for mqtt: Integration failed to initialize. 2020-12-29 15:26:21 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Unable to set up component. 2020-12-29 15:26:21 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Unable to set up component. 2020-12-29 15:26:21 ERROR (MainThread) [homeassistant.setup] Unable to prepare setup for platform mqtt.sensor: Unable to set up component. 2020-12-29 15:26:22 ERROR (Thread-9) [homeassistant.components.cast.media_player] Failed to cast media SnKJdxkRx4E. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address 2020-12-29 15:26:22 ERROR (Thread-9) [homeassistant.components.cast.media_player] Failed to cast media SnKJdxkRx4E. Please make sure the URL is: Reachable from the cast device and either a publicly resolvable hostname or an IP address 2020-12-29 15:26:23 DEBUG (MainThread) [custom_components.sengledapi.sengledapi.devices.request] SengledApi: Get Login Response {'ret': 3, 'msg': '用户名不存在', 'customerId': None, 'mobileId': None, 'nick_name': '', 'relative_path': '', 'jsessionId': '', 'ucenterAddr': '', 'appServerAddr': '', 'serAddressess': None, 'privacyPolicyStatus': None} 2020-12-29 15:26:23 DEBUG (MainThread) [custom_components.sengledapi.sengledapi.sengledapi] SengledApi Login {'ret': 3, 'msg': '用户名不存在', 'customerId': None, 'mobileId': None, 'nick_name': '', 'relative_path': '', 'jsessionId': '', 'ucenterAddr': '', 'appServerAddr': '', 'serAddressess': None, 'privacyPolicyStatus': None} 2020-12-29 15:26:23 INFO (MainThread) [custom_components.sengledapi] SengledApi Connected to Sengled account 2020-12-29 15:26:23 DEBUG (MainThread) [custom_components.sengledapi.sengledapi.sengledapi] SengledApi: Get Devices. 2020-12-29 15:26:23 INFO (MainThread) [custom_components.sengledapi.sengledapi.devices.request] SengledApi: Sengled Request initializing. 2020-12-29 15:26:23 INFO (MainThread) [customcomponents.sengledapi.sengledapi.devices.request] SengledApi: Sengled Request initializing. 2020-12-29 15:26:23 WARNING (MainThread) [homeassistant.util.async] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sengledapi doing I/O at custom_components/sengledapi/sengledapi/devices/request.py, line 40: r = requests.post(self._url, headers=self._header, data=self._payload) 2020-12-29 15:26:23 ERROR (MainThread) [homeassistant.setup] Error during setup of component sengledapi Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/setup.py", line 213, 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 183, in async_get_devices for d in data["deviceInfos"]: KeyError: 'deviceInfos

jfarmer08 commented 3 years ago

Can you check your username and password. I will see what I can find also.