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

[BUG] Integration not working in HA 2023.9.0 Setup failed for custom integration ledfx: Unable to import component: cannot import name 'DeviceEntryType' from 'homeassistant.helpers.entity' #25

Open
dflvunoooooo opened this issue Sep 7, 2023 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@dflvunoooooo
Copy link

Describe the bug
The Integration will not work anymore due to the following error:

Setup failed for custom integration ledfx: Unable to import component: cannot import name 'DeviceEntryType' from 'homeassistant.helpers.entity' (/usr/src/homeassistant/homeassistant/helpers/entity.py)

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 215, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 818, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/ledfx/__init__.py", line 31, in <module>
    from .helper import build_auth, get_config_value
  File "/config/custom_components/ledfx/helper.py", line 17, in <module>
    from .updater import LedFxUpdater
  File "/config/custom_components/ledfx/updater.py", line 21, in <module>
    from homeassistant.helpers.entity import (
ImportError: cannot import name 'DeviceEntryType' from 'homeassistant.helpers.entity' (/usr/src/homeassistant/homeassistant/helpers/entity.py)

Please complete the following information:

  • HASS version: 2023.9.0
  • Component version 3.0.0
  • LedFx version [e.g. 0.10.7]
@dflvunoooooo dflvunoooooo added the bug Something isn't working label Sep 7, 2023
@FragMenthor
Copy link

Same here!

@sbach89
Copy link

sbach89 commented Sep 7, 2023

This is also preventing the integration from being uninstalled.

Logger: aiohttp.server
Source: custom_components/ledfx/updater.py:21
Integration: LedFx ([documentation](https://github.com/dmamontov/hass-ledfx/wiki), [issues](https://github.com/dmamontov/hass-ledfx/issues))
First occurred: 3:00:51 PM (2 occurrences)
Last logged: 3:12:43 PM
Error handling request

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_protocol.py", line 433, in _handle_request
    resp = await request_handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 85, in security_filter_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 227, in forwarded_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 80, in ban_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 31, in headers_middleware
    response = await handler(request)
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 148, in handle
    result = await handler(request, **request.match_info)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 87, in delete
    result = await hass.config_entries.async_remove(entry_id)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 1080, in async_remove
    await entry.async_remove(self.hass)
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 578, in async_remove
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 818, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/config/custom_components/ledfx/__init__.py", line 31, in <module>
    from .helper import build_auth, get_config_value
  File "/config/custom_components/ledfx/helper.py", line 17, in <module>
    from .updater import LedFxUpdater
  File "/config/custom_components/ledfx/updater.py", line 21, in <module>
    from homeassistant.helpers.entity import (
ImportError: cannot import name 'DeviceEntryType' from 'homeassistant.helpers.entity' (/usr/src/homeassistant/homeassistant/helpers/entity.py)

@ASNNetworks
Copy link

Also impossible to delete the integration.

@seancmalloy
Copy link

seancmalloy commented Sep 13, 2023

Same here. I resolved this issue by editing updater.py - removing the line importing DeviceEntryType and changing entry_type to = None. Seems to work but need to test further.

@FragMenthor
Copy link

Same here. I resolved this issue by editing updater.py - removing the line importing DeviceEntryType and changing entry_type to = None. Seems to work but need to test further.

Thanks, that seems to work! Any problems after?

@seancmalloy
Copy link

seancmalloy commented Sep 24, 2023

I ended up, instead of changing entry_type to none, I imported DeviceEntryType from device_registry helper (not entity). But unfortunately I'm having issues. My new issue is: AttributeError: 'LedFxLight' object has no attribute '_ActionType.DEVICE_on'.

Btw- I get this error both ways

@Gurutasker
Copy link

Gurutasker commented Oct 7, 2023

Have found the source of this error.

home-assistant/core#98149

I believe changing to the following code resolves. However I'm still receiving the same error as @seancmalloy when trying to undertake actions. Still investigating this - could be related to a separate deprecation or issue.

Replace:

from homeassistant.helpers.entity import ( DeviceEntryType, DeviceInfo, EntityCategory, EntityDescription, )

with

from homeassistant.helpers.entity import EntityCategory, EntityDescription
from homeassistant.helpers.device_registry import DeviceEntryType, DeviceInfo

in updater.py

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

7 participants