AlexxIT / XiaomiGateway3

Home Assistant custom component for control Xiaomi Multimode Gateway (aka Gateway 3), Xiaomi Multimode Gateway 2, Aqara Hub E1 on default firmwares over LAN
https://github.com/AlexxIT/Blog
MIT License
2.43k stars 341 forks source link

Integration stops working 2024.9.0 #1434

Closed Psytoshgen closed 4 weeks ago

Psytoshgen commented 1 month ago
Setup failed for custom integration 'xiaomi_gateway3': Unable to import component: cannot import name 'DATA_TYPES' from 'zigpy.zcl.foundation' (/usr/local/lib/python3.12/site-packages/zigpy/zcl/foundation.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/xiaomi_gateway3/__init__.py", line 14, in <module>
    from .core.device import XDevice
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 9, in <module>
    from .converters import silabs
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 4, in <module>
    from zigpy.zcl.foundation import (
ImportError: cannot import name 'DATA_TYPES' from 'zigpy.zcl.foundation' (/usr/local/lib/python3.12/site-packages/zigpy/zcl/foundation.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/xiaomi_gateway3/__init__.py", line 14, in <module>
    from .core.device import XDevice
  File "/config/custom_components/xiaomi_gateway3/core/device.py", line 9, in <module>
    from .converters import silabs
  File "/config/custom_components/xiaomi_gateway3/core/converters/silabs.py", line 4, in <module>
    from zigpy.zcl.foundation import (
ImportError: cannot import name 'DATA_TYPES' from 'zigpy.zcl.foundation' (/usr/local/lib/python3.12/site-packages/zigpy/zcl/foundation.py)
banalac commented 1 month ago

Same here.

Necroneco commented 1 month ago

since zigpy replaces DATA_TYPES with another structure

https://github.com/zigpy/zigpy/commit/6a84984067b69435b45f0fc6f1ff22ee01a0e734

This is not an issue related to 2024.9.0b2

LeandroIssa commented 4 weeks ago

Same here.

ErnestoBrandao commented 4 weeks ago

Same problem back to 2024.08.3 :(

ErnestoBrandao commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

zhn9992 commented 4 weeks ago

Same here. 20240904.0

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0"

it worked for me too, thanks

lemeshovich commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0"

it worked for me too, thanks

yeechen-lee commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

it worked for me too, thx

LeandroIssa commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

it worked for me too, thx

Algorithm0 commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

If you use ZigBee configuration via another device (for example, via Sonoff USB transmission), then this "fix" will simply kill it. Don't do it.

AlexxIT commented 4 weeks ago

The correct fix has already been added to the master version

LordArrin commented 4 weeks ago

The correct fix has already been added to the master version

Waiting for release)

xiasi0 commented 4 weeks ago

修复了么?

Algorithm0 commented 4 weeks ago

The correct fix has already been added to the master version

I understand that 4.0.6 is not ready yet, but maybe it would be worth releasing a minor update so that people can update from Hacs?

AlexxIT commented 4 weeks ago

People can update from HACS at any time

gyandor commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

Worked after reboot.

Psytoshgen commented 4 weeks ago

s

nope, this dont work for me )

xiasi0 commented 4 weeks ago

有人测试修复了么?

032mix commented 4 weeks ago

Hi, how do we fetch the latest master through HACS? Redownloading 4.0.5 did not resolve the issue. Or is it done manually somehow?

Edit: check my next comment on how I did this

xiasi0 commented 4 weeks ago

Hi, how do we fetch the latest master through HACS? Redownloading 4.0.5 did not resolve the issue. Or is it done manually somehow?

+1

q1t1 commented 4 weeks ago

Change the file manifest.json /homeassistant/custom_components/xiaomi_gateway3/manifest.json to: line 14 "zigpy>=0.52.3,<0.66.0" for me it worked.:)

If you use ZigBee configuration via another device (for example, via Sonoff USB transmission), then this "fix" will simply kill it. Don't do it.

Yep, this "fix" kills ZHA and Xiaomi Aqara !

bithajcsar commented 4 weeks ago

Same here: ZHA has died...

ValiEne commented 4 weeks ago

The "fix" also killed my ZHA.

q1t1 commented 4 weeks ago

The "fix" also killed my ZHA.

And reverting the line in manifest.json don't set it back...

bithajcsar commented 4 weeks ago

Napló: homeassistant.setup Forrás: setup.py:334 Először fordult elő: 21:27:05 (1 Események) Utoljára naplózott: 21:27:05

Setup failed for 'zha': Unable to import component: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.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 "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 9, in from zha.application.gateway import Gateway File "/usr/local/lib/python3.12/site-packages/zha/application/gateway.py", line 14, in from zhaquirks import setup as setup_quirks File "/usr/local/lib/python3.12/site-packages/zhaquirks/init.py", line 16, in from zigpy.quirks import DEVICE_REGISTRY, CustomCluster, CustomDevice ImportError: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.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 "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 9, in from zha.application.gateway import Gateway File "/usr/local/lib/python3.12/site-packages/zha/application/gateway.py", line 14, in from zhaquirks import setup as setup_quirks File "/usr/local/lib/python3.12/site-packages/zhaquirks/init.py", line 16, in from zigpy.quirks import DEVICE_REGISTRY, CustomCluster, CustomDevice ImportError: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.py)

ValiEne commented 4 weeks ago

The "fix" also killed my ZHA.

And reverting the line in manifest.json don't set it back...

What was the text before the "fix"? Try a full reboot of HAOS maybe it helps

ErnestoBrandao commented 4 weeks ago

Texto before fix.: line 14 "zigpy>=0.52.3"

:)

