zachowj/hass-node-red

Setup failed for custom integration 'nodered': Unable to import component:

Closed this issue · 7 comments

Describe the bug

ii got 2 error logs... i updated latest HA this morning and the Node Red Companion is broken now

Logger: homeassistant.setup
Source: setup.py:334
First occurred: 10:03:36 AM (1 occurrences)
Last logged: 10:03:36 AM

Setup failed for custom integration 'nodered': Unable to import component: cannot import name 'async_get_default_agent' from 'homeassistant.components.conversation.default_agent' (/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1007, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/nodered/__init__.py", line 58, in <module>
    from .websocket import register_websocket_handlers
  File "/config/custom_components/nodered/websocket.py", line 9, in <module>
    from homeassistant.components.conversation.default_agent import async_get_default_agent
ImportError: cannot import name 'async_get_default_agent' from 'homeassistant.components.conversation.default_agent' (/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 334, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1027, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 200, in protected_loop_func
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/nodered/__init__.py", line 58, in <module>
    from .websocket import register_websocket_handlers
  File "/config/custom_components/nodered/websocket.py", line 9, in <module>
    from homeassistant.components.conversation.default_agent import async_get_default_agent
ImportError: cannot import name 'async_get_default_agent' from 'homeassistant.components.conversation.default_agent' (/usr/src/homeassistant/homeassistant/components/conversation/default_agent.py)
Logger: homeassistant.util.loop
Source: util/loop.py:77
First occurred: 10:03:36 AM (1 occurrences)
Last logged: 10:03:36 AM

Detected blocking call to import_module with args ('custom_components.nodered',) in /usr/src/homeassistant/homeassistant/loader.py, line 1067: ComponentProtocol, importlib.import_module(self.pkg_path) inside the event loop; This is causing stability issues. Please create a bug report at https://github.com/home-assistant/core/issues?q=is%3Aopen+is%3Aissue For developers, please see https://developers.home-assistant.io/docs/asyncio_blocking_operations/#import_module 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 189, 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 1990, 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 334, in _async_setup_component component = await integration.async_get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1019, in async_get_component comp = self._get_component() File "/usr/src/homeassistant/homeassistant/loader.py", line 1067, in _get_component ComponentProtocol, importlib.import_module(self.pkg_path)

To Reproduce

  1. update to latest home assistant

Expected behavior

have no issues

Screenshots

No response

Example Flow

No response

Environment Information

Version: 0.73.0

Home Assistant version: 2024.10.0
Companion version: 0.0.0

Node-RED version: 4.0.3
Docker: yes
Add-on: 18.1.1

Node.js version: v18.20.4 x64 linux
OS: Linux 6.6.46-haos x64

Additional context

i cant seem to delete the companion to re install it.. so i dunno how to fix it... so some of the node red automations arent working as the companion under devices seems to be broken

Update Node-RED Companion to the latest version and restart the system, in my case it helped and after restarting the problem was solved.
obraz

@comet424 What version of this component do you have installed?

@zachowj i not sure what version i had and i didnt have an option for nodred compainion to be updated.. and i ddnt know where to look i found it under hacs.. and i clicked the 3 dots and i clicked download and it re downloaded and i had to reboot.. it seemed to fix it.. but it came up with a new node red error

Logger: homeassistant.const
Source: helpers/deprecation.py:197
First occurred: 6:37:34 PM (1 occurrences)
Last logged: 6:37:34 PM

STATE_UNLOCKED was used from nodered, this is a deprecated constant which will be removed in HA Core 2025.10. Use LockState.UNLOCKED instead, please report it to the author of the 'nodered' custom integration

That's just a deprecation notice, and a pull request has already been submitted to address it.

@zachowj and i do need to change anything in nodered for the depreciation like remove stuff of leave it and the code writters will fix it?

You don't need to make any changes in Node-RED for the deprecation. The code maintainers will handle the necessary updates, so you can leave everything as it is for now.

oh ok thank you i see nodred has a new feature shows issues now where i have like dead links or like a temp stuff page and shows things that dont exist anymore thats very handy i fixing some of my stuff now had 24 errors there