Skip to content
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

Logs say Detected blocking call to open inside the event loop by custom integration 'smart_irrigation' #417

Open
1 task done
Lokilicious opened this issue Jun 19, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Lokilicious
Copy link

What happened?

Logs say Detected blocking call to open inside the event loop by custom integration 'smart_irrigation' - no other side effects though.

diagnostics.json

How to reproduce

Run Smart Irrigation

Relevant log output

2024-06-19 10:51:49.834 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'smart_irrigation' at custom_components/smart_irrigation/calcmodules/localize.py, line 23: with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f: (offender: /config/custom_components/smart_irrigation/calcmodules/localize.py, line 23: with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f:), please create a bug report at https://github.com/jeroenterheerdt/HASmartIrrigation/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/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 83, 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/websocket_api/http.py", line 54, in get
    return await WebSocketHandler(request.app[KEY_HASS], request).async_handle()
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/http.py", line 438, in async_handle
    async_handle_str(command_msg_data)
  File "/usr/src/homeassistant/homeassistant/components/websocket_api/connection.py", line 229, in async_handle
    handler(self.hass, self, schema(msg))
  File "/config/custom_components/smart_irrigation/websockets.py", line 226, in websocket_get_all_modules
    modules = coordinator.async_get_all_modules()
  File "/config/custom_components/smart_irrigation/__init__.py", line 1421, in async_get_all_modules
    s = m(self.hass, {})
  File "/config/custom_components/smart_irrigation/calcmodules/pyeto/__init__.py", line 57, in __init__
    super().__init__(name="PyETO", description=localize("calcmodules.pyeto.description",hass.config.language)+".", schema=SCHEMA, config=config)
  File "/config/custom_components/smart_irrigation/calcmodules/localize.py", line 23, in localize
    with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f:

Which version are you running?

v2024.4.3

Diagnostics file

  • I have attached a diagnostics file

Additional information

No response

@Lokilicious Lokilicious added the bug Something isn't working label Jun 19, 2024
@JiriPrchal
Copy link

I can confirm:
2024-06-27 14:11:52.833 WARNING (MainThread) [homeassistant.util.loop] Detected blocking call to open inside the event loop by custom integration 'smart_irrigation' at custom_components/smart_irrigation/localize.py, line 24: with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f: (offender: /etc/homeassistant/custom_components/smart_irrigation/localize.py, line 24: with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f:), please create a bug report at https://github.com/jeroenterheerdt/HASmartIrrigation/issues Traceback (most recent call last): File "/srv/homeassistant/bin/hass", line 8, in <module> sys.exit(main()) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/__main__.py", line 209, in main exit_code = runner.run(runtime_conf) File "/srv/homeassistant/lib/python3.12/site-packages/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 674, in run_until_complete self.run_forever() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 641, in run_forever self._run_once() File "/usr/local/lib/python3.12/asyncio/base_events.py", line 1987, 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 "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/event.py", line 1603, in _interval_listener self.hass.async_run_hass_job(self._run_job, dt_util.utcnow(), background=True) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 939, in async_run_hass_job return self._async_add_hass_job(hassjob, *args, background=background) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/core.py", line 748, in _async_add_hass_job task = create_eager_task( File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/util/async_.py", line 37, in create_eager_task return Task(coro, loop=loop, name=name, eager_start=True) File "/etc/homeassistant/custom_components/smart_irrigation/__init__.py", line 494, in _async_update_all async_dispatcher_send( File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/dispatcher.py", line 215, in async_dispatcher_send async_dispatcher_send_internal(hass, signal, *args) File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/dispatcher.py", line 247, in async_dispatcher_send_internal job.target(*args) File "/etc/homeassistant/custom_components/smart_irrigation/sensor.py", line 126, in async_update_sensor_entity self.async_schedule_update_ha_state() File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1254, in async_schedule_update_ha_state self.async_write_ha_state() File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1000, in async_write_ha_state self._async_write_ha_state() File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1126, in _async_write_ha_state state, attr, capabilities, shadowed_attr = self.__async_calculate_state() File "/srv/homeassistant/lib/python3.12/site-packages/homeassistant/helpers/entity.py", line 1065, in __async_calculate_state if extra_state_attributes := self.extra_state_attributes: File "/etc/homeassistant/custom_components/smart_irrigation/sensor.py", line 203, in extra_state_attributes localize( File "/etc/homeassistant/custom_components/smart_irrigation/localize.py", line 24, in localize with open(os.path.join(main_path, LANGUAGE_FILES_DIR+os.sep+"en.json")) as f:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants