PiotrMachowski / Home-Assistant-custom-components-Xiaomi-Cloud-Map-Extractor

This custom integration provides a way to present a live view of a map for Xiaomi (Roborock/Viomi/Roidmi/Dreame) vacuums without a need for rooting.
MIT License
1.15k stars 122 forks source link

Missing Python module after HASS update #514

Open youcube opened 7 months ago

youcube commented 7 months ago

Checklist

The problem

image

As mentioned here, there is a problem with the Python version and the imp module. See the following link.

https://github.com/home-assistant/core/issues/110220

What version of an integration has described problem?

2.2.1

What was the last working version of an integration?

2.2.21

What vacuum model do you have problems with?

Viomi SE

What version of Home Assistant do you use?

2024.2.5

What type of installation are you running?

Home Assistant Core

Camera's configuration

camera:
  - platform: xiaomi_cloud_map_extractor
    host: !secret viomise_ip
    token: !secret viomise_token
    username: !secret xiaomi_user
    password: !secret xiaomi_pw
    auto_update: false
    scan_interval: 30
    country: "de"
    draw: ["all"]
    store_map_raw: true
    store_map_path: /config/www/vacuum_mapdata/
    attributes:
      - calibration_points
    colors:
      color_map_inside: [32, 115, 185]
      color_map_outside: [93, 102, 110]
      color_map_wall: [0, 0, 0]
      color_map_wall_v2: [0, 0, 0]
      color_grey_wall: [93, 109, 126]
      color_ignored_obstacle: [0, 0, 0, 127]
      color_ignored_obstacle_with_photo: [0, 0, 0, 127]
      color_obstacle: [0, 0, 0, 127]
      color_obstacle_with_photo: [0, 0, 0, 127]
      color_path: [147, 194, 238]
      color_goto_path: [0, 255, 0]
      color_predicted_path: [255, 255, 0, 0]
      color_cleaned_area: [127, 127, 127, 127]
      color_zones: [0xAD, 0xD8, 0xFF, 0x8F]
      color_zones_outline: [0xAD, 0xD8, 0xFF]
      color_virtual_walls: [255, 0, 0]
      color_new_discovered_area: [64, 64, 64]
      color_no_go_zones: [255, 33, 55, 127]
      color_no_go_zones_outline: [255, 0, 0]
      color_no_mop_zones: [163, 130, 211, 127]
      color_no_mop_zones_outline: [163, 130, 211]
      color_charger: [0x66, 0xfe, 0xda, 0x7f]
      color_robo: [75, 235, 149]
      color_room_names: [0, 0, 0]
      color_unknown: [0, 0, 0]
      color_scan: [0xDF, 0xDF, 0xDF]
    map_transformation:
      scale: 1.5
      trim:
        top: 25
        bottom: 40
        left: 45
        right: 35

Errors shown in the HA logs (if applicable)

Logger: homeassistant.config
Source: config.py:1518
First occurred: 10:28:30 (2 occurrences)
Last logged: 10:28:31

Platform error: vacuum - No module named 'imp'
Platform error: camera - No module named 'imp'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1518, in async_process_component_config
    platform = p_integration.get_platform(domain)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 847, in get_platform
    cache[full_name] = self._import_platform(platform_name)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 864, in _import_platform
    return importlib.import_module(f"{self.pkg_path}.{platform_name}")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 994, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/config/custom_components/viomise/vacuum.py", line 6, in <module>
    from miio import DeviceException, ViomiVacuum  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/__init__.py", line 12, in <module>
    from miio.device import Device, DeviceStatus  # isort: skip
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/miio/device.py", line 13, in <module>
    from .miioprotocol import MiIOProtocol
  File "/usr/local/lib/python3.12/site-packages/miio/miioprotocol.py", line 13, in <module>
    import construct
  File "/usr/local/lib/python3.12/site-packages/construct/__init__.py", line 22, in <module>
    from construct.core import *
  File "/usr/local/lib/python3.12/site-packages/construct/core.py", line 3, in <module>
    import struct, io, binascii, itertools, collections, pickle, sys, os, tempfile, hashlib, importlib, imp
ModuleNotFoundError: No module named 'imp'

Additional information

No response

slusaro2 commented 7 months ago

You have to type in manifest construct version:

  "requirements": [
    "construct==2.10.70",

and restart HA.

youcube commented 7 months ago

Problem is resolved with this workaround.