A quarta, 4/09/2024, 20:39, Vali Ene @.***> escreveu:

The "fix" also killed my ZHA.

And reverting the line in manifest.json don't set it back...

What was the text before the "fix"? Try a full reboot of HAOS maybe it helps

— Reply to this email directly, view it on GitHub https://github.com/AlexxIT/XiaomiGateway3/issues/1434#issuecomment-2329833400, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZLEIMFWF4RHXWXJHXYCSXLZU5OYBAVCNFSM6AAAAABNNFQQU6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRZHAZTGNBQGA . You are receiving this because you commented.Message ID: @.***>

q1t1 commented 4 weeks ago

The "fix" also killed my ZHA.

And reverting the line in manifest.json don't set it back...

What was the text before the "fix"? Try a full reboot of HAOS maybe it helps

I've done it, without success...

Restoring backup RN...

032mix commented 4 weeks ago

Hi, how do we fetch the latest master through HACS? Redownloading 4.0.5 did not resolve the issue. Or is it done manually somehow?

I just went ahead and did the change manually then restarted HASS. It fixed it for me, but keep in mind users are reporting this is killing their ZHA setup.

GSVil commented 4 weeks ago

I can confirm, by redownloading the integration in HACS breaks ZHA.

perfect-deform commented 4 weeks ago

So, how to fix the "Fix" now? ZHA is broken. Reverting the 14th line doesn't help

AlexxIT commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass.

Nismonx commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass.

`Logger: homeassistant.setup Source: setup.py:334 First occurred: 21:58:50 (1 occurrences) Last logged: 21:58:50

Setup failed for 'zha': Unable to import component: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.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 "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 9, in from zha.application.gateway import Gateway File "/usr/local/lib/python3.12/site-packages/zha/application/gateway.py", line 14, in from zhaquirks import setup as setup_quirks File "/usr/local/lib/python3.12/site-packages/zhaquirks/init.py", line 16, in from zigpy.quirks import DEVICE_REGISTRY, CustomCluster, CustomDevice ImportError: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.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 "", line 1387, in _gcd_import File "", line 1360, in _find_and_load File "", line 1331, in _find_and_load_unlocked File "", line 935, in _load_unlocked File "", line 995, in exec_module File "", line 488, in _call_with_frames_removed File "/usr/src/homeassistant/homeassistant/components/zha/init.py", line 9, in from zha.application.gateway import Gateway File "/usr/local/lib/python3.12/site-packages/zha/application/gateway.py", line 14, in from zhaquirks import setup as setup_quirks File "/usr/local/lib/python3.12/site-packages/zhaquirks/init.py", line 16, in from zigpy.quirks import DEVICE_REGISTRY, CustomCluster, CustomDevice ImportError: cannot import name 'DEVICE_REGISTRY' from 'zigpy.quirks' (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.py)`

bithajcsar commented 4 weeks ago

Same here. Did not fix the error.

Nismonx commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass. importlib.import_module(self.pkg_path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File (/usr/local/lib/python3.12/site-packages/zigpy/quirks/init.py)`

Wait! let me try to complete reboot the system...

Edit: no luck ZHA is back but gatway3 not loading

bithajcsar commented 4 weeks ago

I did the reboot, but without success.

perfect-deform commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass.

Nope. Still the same. Even restoring from backup didn't help

bithajcsar commented 4 weeks ago

Upgrade to 4.0.6 through HACS helped! Thanks AlexxIT!

rama31244 commented 4 weeks ago

If I use zigbee2mqtt instead of ZHA, can I make the suggested change without issues? Edit: can confirm upgrade to 4.0.6 worked for me, thanks

perfect-deform commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass.

Worked only after rebooting system. Rebooting just HA failed. Thnx

AlexxIT commented 4 weeks ago

https://github.com/AlexxIT/XiaomiGateway3/releases/tag/v4.0.6

GSVil commented 4 weeks ago

For fixing ZHA change "zigpy==0.66.0" and restart Hass.

Sorry if I'm being stupid, but I don't know what this means. Must I replace a file, change a value somewhere?

AlexxIT commented 4 weeks ago

If you have broken a ZHA on your own - you should know where to replace this.

GSVil commented 4 weeks ago

If you have broken a ZHA on your own - you should know where to replace this.

Sorry, I thought ZHA broke with the release of v4.0.6 and you were explaining how to fix it. Thanks for responding.