-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detected blocking call to open inside the event loop by custom integration 'solcast_solar' #14
Comments
I believe it might be this bit of code that needs to be updated to I dont have a dev machine to test it out though |
I tweaked the code directly on my HA instance - and this change works. |
changed dt_util.get_time_zone to dt_util.async_get_time_zone. Credit to @ma9mwah
@onetoomany Will you create a PR for this? |
Interesting. It didn't work on my install. I replaced 'dt_util.get_time_zone' with 'dt_util.async_get_time_zone' but it broke it, all my Solcast sensors became unavailable and I got a whole load of error messages:
I reverted back to dt_util.get_time_zone and all the Solcast sensors are working again but with the 'Blocking....' warning. HA Core version 2024.6.0 and Solcast version 4.0.23. I wonder what is different? |
This works on my 2024.6.1 setup for line 94 of |
Many thanks.
So it hasn't fixed the original problem on my system. |
Works also for me again with HA core 2024.6.1. |
I get the same as @changeofaspect. I replaced line 94 in custom_components/solcast_solar/init.py with: I'm on HA core 2024.6.1. However, when I reloaded the integration after I made the change I still noticed the error in the log: |
@nicopret1 & @changeofaspect did you restart HA after making the change? |
changed dt_util.get_time_zone to dt_util.async_get_time_zone. Credit to @ma9mwah
changed dt_util.get_time_zone to dt_util.async_get_time_zone. Credit to @ma9mwah
YES. I tried HA Restart and also a complete system reboot. It didn't fix the issue. At start up I get this warning message which points to line 230 of solcastapi.py.
When polling the Solcast server I get this warning message which points to line 97 of solcastapi.py
|
Yes, I performed a restart. I see the same error in the log as @changeofaspect when the following automation runs: `alias: Solcast update
|
Try #21 @nicopret1. Restart of HA is required after editing solcastapi.py locally. |
I have given this a try but the integration does not load. I don't know but I am guessing it should be it be async with aiofiles.open(apiCacheFileName) as f: ? I tried adding the missing async and the integration now loads. The original warning messages no longer appear but I get a different message so it's close but something else needs looking at.
|
Yeah, needs more thinking about, @changeofaspect & @nicopret1. It blew up on me this morning in the same way. The file reads are NQR. |
Using json.dump() was resulting in cache file zeroed.
Commit autoSteve@856f8bc fixes line 644 to be async. File writes were also very NQR, so it also switches to using an awaited |
After making all changes no more blocking while updating. Thanks |
I just created a PR which i think addresses this -- its been working on my instance for a few days. |
Thank you @changeofaspect and @autoSteve #21 fixed the problem. I have no more errors after a restart. |
@autoSteve #21 |
A pleasure, @changeofaspect, and a necessity given I run this code 😂. You're 2024.6.0 +-ish, so would be great to have confirmation from someone on < 2024.6.0 (aside from me down-reving my code for the day). Anyone? (Edit: good luck to me finding someone. The warning does not appear < 2024.6.0 so why seek help?...) |
Fixed in #25 |
@BJReplay are you going to release this bugfix soon? |
Many thanks @autoSteve. I tested on both 2024.6.1 and 2024.6.2 and didn't see any issues |
The problem
Since the latest update of HA lot of warnings on startup saying "Detected blocking call to open inside the event loop".
What version of Solcast Integration has the issue?
v4.0.23
What version of Home Assistant are you using?
2024.6.0
Diagnostics information
No response
Logs debug/info/error output
Additional information
This is not the only custom integration impacted in my list custom one's, here is the same issue for another one and it can be related to this change of ha :
https://developers.home-assistant.io/blog/2024/05/19/fix_zoneinfo_blocking_io/
custom-components/nordpool#382
The text was updated successfully, but these errors were encountered: