scottyphillips / pychonet

A simple to use library for interfacing with the ECHONETlite protocol
GNU General Public License v3.0
19 stars 17 forks source link

Setup failed for custom integration 'echonetlite': Unable to import component: No module named 'deprecated' #70

Closed tom3q closed 7 months ago

tom3q commented 7 months ago

After updating pychonet to 2.6.3 the echonetlite integration fails to load for me with the following exception

Traceback (most recent call last):
  File "/var/lib/homeassistant/lib/python3.11/site-packages/homeassistant/setup.py", line 251, in _async_setup_component
    component = integration.get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/var/lib/homeassistant/lib/python3.11/site-packages/homeassistant/loader.py", line 827, in get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/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 "/home/homeassistant/.homeassistant/custom_components/echonetlite/__init__.py", line 5, in <module>
    import pychonet as echonet
  File "/var/lib/homeassistant/lib/python3.11/site-packages/pychonet/__init__.py", line 6, in <module>
    from .ElectricBlind import ElectricBlind
  File "/var/lib/homeassistant/lib/python3.11/site-packages/pychonet/ElectricBlind.py", line 1, in <module>
    from deprecated import deprecated
ModuleNotFoundError: No module named 'deprecated'

It looks like the import in question was added by https://github.com/scottyphillips/pychonet/commit/9d6b79464dcdc4f9149707b548d086ba58bc3899

Any idea how to fix this? Thanks in advance!

tom3q commented 7 months ago

Running pip install Deprecated seems to have fixed it. Does the Deprecated module need to be somehow added as a dependency so that it can be installed automatically?

nao-pon commented 7 months ago

@tom3q Thank you for letting me know! I set it as a dependent module.

tom3q commented 7 months ago

Thanks for the quick fix again!