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.48k stars 349 forks source link

Unable to prepare setup for platform 'xiaomi_gateway3.climate': Platform not found #1252

Closed Joery closed 10 months ago

Joery commented 10 months ago

Hi,

Since the update to Home Assistant 2024.1.0, I'm getting errors when trying to load the integration:

The following integrations and platforms could not be set up:

xiaomi_gateway3.climate ([Show logs](https://xxx/config/logs?filter=xiaomi_gateway3.climate))
xiaomi_gateway3.sensor ([Show logs](https://xxx/config/logs?filter=xiaomi_gateway3.sensor))
Please check your config and [logs](https://xxx/config/logs).

Details:

Logger: homeassistant.setup
Source: setup.py:403
First occurred: 03:03:29 (4 occurrences)
Last logged: 10:52:39

Unable to prepare setup for platform 'xiaomi_gateway3.climate': Platform not found (Exception importing custom_components.xiaomi_gateway3.climate).
Unable to prepare setup for platform 'xiaomi_gateway3.sensor': Platform not found (Exception importing custom_components.xiaomi_gateway3.sensor).

Sensor error:

Logger: homeassistant.loader
Source: loader.py:842
First occurred: 03:03:31 (2 occurrences)
Last logged: 10:52:39

Unexpected exception importing platform custom_components.xiaomi_gateway3.sensor
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 842, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 859, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/config/custom_components/xiaomi_gateway3/sensor.py", line 42, in <module>
    "power": POWER_WATT,
             ^^^^^^^^^^
NameError: name 'POWER_WATT' is not defined

Climate error:

Logger: homeassistant.loader
Source: loader.py:842
First occurred: 03:03:29 (2 occurrences)
Last logged: 10:52:39

Unexpected exception importing platform custom_components.xiaomi_gateway3.climate
Traceback (most recent call last):
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 842, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lsiopy/lib/python3.11/site-packages/homeassistant/loader.py", line 859, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 "/config/custom_components/xiaomi_gateway3/climate.py", line 14, in <module>
    HVAC_MODE_OFF: CURRENT_HVAC_OFF,
    ^^^^^^^^^^^^^
NameError: name 'HVAC_MODE_OFF' is not defined

I'm using the Xiaomi Gateway 3 (ZNDMWG03LM) with the latest 3.3.4 version of this integration.

RikardzPT commented 10 months ago

Hello, Duplicated issue

There's already a patch for it. (just a little search).

https://github.com/AlexxIT/XiaomiGateway3/issues/1245#issuecomment-1876994323