ronengr / hass_nuki_bt

Control Nuki Lock over bluetooth
MIT License
32 stars 7 forks source link

Cannot load component V0.0.14 and V0.0.13 with Nuki V4 #63

Closed cicero200272 closed 2 weeks ago

cicero200272 commented 4 weeks ago

System Health details

System Information

version core-2024.5.2
installation_type Home Assistant Container
dev false
hassio false
docker true
user root
virtualenv false
python_version 3.12.2
os_name Linux
os_version 5.10.103-v7l+
arch armv7l
timezone Europe/Berlin
config_dir /config
Home Assistant Community Store GitHub API | ok -- | -- GitHub Content | ok GitHub Web | ok GitHub API Calls Remaining | 4421 Installed Version | 1.34.0 Stage | running Available Repositories | 1388 Downloaded Repositories | 28
Home Assistant Cloud logged_in | true -- | -- subscription_expiration | 21. September 2024 um 02:00 relayer_connected | true relayer_region | eu-central-1 remote_enabled | true remote_connected | true alexa_enabled | true google_enabled | false remote_server | eu-central-1-7.ui.nabu.casa certificate_status | ready instance_id | 35c5ebd370f5454f90f48a8a563ac01f can_reach_cert_server | ok can_reach_cloud_auth | ok can_reach_cloud | ok
Dashboards dashboards | 4 -- | -- resources | 14 views | 7 mode | yaml
Recorder oldest_recorder_run | 15. Mai 2024 um 10:44 -- | -- current_recorder_run | 3. Juni 2024 um 11:21 estimated_db_size | 200.08 MiB database_engine | mysql database_version | 10.6.11
Spotify api_endpoint_reachable | ok -- | --

Checklist

Nuki Device type

Nuki V4 non pro (no bridge)

hass_nuki_bt version

V0.0.14 and V0.0.13

Describe the issue

V0.0.14 and V0.0.13 do not load when HA starts up. V0.0.12 works without errors.

Reproduction steps

1. 2. 3. ...

Debug logs

2024-06-03 11:19:10.026 ERROR (MainThread) [homeassistant.setup] Setup failed for custom integration 'hass_nuki_bt': Unable to import component: cannot import name 'OffsettedEnd' from 'construct' (/usr/local/lib/python3.12/site-packages/construct/__init__.py)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/loader.py", line 981, 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 1041, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, 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/hass_nuki_bt/__init__.py", line 16, in <module>
    from pyNukiBT import NukiDevice, NukiConst
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/__init__.py", line 1, in <module>
    from .const import NukiConst, NukiLockConst, NukiOpenerConst, NukiErrorException
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/const.py", line 2, in <module>
    from construct import Bit, BitStruct, Optional, Padding, OffsettedEnd, Struct, Byte, Enum, Int8ul, Int16ul, Int32ul, Int8sl, Int16sl, Float32l, PaddedString, Bytes, Switch, GreedyBytes, this
ImportError: cannot import name 'OffsettedEnd' from 'construct' (/usr/local/lib/python3.12/site-packages/construct/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 322, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1001, in async_get_component
    self._component_future.result()
  File "/usr/src/homeassistant/homeassistant/loader.py", line 993, in async_get_component
    comp = self._get_component()
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1041, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 144, 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/hass_nuki_bt/__init__.py", line 16, in <module>
    from pyNukiBT import NukiDevice, NukiConst
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/__init__.py", line 1, in <module>
    from .const import NukiConst, NukiLockConst, NukiOpenerConst, NukiErrorException
  File "/usr/local/lib/python3.12/site-packages/pyNukiBT/const.py", line 2, in <module>
    from construct import Bit, BitStruct, Optional, Padding, OffsettedEnd, Struct, Byte, Enum, Int8ul, Int16ul, Int32ul, Int8sl, Int16sl, Float32l, PaddedString, Bytes, Switch, GreedyBytes, this
ImportError: cannot import name 'OffsettedEnd' from 'construct' (/usr/local/lib/python3.12/site-packages/construct/__init__.py)

Diagnostics dump

No response

ronengr commented 4 weeks ago

Interesting. It seems you have and old version of "construct" and for some reason HA didn't automatically install construct 2.10.70, even though it is in the dependencies of pyNukiBT

Did you get any errors during installation? Do you have any other integration that uses the construct package, and maybe force-set it to a lower version?

As a workaround, you can try manually upgrading the construct package to 2.10.70. But it is interesting to find out why this was not done automatically by HA

cicero200272 commented 3 weeks ago

I manually upgraded construct to 2.10.70 (was 2.10.68), but I still get the same error during startup. No other components are using this package afaik...

stones80 commented 3 weeks ago

I have the same problem. Thanks for the support

yyogo commented 2 weeks ago

Looks like this is due to a conflict with another HA component:

https://github.com/home-assistant/core/blob/master/requirements_all.txt#L672-L673

cicero200272 commented 2 weeks ago

Looks like this is due to a conflict with another HA component:

https://github.com/home-assistant/core/blob/master/requirements_all.txt#L672-L673

Thank you! I forgot about a custom component for Xiaomi fans which indeed uses the "construct" package and sets its version to 2.10.68. I fixed the dependency there and then successfully upgraded this component to V0.0.14.

Case is closed, thanks again!

cryptedx commented 1 week ago

I have the same issue but have not installed this Xiaomi integration. Any idea how I can solve that issue?