ollo69 / ha-smartthinq-sensors

HomeAssistant custom integration for SmartThinQ LG devices configurable with Lovelace User Interface.
Apache License 2.0
1.03k stars 149 forks source link

v0.39.0 fail on startup with: No module named 'custom_components.smartthinq_sensors.wideq.devices.range' #731

Closed cafarre closed 2 months ago

cafarre commented 2 months ago

Describe the bug After upgrade to v0.39.0 version the integration fails on startup with error: Setup failed for custom integration 'smartthinq_sensors': Unable to import component: No module named 'custom_components.smartthinq_sensors.wideq.devices.range'

Expected behavior If applicable, a clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Environment details: Environment (HASSIO, Raspbian, etc): HAOS Home Assistant version installed: 2024.3.1 Component version installed: v0.39.0 Last know working version: v0.38.7 LG device type and model with issue: NA LG devices connected (list): NA

Output of HA logs

2024-04-03 20:35:00.082 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration 'smartthinq_sensors': Unable to import component: No module named 'custom_components.smartthinq_sensors.wideq.devices.range'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 296, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 894, in async_get_component
    comp = self.get_component()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 921, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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/smartthinq_sensors/__init__.py", line 50, in <module>
    from .wideq import (
  File "/config/custom_components/smartthinq_sensors/wideq/__init__.py", line 6, in <module>
    from .factory import get_lge_device
  File "/config/custom_components/smartthinq_sensors/wideq/factory.py", line 23, in <module>
    from .devices.range import RangeDevice
ModuleNotFoundError: No module named 'custom_components.smartthinq_sensors.wideq.devices.range'

Additional context Add any other context about the problem here.

MarkHofmann11 commented 2 months ago

I found a temporary work-around by doing the following:

1) Make a new/additional directory in custom_components named "smartthinq_sensors.wideq" 2) Copied the contents of the "wideq" directory to the root of that new directory. 3) Restarted and everything is working with no error.

Seems to be some type of new way how the custom component loading is handled, since this has a nested structure in it.

ollo69 commented 2 months ago

The only difference from v0.38.7 to v0.39.0 is the change of requirement related to pycountry module. due to some constrain in HA 2024.4, there are no change it integration structure or code. I can only suppose some issue with other installed integrations and /or related library, I suggest to upgrade to HA 2024.4 and check if the issue is still there.

cafarre commented 2 months ago

I have tried reinstalling the previous version and the problem has been solved. Then I reinstalled the latest version again and everything worked correctly. There was still some problem with the download through Hacs. Thank you all very much.

MarkHofmann11 commented 2 months ago

In my case, I saw the problem after upgrading HA to 2024.4. It refused to load the component and failed with the error like listed above. I did the work-around above and things were all happy. Not sure what changed in HA to cause this, but I saw it right after the upgrade.