al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.73k stars 672 forks source link

Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp' #1886

Closed peceq closed 1 month ago

peceq commented 2 months ago

Szczegóły loga (BŁĘDY) Rejestrator: homeassistant.setup Źródło: setup.py:334 Pierwsze zdarzenie: 14:00:49 (1 zdarzenia) Ostatnio zalogowany: 14:00:49

Setup failed for custom integration 'xiaomi_miot': Unable to import component: No module named 'imp' 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 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 "/config/custom_components/xiaomi_miot/init.py", line 45, in from miio import ( File "/usr/local/lib/python3.12/site-packages/miio/init.py", line 12, in from miio.device import Device, DeviceStatus # isort: skip ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 13, in from .miioprotocol import MiIOProtocol File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 13, in import construct File "/usr/local/lib/python3.12/site-packages/construct/init.py", line 22, in from construct.core import File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 3, in import struct, io, binascii, itertools, collections, pickle, sys, os, tempfile, hashlib, importlib, imp ModuleNotFoundError: No module named 'imp'

HA: image

cnzd commented 2 months ago

same problem

l-j commented 2 months ago

@peceq, @cnzd I had the same issue, but I checked and in my case there was a race condition between this extension and the home-assistant-vacuum-styj02ym. The latter had a dependency on the old version of construct library which is incompatible with Python 3.12 and it is no longer maintained, so the problem is unresolved.

It took me a couple of hours to figure it out, maybe it will help you.

cnzd commented 1 month ago

@l-j Thank you.My problem is resolved after I uninstall two extension I did not use now.Maybe it's similar to your situation.

wangoverflow commented 1 month ago

I failed to login Xiaomi account , but my account and password was right.

itsmartinho commented 1 month ago

@l-j Thank you.My problem is resolved after I uninstall two extension I did not use now.Maybe it's similar to your situation.

Which did you delete? Mine still doesn't work...

l-j commented 1 month ago

@itsmartinho As I wrote earlier: home-assistant-vacuum-styj02ym. You can also search through manifest.json files of your custom_components and look for the old construct version in the requirements. construct>=2.10.68 will work correctly with Python 3.12