YinHangCode / homebridge-mi-airpurifier

XiaoMi air purifier plugins for HomeBridge.
115 stars 34 forks source link

Mi Air Purifier 3 - not working #36

Open pl-samurai opened 5 years ago

pl-samurai commented 5 years ago

Hello. Can you make working script for Purifier 3?

PierreBrisorgueil commented 5 years ago

+1

qstyler commented 5 years ago

Same here. Would love to see version 3 working.

tgr9 commented 5 years ago

2h support would also be nice

boro55 commented 5 years ago

And 3H. Pretty please :)

hechien commented 5 years ago

Same here.

pl-samurai commented 5 years ago

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

PierreBrisorgueil commented 5 years ago

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

rezmus commented 5 years ago

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

https://ufile.io/hnc3imlc

boro55 commented 5 years ago

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

pl-samurai commented 5 years ago

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 commented 5 years ago

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

pl-samurai commented 5 years ago

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

pl-samurai commented 5 years ago

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

pl-samurai commented 5 years ago

[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

rezmus commented 5 years ago

which method do you use to get your token?

pl-samurai commented 5 years ago

which method do you use to get your token?

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

rezmus commented 5 years ago

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

pl-samurai commented 5 years ago

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 commented 5 years ago

[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 commented 5 years ago

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 commented 5 years ago

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.

hechien commented 5 years ago

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!

rezmus commented 5 years ago

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).

hechien commented 5 years ago

@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?

rezmus commented 5 years ago

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

or

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

hechien commented 5 years ago

@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

rezmus commented 5 years ago

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

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

hechien commented 5 years ago

@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!

duhanebel commented 5 years ago

@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?

mouth4war commented 4 years ago

@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.

rezmus commented 4 years ago

@mouth4war i don't have purifier 3 nor homebridge. used some old 2s plugin as template and made purifier 3 support for a friend. feel free to modify it any way you want ;)

mouth4war commented 4 years ago

Fair enough! Hope your friend doesn't see this and ask you to fix his wonky speed control :)

I'll give it a shot in a few days. Do we have any volunteer testers?

On Mon, 16 Dec, 2019, 3:30 PM rezmus, notifications@github.com wrote:

@mouth4war https://github.com/mouth4war i don't have purifier 3 nor homebridge. used some old 2s plugin as template and made purifier 3 support for a friend. feel free to modify it any way you want ;)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/YinHangCode/homebridge-mi-airpurifier/issues/36?email_source=notifications&email_token=AHHBO4452DUP2QZXUXTTQHDQY5GVBA5CNFSM4JEMWRL2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEG6FDXA#issuecomment-565989852, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHHBO44QMRSSIJALQ4Y5YTDQY5GVBANCNFSM4JEMWRLQ .

duhanebel commented 4 years ago

@mouth4war i can test!

mszf commented 4 years ago

@mouth4war, looking forward to test this too

mouth4war commented 4 years ago

Good to have testers onboard. Progress being made in the upstream miio library fork https://github.com/kingkong123/miio/pull/1

github9984 commented 4 years ago

Good to have testers onboard. Progress being made in the upstream miio library fork kingkong123/miio#1

How do I install this to test?

mouth4war commented 4 years ago

Good to have testers onboard. Progress being made in the upstream miio library fork kingkong123/miio#1

How do I install this to test?

Its the library behind the homebridge-airpurifier plugins. The plugins will need to be updated.

I'm actually using https://github.com/clauzewitz/homebridge-xiaomi-purifier so I'm probably going to modify that one instead. It shows the air purifier as an air purifier not as a switch. Which means that temperature, humidity, air quality etc show up inside of the air purifier object.

github9984 commented 4 years ago

Does it support mi air purifier 3?

xzero0911 commented 4 years ago

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

https://ufile.io/hnc3imlc

Thanks for your great work, but could you upload again because the file has expired?

rangerek commented 4 years ago

anyone recently has 3H working?

greensouth commented 4 years ago

Good to have testers onboard. Progress being made in the upstream miio library fork kingkong123/miio#1

How do I install this to test?

Its the library behind the homebridge-airpurifier plugins. The plugins will need to be updated.

I'm actually using https://github.com/clauzewitz/homebridge-xiaomi-purifier so I'm probably going to modify that one instead. It shows the air purifier as an air purifier not as a switch. Which means that temperature, humidity, air quality etc show up inside of the air purifier object.

Any luck porting the plugin to air purifier 3? tried everything to install it, also the "supposed" compatible miio from kingkong123 and I think that I'm too clumsy, because can't make it work :(

greensouth commented 4 years ago

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

https://ufile.io/hnc3imlc

Needed the file here also for 3 ... please re-upload :(

rezmus commented 4 years ago

https://ufile.io/khnjhscx

ajcrow93 commented 4 years ago

Is there anywhere with clear instructions for how to install this experimental support for the 3H? I'm trying to follow what's been written above but it's hard to follow, only coming in now.

Maybejames commented 4 years ago

Is there anywhere with clear instructions for how to install this experimental support for the 3H? I'm trying to follow what's been written above but it's hard to follow, only coming in now.

Same here. Just set up HomeBridge in Docker for first time and want to add my mi Air Purifier. Can some one point me in the direction of a step by step for installing this package? Want to learn/educate myself, but not sure where to start!

rgavril commented 4 years ago

I've created my own plugin that I am happy to share: rgavril/homebridge-xiaomi-air-purifier3

Will probably maintain it until official support is available in the already established plugins.

PierreBrisorgueil commented 4 years ago

@rgavril Thx :) work for me !

mszf commented 4 years ago

@rgavril Thanks! but even when installed manually on Hoobs, I can't make it work. Can you publish it trough npmjs.com too?

rgavril commented 4 years ago

@mszf There is already a npmsj.com package named homebridge-xiaomi-air-purifier3

Please not that this is a different plugin, written from scratch, and is not related to homebridge-mi-airpurifier. Because of this it has different configuration parameters so you'll need to modify your config.json

You can find out more on how to configure and install it on the project's github page.

ArielZgo commented 4 years ago

@rgavril it works! You are great! Thanks :D