Open mgiako opened 4 years ago
Updated today on 0.109 also get:
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 18:11:43 (11 occurrences)
Last logged: 18:17:51
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 176: headers=self._headers, json=app_details)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 374: ), headers=self._headers)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 221: r = requests.post('https://%s-disp.coolkit.cc:8080/dispatch/app' % self._api_region, headers=self._headers)```
Also updated today on 0.109 also get:
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self.headers) 14:34:28 β util/async.py (WARNING) - a mensagem ocorreu pela primeira Γ s 14:26:21 e apareceu 9 vezes
same problem here, with HA 0.109
Same after the update:
Log Details (WARNING) Logger: homeassistant.util.async Source: util/async.py:120 First occurred: 3:27:20 PM (11 occurrences) Last logged: 3:34:30 PM
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 176: headers=self._headers, json=app_details) Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers) Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 221: r = requests.post('https://%s-disp.coolkit.cc:8080/dispatch/app' % self._api_region, headers=self._headers)
Yeah @homeassistant said it in the blog this would happen
error for line 374 is in this request:
r = requests.get('https://{}-api.coolkit.cc:8080/api/user/device?lang=en&apiKey={}&getTags=1&version=6&ts=%s&nonce=%s&appid=oeVkj2lYFGnJu5XUtWisfW4utiN4u9Mq&imei=%s&os=iOS&model=%s&romVersion=%s&appVersion=%s'.format( self._api_region, self.get_user_apikey(), str(int(time.time())), ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8)), self._imei, self._model, self._romVersion, self._appVersion ), headers=self._headers)
i don't have logs for other lines.
Same issue here.
[homeassistant.util.async_] Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)
I'm running in Docker on ubuntu.
Home Assistant 0.109.0
Appreciate any help you can provide. I'm happy to do some testing if that helps at all.
same for me: 2020-04-30 15:28:13 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 sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)
same for me too :( 2020-04-30 15:48:15 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 sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)
Hi there, same issue here. hope you can look at it, and have a patch to fix it. thanks for your great work @peterbuga!!!
Remains also after update to 0.109.1: 2020-04-30 18:26:47 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 sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)
@everyone due to the way the logic works and the limitations of the app API i find it very hard to work around this new limitation/warning. i mean it worked just fine(-ish) until now π and it's still works ok in my current setup π€·ββοΈ probably this is a more forced paradigm set by the guys @ homeassistant to avoid more custom components going nuts and eat system resources.
there's definitely no easy fix, other than disabling the component (recommended) or upgrading the error reporting to ERROR-level for this component (not recommended). the real fix would be a much much needed ground-up rewrite... π
Honestly, it is not a hard fix.
Looking at the logs above, it is about 3 lines that currently cause issues. Add/Wrap those calls as a job to the executor and await hem.
Please note, that the current state of this integration make Home Assistant execution halt/blocked until these calls are finished. Basically, this integration causes hiccups for the whole system now.
@everyone digging after the issues found on this component as also in the lan_mode_r3 one, I found this new approach
@everyone digging after the issues found on this component as also in the lan_mode_r3 one, I found this new approach
Did you give it a try, barto64? Any issues? Thanks.
I made a first try with a couple of Basic R3 and it worked fine. I strongly recommend to carefully read the doc and watch DrZss video with additional explanations. @peterbuga and others made an extraordinary job and effort in building the old one but it may be the time to move on a different direction especially if you can update all your sonoff firmwares to V3 that is a must. I may have +25 sonoff at home and will need some time to complete the full migration. For now I am in POC phase in my HA DEV environment. Will keep posted my findings in this thread
Thanks a lot barto64 for your response. I've just a dozen basics (all with 3.4.0 and a unused RR-Bridge). I'll wait of peterburga (thanks Peter for your effort) answer on the (call/submitjob) solution (while calls can block a program open new jobs won't only fail in that particular job). If this simple intervention can solve the warning it would be a marvellous solution also for new implementation as new jobs can fail without compromising existing functionality. It could be the way to regain full control without a complete rewrite of todays integration.
As integration i like peters solution it has worked fine al the time and running horses shouldn't be changed while running.
@everyone digging after the issues found on this component as also in the lan_mode_r3 one, I found this new approach
Thanks for the info, but that integration is not well suited for me, since i have lan sonoff but also some remote sonoff and this integration is the best for me. If sonoffLAN could cover both LAN and cloud devices then i will give it a try but for now is not suitable for my needs.
If it was just error messages, I could live with that and I'd certainly fix the code as suggested above to ignore but for me, ALL my Sonoffs are showing as "Entity not available" so I cannot control them whatsoever. :-(
Just tried AlexxIT's version and all but my Power R2 works and I really need that as I have Automations attached to it. My R2 is software version 3.4.0.
So unless and/or until a workaround/fix is found, it looks like it's back to HA 0.108.9 for me. :-(
Logger: homeassistant.util.async Source: util/async.py:120 First occurred: 1 maja 2020, 22:40:36 (430 occurrences) Last logged: 5:56:43
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)
If it was just error messages, I could live with that and I'd certainly fix the code as suggested above to ignore but for me, ALL my Sonoffs are showing as "Entity not available" so I cannot control them whatsoever. :-(
Just tried AlexxIT's version and all but my Power R2 works and I really need that as I have Automations attached to it. My R2 is software version 3.4.0.
So unless and/or until a workaround/fix is found, it looks like it's back to HA 0.108.9 for me. :-(
I made an R2 to work with this config:
1000250d42:
devicekey: 96cff2c2-7213-457a-a9d1-1f0951b95f21
device_class: [switch, switch]
I tested Basic, R2, Touch, S26, 4CH PRO and Basic 2 and all seems to work well simultaneously with Cloud and LAN mode.
Only one failing to me is a Tishric TSR620/DC
The fact that this working integrated with HACS a the promised to make it a native HA component give me some additional confidence.
Besides it keeps the same name convention in creating the entities so it should make the conversion transparent. I am working on that now.
1000250d42: devicekey: 96cff2c2-7213-457a-a9d1-1f0951b95f21 device_class: [switch, switch]
Cool, thanks for that. Erm.... How do I discover my Device Key, please?
1000250d42: devicekey: 96cff2c2-7213-457a-a9d1-1f0951b95f21 device_class: [switch, switch]
Cool, thanks for that.
Erm.... How do I discover my Device Key, please?
Do not want to be rude my friend, but please read the documentation and watch Dr Zzs video. It is pretty simple and is well explained. After that if you still have issues happy to help
Same issue; Detected I/O inside the event loop. on HA 0.109.2 ......
Do not want to be rude my friend, but please read the documentation and watch Dr Zzs video. It is pretty simple and is well explained. After that if you still have issues happy to help
No worries. I've watched DrZ's video but I didn't see anything about discovering a key. I already have it all set up. I should also point out that videos are useless to me unless subtitled as I am profoundly deaf. Auto generated subtitled are pretty hit and miss. Have also read the documentation so unless I've missed how to discover a key on devices that are not picked up with AlexxIT's software, I didn't find anything. Sorry to be a pain. I also tried a Google search and all I could see is that iTead haven't fixed it yet so we can see API keys in the app, despite many requests for this.
Do not want to be rude my friend, but please read the documentation and watch Dr Zzs video. It is pretty simple and is well explained. After that if you still have issues happy to help
No worries. I've watched DrZ's video but I didn't see anything about discovering a key. I already have it all set up. I should also point out that videos are useless to me unless subtitled as I am profoundly deaf. Auto generated subtitled are pretty hit and miss.
Have also read the documentation so unless I've missed how to discover a key on devices that are not picked up with AlexxIT's software, I didn't find anything. Sorry to be a pain.
I also tried a Google search and all I could see is that iTead haven't fixed it yet so we can see API keys in the app, despite many requests for this.
Noted :)
If you specify in the settings your eWeLink user and password the component will connect to the Itead Cloud and will create a JSON file called sonoff which contains 100% of the info for each of your devices. As all JSON files not very easy to read but being a bit patient you will be able to see all the data including the βdevicekeyβ for each of your devices.
I did it, got the info, kept the file in a safe place and delete the file and the use and password in the configuration Yaml. I personally do not want my HA to connect to the cloud. It does no preclude that the status of the devices get updated in the cloud when you action them from HA and viceversa.
Forgot to say sonoff file is created in the config folder of HA
Hope it helps.
0.109.2 and error is still here:
Logger: homeassistant.util.async_
Source: util/async_.py:120
First occurred: 1 maggio 2020, 21:56:20 (1113 occurrences)
Last logged: 16:41:13
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 175: headers=self._headers, json=app_details)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 373: ), headers=self._headers)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/__init__.py, line 220: r = requests.post('https://%s-disp.coolkit.cc:8080/dispatch/app' % self._api_region, headers=self._headers)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for meross_cloud doing I/O at custom_components/meross_cloud/__init__.py, line 55: http_client = MerossHttpClient.from_user_password(email=email, password=password)
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for meross_cloud doing I/O at custom_components/meross_cloud/__init__.py, line 60: http_devices = http_client.list_devices()
1113 occurrences ... Hope that the developer @peterbuga could take a look at it....
Honestly, it is not a hard fix.
Looking at the logs above, it is about 3 lines that currently cause issues. Add/Wrap those calls as a job to the executor and await hem.
Please note, that the current state of this integration make Home Assistant execution halt/blocked until these calls are finished. Basically, this integration causes hiccups for the whole system now.
TBH i thought HA was enforcing a different paradigm where the information needs to be available more or less directly available inside the component logic. i might give it a go but i don't have the latest env to test it tho' π π¬
Forgot to say sonoff file is created in the config folder of HA
Thanks for the info. I was pretty sure I had already discovered and looked through that file but couldn't find anything relating to the Power R2. I even did a Find Search and nothing. I thought I'd check again though and lo and behold, I did indeed discover it now. I don't know why it didn't show before.
Then I noticed that the Power R2 is now showing in my Lovelace panel! So maybe that's why. No idea why it took so long to appear. However, only the switch of the Power R2 is showing and none of the usual Voltage, Current, Power options. They used to work in peterbugas version, should they also work in AlexxIT's version? Then I tried adding the code snippet above you gave me which caused the Power R2 switch to disappear again. The Voltage, Current, Power items remained the same, Entity not available. Screenshot -
The Voltage, Current, Power isn't overly important really but would be nice to still have them as before but the main thing is, my actual switch is working. :-)
Me too on 0.109.3
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 176: headers=self._headers, json=app_details) Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers) Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 221: r = requests.post('https://%s-disp.coolkit.cc:8080/dispatch/app' % self._api_region, headers=self._headers)
Upgrade to 0.109.3 still sees the log warning. All my devices appear to work still but assume this component may have issues on the next HA version.
Upgrade to 0.109.3 still sees the log warning. All my devices appear to work still but assume this component may have issues on the next HA version.
HA upgrades will not fix the log messages, only component update will.
@frenck
Honestly, it is not a hard fix.
Looking at the logs above, it is about 3 lines that currently cause issues. Add/Wrap those calls as a job to the executor and await hem.
Please note, that the current state of this integration make Home Assistant execution halt/blocked until these calls are finished. Basically, this integration causes hiccups for the whole system now.
actually it's not that easy π π i gave it a go and the whole forced async stuff it's lightly kicking my but right now, it's not just adding a couple async/await here and there. i'll try to patch it enough to remove the warning and play well with HA but a different approach must be done with this component. any help is greatly appreciated π !
@peterbuga Good to know you are working on it buddy, thanks for all the help and the continuous support!
Thanks @peterbuga, thousands of users are pending progress on this topic, I hope you can find a solution
@sagatxxx @krasatos @gx9001 @frenck and @whoever-wants-to-try i've done some update/changes available here https://github.com/peterbuga/HASS-sonoff-ewelink/tree/async-patch
!!! BIG NOTICE !!! this was done with a lot of trial & errors as I'm still getting the hang of the entire async stuff. tested only on switch-like devices, this ones are the only i have online right now. please give it a try and report back if even hopefully half-works, or not
if anyone knows a component that might have a similar integration approach please let me know so i can inspire myself with some logic from there π
ps: ~only __init__.py
and switch.py
files were changed~ replace all the files from branch
@peterbuga Thank you. So I run the new init.py and switch.py, and the I/O problem apparently is gone, but there is some new message,
Detalles del registro (ERROR) Logger: homeassistant.setup Source: setup.py:249 First occurred: 20:00:00 (3 occurrences) Last logged: 20:00:01
Unable to prepare setup for platform sonoff.binary_sensor: Platform not found (No module named 'custom_components.sonoff.binary_sensor'). Unable to prepare setup for platform sonoff.light: Platform not found (No module named 'custom_components.sonoff.light'). Unable to prepare setup for platform sonoff.fan: Platform not found (No module named 'custom_components.sonoff.fan').
Detalles del registro (ERROR) Logger: websocket Source: custom_components/sonoff/init.py:800 First occurred: 20:00:55 (1 occurrences) Last logged: 20:00:55
error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x6ebadef0>>: 'entity_id'
Hope that helps. :)
@gx9001 replace all the files from new branch, looks like you were using master before
Sent with GitHawk
@peterbuga Thank you. So I run the new init.py and switch.py, and the I/O problem apparently is gone, but there is some new message,
Detalles del registro (ERROR) Logger: homeassistant.setup Source: setup.py:249 First occurred: 20:00:00 (3 occurrences) Last logged: 20:00:01
Unable to prepare setup for platform sonoff.binary_sensor: Platform not found (No module named 'custom_components.sonoff.binary_sensor'). Unable to prepare setup for platform sonoff.light: Platform not found (No module named 'custom_components.sonoff.light'). Unable to prepare setup for platform sonoff.fan: Platform not found (No module named 'custom_components.sonoff.fan').
Detalles del registro (ERROR) Logger: websocket Source: custom_components/sonoff/init.py:800 First occurred: 20:00:55 (1 occurrences) Last logged: 20:00:55
error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x6ebadef0>>: 'entity_id'
Hope that helps. :)
Sounds like you're missing the light, fan and binary_sensor files.
It seems to work, no more I/O inside etc ets, but new error message. It occurs calling action on sonoff entity
`Dettagli registro (ERROR) Logger: websocket Source: custom_components/sonoff/init.py:801 First occurred: 13:27:31 (1 occurrences) Last logged: 13:27:31
error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x7fa2933f10>>: 'entity_id' `
@fudu interesting, i don't seem to get this message. does the switch turns on/off or simply just throws the error? (it's possible to throw the error but not effecting the switching of on/off)
can you enable debug mode log for sonoff component (the one provider for HA and setup in configuration.yaml) to get the full output of the error? that one-line is not helping me much :(
@peterbuga Sorry, my bad, I misunderstand, but now all is copied and works almost right, I do still have the same problem as @fudu, for me it works but every time I toggle it will make this error.
Detalles del registro (ERROR) Logger: websocket Source: custom_components/sonoff/init.py:801 First occurred: 10:13:41 (2 occurrences) Last logged: 10:13:52
error from callback <bound method Sonoff.on_message of <custom_components.sonoff.Sonoff object at 0x6e9f4890>>: 'entity_id'
@fudu @gx9001 thanks for replying back but I really need to see where things break (i'm using the latest HA version and for some crazy reason it's not happening for me)
try to add this temporarily in configuration.yaml
logger:
default: warning
logs:
custom_components.sonoff: debug
custom_components.switch.sonoff: debug
toggle some switches and see if more text related to this problem shows up.
& try to add as many details as possible (what type of HA you have, what type of device you try to toggle)
if possible, try to stop HA and run it manually/directly from command line - this will definitely throw the entire error message in console
Installed this morning and so far it is working for me with no warnings. Turned all the switches on and off and the temperature and humidity from my TH16 are showing up.
I am running HA 0.109.2 in supervised mode on a Raspberry PI 3B+
Thanks for working on this I'll let you know if I find any other issues.
The latest branch files seem to have fixed it for me, 0.109.4 Many thanks Will report back if it happens again
if anyone knows a component that might have a similar integration approach please let me know so i can inspire myself with some logic from there π
I don't know, but it seems that Shelly and Tuya do share at least the same hardware components. Probably you could have a look on these integration? Thank you for the job you are doing Peter.
Installed latest files on 109.6, no issues, warning disappeared!. Thanks Peter.
@Bettinaglio @silviudc @vjcooper thanks for reporting back, looks like we're getting somewhere. i'm still interested in the error reported above if someone can provide more details on it π¬ so i can hopefully fix it and make merge to master / maybe a small dump release too
I don't know, but it seems that Shelly and Tuya do share at least the same hardware components. > Probably you could have a look on these integration?
just cuz they have the same hardware doesn't mean they might be the same but they have the cloud components so it might be good place to start i guess π
Yes Peter, i Hope you find some hints on that. TuyaSmart has an official integration in HA (using the cloud). I canβt see why SONOFF has not. π€ Good Job (tolle Arbeit) Peter.
Questo messaggio e gli allegati possono contenere informazioni riservate esclusivamente al destinatario. Il ricevente, se diverso dal destinatario Γ¨ avvertito che qualunque utilizzo, divulgazione o copia di questa comunicazione comporta violazione delle disposizioni di legge sulla tutela dei dati personali ed Γ¨ pertanto rigorosamente vietata. Qualora il presente messaggio sia stato ricevuto per errore, Vi prego di informarmi immediatamente via e-mail a louis@bettinaglio.com
This e-mail and any files transmitted with it are confidential and may be privileged and are intended solely for the use of the individual or entity to whom they are addressed. Any unauthorised direct or indirect dissemination or copyng of this message and any attachments are strictly prohibited. If you have received the e-mail in error please inform me by e-mail to louis@bettinaglio.com
Il giorno 8 mag 2020, alle ore 11:33, Peter Buga notifications@github.com ha scritto:
ο»Ώ @Bettinaglio @silviudc @vjcooper thanks for reporting back, looks like we're getting somewhere. i'm still interested in the error reported above if someone can provide more details on it π¬
I don't know, but it seems that Shelly and Tuya do share at least the same hardware components. > Probably you could have a look on these integration?
just cuz they have the same hardware doesn't mean they might be the same but they have the cloud components so it might be good place to start i guess π
β You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
In HomeAssistant 0.109.0b0 I have the folowing warning:
Log Details (WARNING) Logger: homeassistant.util.async Source: util/async.py:120 First occurred: 1:09:34 PM (539 occurrences) Last logged: 5:13:47 PM
Detected I/O inside the event loop. This is causing stability issues. Please report issue to the custom component author for sonoff doing I/O at custom_components/sonoff/init.py, line 374: ), headers=self._headers)