merdok / homebridge-miot

Homebridge plugin for devices supporting the Xiaomi miot protocol
MIT License
397 stars 64 forks source link

Support for Smart Air Purifier 4 no longer works #630

Closed sasojadrovski closed 5 days ago

sasojadrovski commented 2 months ago

Describe the bug Since a few days ago, Homebridge continuously reports issues with the Smart Air Purifier 4. It looks like Homebridge cannot connect to the device. I did try with forcing Mi Cloud, but the issue persists.

Expected behavior Smart Air Purifier 4 should work as expected.

Your config.json

{
    "name": "Air Purifier",
    "ip": "192.168.2.44",
    "token": "XXX", // redacted for security reasons
    "deviceId": "YYY", // redacted for security reasons
    "model": "zhimi.airp.mb5a",
    "pollingInterval": 10,
    "deepDebugLog": false,
    "silentLog": false,
    "deviceEnabled": true,
    "micloud": {
        "country": "de",
        "forceMiCloud": false
    },
    "onlyMainService": false,
    "buzzerControl": false,
    "ledControl": false,
    "childLockControl": false,
    "modeControl": false,
    "suppressAutoServiceCreation": [
        "illumination"
    ],
    "fanLevelControl": false,
    "screenControl": false
}

Debug log

[9/13/2024, 3:46:00 PM] [homebridge-miot] [Air Purifier] Device found! Setting up miot device from local connection!
[9/13/2024, 3:46:00 PM] [homebridge-miot] [Air Purifier] Connected to device: zhimi.airp.mb5a
[9/13/2024, 3:46:00 PM] [homebridge-miot] [Air Purifier] Doing initial property fetch.
[9/13/2024, 3:46:12 PM] [homebridge-miot] [Air Purifier] Starting property polling.
[9/13/2024, 3:46:54 PM] [homebridge-miot] [Air Purifier] Poll failed 4 times in a row! Stopping polling and trying to reconnect! Reason: Error: Call to device timed out

Will enable deep debug logs if needed. Above is an output without.

Screenshots N/A

Additional context N/A

merdok commented 2 months ago

That might be a strong indicator that the token changed. You would need to re-fetch the token. Also if you specify forceMiCloud then you also have to specify the account credentials for login.

sasojadrovski commented 2 months ago

Thanks @merdok,

How do I re-fetch the token?

I know I have to add my credentials if I force using Mi Cloud.

merdok commented 2 months ago

Please check the README for the credentials!

The token you can retrieve as usual

gnz-ori commented 1 month ago

Been having issues with the Xiaomi Air Purifier 4 Pro. Deleted and re-added and saw these lines.

Actually I woke up today and my two Air Purifiers in the Plugin disappeared. Had to add them back. After adding back, one of them, the 4 Pro showed that error.

Screenshot 2024-10-09 at 11 47 00

gnz-ori commented 1 month ago

So after a few tries I got it back. But there seems to be a bug with the "general device settings" where even when the controls are not selected, they still appear as part of the created device.

Please refer to the screenshots:

Screenshot 2024-10-09 at 11 58 56 Screenshot 2024-10-09 at 11 58 06

merdok commented 1 month ago

What would you expect to disappear? From your screenshot it looks as it supposed to...

arktiknova commented 1 month ago

What would you expect to disappear? From your screenshot it looks as it supposed to...

  1. If you noticed in the first screenshot, none of those are ticked (selected). And they all appear. What I'm trying to do is simplify what I see in Apple Home, which is without the screen toggle options, while maintaining the On/Off button, temperature, humidity, air quality and filter maintenance like my other air purifiers.

  2. Or was it the case the functions will be automatically created and cannot be removed or customised to which the user prefer?

  3. I forgot to mention another bug. So I set my air purifiers to turn on at certain time of the day e.g. 10am and 3am. So when they turn on by its automated instruction in Apple Home, 3/4 of the time the air purifiers will go into the max volume mode (volume 3) instead of going into auto mode by default when it's turn on (they are always on auto even before being automated to turn off).

merdok commented 1 month ago

Screen is a device specific setting so you will not find it under the generic section, but I guess under the air purifier section.

arktiknova commented 1 month ago

Oh yeah you are right. Just checked btw after you pointed it out but I don't have them ticked too. Basically everything automatically appeared even when they are not ticked (selected). Are those supports to appear despite not being selected?

Screenshot 2024-10-09 at 21 47 34

merdok commented 1 month ago

You should try to tick it and save, and afterwards untick it, save again and re-check.

arktiknova commented 1 month ago

Finally got the time to give it a try. I did as suggested and it finally worked after two reboots. Thank you!

Edit: However, I now noticed my second unit, the Xiaomi Air Purifier 2 now doesn't show the temperature and humidity data now after the two reboots (and a few more to make sure). Nothing was touched on that unit's settings.

Screenshot 2024-10-10 at 14 55 50

merdok commented 1 month ago

Good to hear. About your other device you have to check what the log says, possibility it cannot connect to the device.