AlexxIT / SonoffLAN

Control Sonoff Devices with eWeLink (original) firmware over LAN and/or Cloud from Home Assistant
https://github.com/AlexxIT/Blog
MIT License
2.58k stars 403 forks source link

Detected blocking call to open inside the event loop (HA 2024.6) #1426

Open hmmbob opened 4 weeks ago

hmmbob commented 4 weeks ago

HA 2024.6 beta is throwing the following error (multiple times):

2024-06-01 16:22:21.706 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'sonoff' at custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f: (offender: /config/custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f:), please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues

lordwizzard commented 3 weeks ago

HA 2024.6 GA release

Logger: homeassistant.util.loop Source: util/loop.py:84 First occurred: 4:01:08 PM (23 occurrences) Last logged: 4:01:08 PM

Detected blocking call to open inside the event loop by custom integration 'sonoff' at custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f: (offender: /config/custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f:), please create a bug report at https://github.com/AlexxIT/SonoffLAN/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_eagertask( 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/sonoff/init.py", line 170, in async_setup_entry await system_health.setup_debug(hass, _LOGGER) File "/config/custom_components/sonoff/system_health.py", line 62, in setup_debug info[DOMAIN + "_version"] = f"{integration.version} ({xutils.source_hash()})" File "/config/custom_components/sonoff/core/xutils.py", line 20, in source_hash with open(path, "rb") as f:

Waank1 commented 3 weeks ago

Having similar error:

Detected blocking call to open inside the event loop by custom integration 'alexa_media' at custom_components/alexa_media/sensor.py, line 450: timezone = pytz.timezone( (offender: /usr/local/lib/python3.12/site-packages/pytz/init.py, line 108: return open(filename, 'rb')), please create a bug report at https://github.com/alandtse/alexa_media_player/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/config_entries.py", line 2055, in async_forward_entry_setup return await self._async_forward_entry_setup(entry, domain, True) File "/usr/src/homeassistant/homeassistant/config_entries.py", line 2081, in _async_forward_entry_setup await entry.async_setup(self.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 "/usr/src/homeassistant/homeassistant/components/sensor/init.py", line 134, in async_setup_entry return await component.async_setup_entry(entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 196, in async_setup_entry return await self._platforms[key].async_setup_entry(config_entry) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 333, in async_setup_entry return await self._async_setup_platform(async_create_setup_awaitable) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 363, in _async_setup_platform awaitable = create_eagertask(awaitable, loop=hass.loop) 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 "/config/custom_components/alexa_media/sensor.py", line 162, in async_setup_entry return await async_setup_platform( File "/config/custom_components/alexa_media/sensor.py", line 151, in async_setup_platform return await add_devices( File "/config/custom_components/alexa_media/helpers.py", line 53, in add_devices add_devices_callback(devices, False) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 515, in _async_schedule_add_entities_for_entry task = self.config_entry.async_create_task( File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1134, in async_create_task task = hass.async_create_task_internal( File "/usr/src/homeassistant/homeassistant/core.py", line 828, in async_create_task_internal task = create_eagertask(target, name=name, loop=self.loop) 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/helpers/entity_platform.py", line 649, in async_add_entities await add_func(coros, entities, timeout) File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 600, in _async_add_entities await coro File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 914, in _async_add_entity await entity.add_to_platform_finish() File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 1354, in add_to_platform_finish await self.async_added_to_hass() File "/config/custom_components/alexa_media/sensor.py", line 541, in async_added_to_hass self._process_raw_notifications() File "/config/custom_components/alexa_media/sensor.py", line 382, in _process_raw_notifications list(map(self._fix_alarm_date_time, self._n_dict.items())) File "/config/custom_components/alexa_media/sensor.py", line 450, in _fix_alarm_date_time timezone = pytz.timezone(

Running:

Core 2024.6.0 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240605.0

dodavies commented 2 weeks ago

2024-06-10 15:48:58.843 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'sonoff' at custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f: (offender: /config/custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f:), please create a bug report at https://github.com/AlexxIT/SonoffLAN/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/local/lib/python3.12/site-packages/aiohttp/web_protocol.py", line 452, in _handle_request resp = await request_handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_app.py", line 543, in _handle resp = await handler(request) File "/usr/local/lib/python3.12/site-packages/aiohttp/web_middlewares.py", line 114, in impl return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 77, in forwarded_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 85, in ban_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware return await handler(request) File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 32, in headers_middleware response = await handler(request) File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle result = await handler(request, **request.match_info) File "/usr/src/homeassistant/homeassistant/components/diagnostics/init.py", line 299, in get data = await info.device_diagnostics(hass, config_entry, device) File "/config/custom_components/sonoff/diagnostics.py", line 69, in async_get_device_diagnostics info = await async_get_config_entry_diagnostics(hass, entry) File "/config/custom_components/sonoff/diagnostics.py", line 56, in async_get_config_entry_diagnostics "version": xutils.source_hash(), File "/config/custom_components/sonoff/core/xutils.py", line 20, in source_hash with open(path, "rb") as f:

None of the sonoff devices function

Core 2024.6.1 Supervisor 2024.06.0 Operating System 12.3 Frontend 20240605.0

xriser commented 1 week ago

I have the same issue. Can't upgrade HA, it doesn't start and dies with this error

istornz commented 6 days ago

Same issue here too:

2024-06-22 18:52:09.035 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'sonoff' at custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f: (offender: /config/custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f:), please create a bug report at https://github.com/AlexxIT/SonoffLAN/issues Traceback (most recent call last): File "<frozen runpy>", line 198, in _run_module_as_main File "<frozen runpy>", line 88, in _run_code File "/usr/src/homeassistant/homeassistant/__main__.py", line 223, in <module> 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 <genexpr> 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/sonoff/__init__.py", line 170, in async_setup_entry await system_health.setup_debug(hass, _LOGGER) File "/config/custom_components/sonoff/system_health.py", line 62, in setup_debug info[DOMAIN + "_version"] = f"{integration.version} ({xutils.source_hash()})" File "/config/custom_components/sonoff/core/xutils.py", line 20, in source_hash with open(path, "rb") as f:

smarthomefamilyverrips commented 5 days ago

Same here on HA 2024.6.4 and OS 12.4

Logger: homeassistant.util.loop Source: util/loop.py:84 First occurred: 15:25:53 (23 occurrences) Last logged: 15:25:53

Detected blocking call to open inside the event loop by custom integration 'sonoff' at custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f: (offender: /config/custom_components/sonoff/core/xutils.py, line 20: with open(path, "rb") as f:), please create a bug report at https://github.com/AlexxIT/SonoffLAN/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/components/system_health/init.py", line 89, in get_integration_info data = await registration.info_callback(hass) File "/config/custom_components/sonoff/system_health.py", line 45, in system_health_info "version": f"{integration.version} ({xutils.source_hash()})", File "/config/custom_components/sonoff/core/xutils.py", line 20, in source_hash with open(path, "rb") as f: