syssi / xiaomi_airpurifier

Xiaomi Mi Air Purifier and Xiaomi Mi Air Humidifier integration for Home Assistant
Apache License 2.0
446 stars 109 forks source link

Platform error fan.xiaomi_miio_airpurifier - cannot import name 'AirHumidifierJsqs' from 'miio' #285

Open bimodinochka opened 2 years ago

bimodinochka commented 2 years ago

The integration has been working stably for a while, but after several server reboots, the devices are no longer available and when I reboot, I get an error:

Platform error fan.xiaomi_miio_airpurifier - cannot import name 'AirHumidifierJsqs' from 'miio' (/usr/local/lib/python3.9/site-packages/miio/init.py)

We have to comment out the lines with the devices so that we can do a reboot.

But after this reconnection I get this error again.

If you do not use integration for a week or more (perhaps after HA updates) and then reconnect the devices, they will work again, but after a couple of server reboots everything starts over.

How can I fix this, I often work with HA and reboot it often and this becomes a problem for me.

But this is the best integration for my devices.

krakowski commented 2 years ago

I got the same error today after restarting. After some investigation I found out that homeassistant-vacuum-viomi depends on a older version of python-miio (manifest.json contains python-miio==0.5.9) while this project uses python-miio>=0.5.11 inside its manifest.json. Version 0.5.9 does not contain AirHumidifierJsqs (see __init__.py).

Changing the dependency inside custom_components/xiaomi_viomi/manifest.json from python-miio==0.5.9 to python-miio>=0.5.11 and rebooting Home Assistant fixed the problem for me.

bimodinochka commented 2 years ago

I got the same error today after restarting. After some investigation I found out that homeassistant-vacuum-viomi depends on a older version of python-miio (manifest.json contains python-miio==0.5.9) while this project uses python-miio>=0.5.11 inside its manifest.json. Version 0.5.9 does not contain AirHumidifierJsqs (see init.py).

Changing the dependency inside custom_components/xiaomi_miio_airpurifier/manifest.json from python-miio==0.5.9 to python-miio>=0.5.11 and rebooting Home Assistant fixed the problem for me.

Thank you for your answer but unfortunately it doesn't work for me. Besides, I don't use (homeassistant-vacuum-viomi) and mine (python-miio>=0.5.11) was originally version 0.5.11.

krakowski commented 2 years ago

Do you use any other custom components which depend on python-miio? Judging from the error message, it looks like the installed version of python-miio is not up to date, but I might be wrong on this.

Does the following command (executed inside the environment Home Assistant is running) print something on the console?

grep "AirHumidifierJsqs" /usr/local/lib/python3.9/site-packages/miio/__init__.py