-
Notifications
You must be signed in to change notification settings - Fork 48
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 solis #377
Comments
Not sure if this is related to the above, apologies I am not an expert in this area. Logger: homeassistant.helpers.typing HomeAssistantType was used from solis, this is a deprecated alias which will be removed in HA Core 2025.5. Use homeassistant.core.HomeAssistant instead, please report it to the author of the 'solis' custom integration |
No, that's another issue... Try looking here #369 |
I have the same issue and it started with the update to HA 2024.6.0.
My Solcast integration seems to be affected at the same time with a similar warning and they are referencing a link to handling time zones: https://developers.home-assistant.io/blog/2024/05/19/fix_zoneinfo_blocking_io/ |
Same issue here. Integration is not loading anymore |
I am getting this since updating to 2024.6.2 - I also had the same for the alexa_media integration, but that has already been fixed. I get the error at HA restart, but the solis integration does seem to load and work OK after that. |
I had similar with the Solcast integration which generated a message at start up and a slightly different message every time I polled the Solcast server. The warning message for the Solis integration points to Line 185 of the soliscloudapi.py file which is The Solcast integration has now been fixed by using 'async with aiofiles.open' instead of 'with open' but it was not quite as simple as that. I am not a Python coder but I noted that other changes were required to be made to make it all work. It will need a Python expert to work through it and make the changes - I am definitely not a Python expert. Also, the reference above to the zoneinfo blocking turned out to be a bit of a red herring, yes, it needed sorting, but it was not the cause of the warning messages which were caused by the 'with open'. |
Hi all I'm getting the same error and notes on work grounds or anything like that? Below is my error Logger: homeassistant.util.loop Detected blocking call to open inside the event loop by custom integration 'solis' at custom_components/solis/soliscloud_api.py, line 185: with open('/config/custom_components/solis/workarounds.yaml', 'r') as file: (offender: /config/custom_components/solis/soliscloud_api.py, line 185: with open('/config/custom_components/solis/workarounds.yaml', 'r') as file:), please create a bug report at https://github.com/hultenvp/solis-sensor/issues Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/main.py", line 223, in sys.exit(main()) File "/usr/src/homeassistant/homeassistant/main.py", line 209, in main exit_code = runner.run(runtime_conf) File "/usr/src/homeassistant/homeassistant/runner.py", line 190, in run return loop.run_until_complete(setup_and_run_hass(runtime_config)) File "/usr/local/lib/python3.12/asyncio/base_events.py", line 672, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 639, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1988, in _run_once handle._run() File "/usr/local/lib/python3.12/asyncio/events.py", line 88, in _run self._context.run(self._callback, *self._args) File "/usr/src/homeassistant/homeassistant/setup.py", line 165, in async_setup_component result = await _async_setup_component(hass, domain, config) File "/usr/src/homeassistant/homeassistant/setup.py", line 447, in async_setup_component await asyncio.gather( File "/usr/src/homeassistant/homeassistant/setup.py", line 449, in create_eager_task( File "/usr/src/homeassistant/homeassistant/util/async.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 742, in async_setup_locked await self.async_setup(hass, integration=integration) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup result = await component.async_setup_entry(hass, self) File "/config/custom_components/solis/init.py", line 82, in async_setup_entry portal_config = SoliscloudConfig( File "/config/custom_components/solis/soliscloud_api.py", line 185, in init with open('/config/custom_components/solis/workarounds.yaml', 'r') as file: |
to add aiofiles do you have to modify manifest.json?
Is it correct to do it this way? |
I don't think there's any need to add aiofiles as a requirement; as far as I can tell it seems to be already loaded. However I think there were some other tricky issues, and #380 is a pull request to fix the issue which seems to work in my install at least. |
@Dino0005 after restarting HA with your changes, was the solis integration actually loaded? during my testing, with the async code invocation inside soliscloud_api.py, HA restarted ok and the error message about "Detected blocking call to open inside the event loop by custom integration solis" no longer appeared -- but in fact the solis integration had been disabled due to the syntax error of attempting to use async code in a place that didn't support it. (I had to lower the logging level to make this error visible in the logs.) |
@jmason but my first attempt with this manifest.json:
gave me an error saying the integration was not found and was not loaded. So I reverted manifest.json and soliscloud_api.py from v.3.5.2. So I tried to replace only manifest.json...rewriting it like this (maybe I had made some typing errors in the first manifest.json)
and the integration was loaded. After I was sure of this I replaced soliscloud_api.py and when I restarted HA the integration gave no problems. In addition to I'll attach the 3 files if you want to take a look. |
Thanks! that works perfectly -- much nicer than my version :) Also, I think you're correct that "iot_polling" is a more appropriate iot_class. |
Yes, |
Describe the bug
Detected blocking call to open inside the event loop by custom integration solis
Versions
Lo
HACS Version: None (manual installation of Solis integration)
Integration version: 3.5.2
Logs:
Screenshots
The text was updated successfully, but these errors were encountered: