homebridge-mi-airpurifier icon indicating copy to clipboard operation
homebridge-mi-airpurifier copied to clipboard

Mi Air Purifier 3 - not working

Open pl-samurai opened this issue 4 years ago • 52 comments

Hello. Can you make working script for Purifier 3?

pl-samurai avatar Oct 23 '19 23:10 pl-samurai

+1

PierreBrisorgueil avatar Nov 06 '19 17:11 PierreBrisorgueil

Same here. Would love to see version 3 working.

qstyler avatar Nov 12 '19 11:11 qstyler

2h support would also be nice

tgr9 avatar Nov 14 '19 21:11 tgr9

And 3H. Pretty please :)

boro55 avatar Nov 15 '19 19:11 boro55

Same here.

hechien avatar Nov 18 '19 18:11 hechien

Is something from homebridge-mi-airpurifier read this Issue? I don't think. Maybe project homebridge-mi-airpurifier is dead?

pl-samurai avatar Nov 19 '19 22:11 pl-samurai

hum, don't know, but probably linked to this, the plugin is based on miio https://github.com/aholstenson/miio/issues/259 so also on this https://github.com/aholstenson/miio/issues/257

and this : https://github.com/rytilahti/python-miio/issues/543

PierreBrisorgueil avatar Nov 20 '19 13:11 PierreBrisorgueil

i did basic purifier 3 support, you need to add/replace files from this zip and setup ip/token/did

https://ufile.io/hnc3imlc

rezmus avatar Nov 22 '19 12:11 rezmus

I can confirm it's working with 3H. Thanks for your help @rezmus !

boro55 avatar Nov 22 '19 12:11 boro55

i did basic purifier 3 support, you need to add/replace files from this zip and setup ip/token/did

https://ufile.io/hnc3imlc

Where i need to replace this files? Before instalation? After?

pl-samurai avatar Nov 22 '19 17:11 pl-samurai

ok i found - /usr/local/lib/node - but i dont know what is this => "did": "xxxxxxxxx", in config.

pl-samurai avatar Nov 22 '19 18:11 pl-samurai

and - should i setup token and ip in file index.js or only copy to plugin catalog?

pl-samurai avatar Nov 22 '19 18:11 pl-samurai

Ok i found DID - device ID - this is this? => zhimi-airpurifier-ma4_mibtb303?

pl-samurai avatar Nov 22 '19 18:11 pl-samurai

[2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3HumidityAccessory - Humidity - getHumidity Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirQualityAccessory - AirQuality - getAirQuality Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3TemperatureAccessory - Temperature - getTemperature Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - SilentModeSwitch - getOn Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - TargetAirPurifierState - getTargetAirPurifierState: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - CurrentAirPurifierState - getCurrentAirPurifierState Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - Active - getActive Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - LockPhysicalControls - getLockPhysicalControls Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - RotationSpeed - getRotationSpeed Error: Error: Call to device timed out [2019-11-22 19:51:34] [MiAirPurifierPlatform] [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - FilterChangeIndication - getFilterChangeIndication Error: Error: Call to device timed out

pl-samurai avatar Nov 22 '19 18:11 pl-samurai

which method do you use to get your token?

rezmus avatar Nov 22 '19 19:11 rezmus

which method do you use to get your token?

iBackup and then DB browser. I have token and IP, DID - this is MAC adress?

pl-samurai avatar Nov 22 '19 19:11 pl-samurai

did is device id, should be numer 8-9 digits long.

rezmus avatar Nov 22 '19 19:11 rezmus

did is device id, should be numer 8-9 digits long.

IS this ZID from sqlite database? I check - he have 9 digits but not working.

pl-samurai avatar Nov 22 '19 19:11 pl-samurai

[2019-11-22 20:12:09] [MiAirPurifierPlatform] Initializing platform accessory 'MiAirPurifier3'... HAP Warning: Characteristic 000000AC-0000-1000-8000-0026BB765291 not in required or optional characteristics for service 000000BB-0000-1000-8000-0026BB765291. Adding anyway.

Is this a normal message?

pl-samurai avatar Nov 22 '19 19:11 pl-samurai

did is device id, should be numer 8-9 digits long.

rezmus i only add IP and token to config on my homebridge. Index.js file i only copy whithout changes to node and air purifier folder?

pl-samurai avatar Nov 22 '19 19:11 pl-samurai

Solved. Thanks rezmus. DID - this is ZDID from sqllite database. Guys token is changing when you change wifi network after reset old conection to your wifi network. You always must check new token.

pl-samurai avatar Nov 22 '19 19:11 pl-samurai

Thanks for @rezmus share the implementation, and thanks for some steps shared by @pl-samurai after I tried to replace the files / token / ip and the device id, I got these errors like "TargetAirPurifierState - getTargetAirPurifierState: Error: Call to device timed out" when I run the home bridge.

I'm sure the token / IP / Device ID are correct ...

Does anyone knows why? Thanks!

hechien avatar Nov 25 '19 14:11 hechien

if you are sure ip/token is correct use one of cli tools, miio (nodejs) or miiocli (python-miio), send miIO.info to your device and paste result here (cover sensitive data).

rezmus avatar Nov 25 '19 20:11 rezmus

@rezmus Hi, thanks for your reply. I'm not sure how to send the "miIO.info" to the device, do you mean the "miio discover" command?

hechien avatar Nov 26 '19 16:11 hechien

miiocli device --ip IP --token TOKEN raw_command miIO.info

or

miio tokens update IP --token TOKEN miio protocol call IP miIO.info

rezmus avatar Nov 26 '19 16:11 rezmus

@rezmus Hi, here are the results:

root@hassbian:/home/pi# miio tokens update 192.168.5.71 --token 9347205c422842eaba6f123dc5da90d577684c1d107ef518b85de96b2b02d8f20143db63ee66b0cdff9f69917680151e INFO Updating token for 192.168.5.71

INFO Connected to miio:107563792 - trying to change token

ERROR Could not update token, double-check the given token

==========

root@hassbian:/home/pi# miio protocol call 192.168.5.71 miIO.info INFO Attempting to call miIO.info on 192.168.5.71

INFO Device found, making call

ERROR Encountered an error while controlling device

Error was: Could not connect to device, token needs to be specified

hechien avatar Nov 27 '19 12:11 hechien

you didn't decrypt token from ios db, try homebridge with this settings

"ip": "192.168.5.71", "token": "e7168a55c07934c7906d8db2b9da0178", "did": "107563792",

rezmus avatar Nov 27 '19 13:11 rezmus

@rezmus So many thanks for your help, it works now. Yep, I didn't decrypt the token, maybe I missed the step ... now it works fine! Thanks again!

hechien avatar Nov 27 '19 15:11 hechien

@rezmus I've installed your patch and it seems to be working great - except for the speed of the fan: that doesn't seem to be working at all (so I can only switch between auto and night mode). I've got a bunch of these errors:

 [MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - RotationSpeed - getRotationSpeed Error: Error: busy.
[MiAirPurifierPlatform][ERROR]MiAirPurifier3AirPurifierAccessory - LockPhysicalControls - getLockPhysicalControls Error: Error: busy

Do you know what can be possibly be wrong?

duhanebel avatar Dec 01 '19 19:12 duhanebel

@rezmus I see you've used favorite_level to set rotationspeed. Why not use siid 10: (motor-speed), piid: 8 (motor1-speed) and piid: 9 (motor1-set-speed)? Instead of 12 steps we can have 100 steps.

For this model, motor speed ranges from 390 to 2150 apparently. This can be mapped to 1-100 in homekit.

mouth4war avatar Dec 16 '19 07:12 mouth4war