-
-
Notifications
You must be signed in to change notification settings - Fork 569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Air Purifier Pro second motor speed #176
Conversation
@@ -87,6 +88,7 @@ def test_status(self): | |||
assert self.state().filter_hours_used == self.device.start_state["f1_hour_used"] | |||
assert self.state().use_time == self.device.start_state["use_time"] | |||
assert self.state().motor_speed == self.device.start_state["motor1_speed"] | |||
assert self.state().motor2_speed == self.device.start_state["motor2_speed"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (83 > 79 characters)
Please be careful. The Air Purifier 2 doesn't provide the new property:
|
Ok thanks. In that case I've annotated the return value as Optional[int] correctly. |
I've done some research and decompiled the MiHome app. I've found some methods and properties that are not yet implemented in the library. The MiHome downloads external code in form of plugins depending on the devices it detect. I only have the Air Purifier and the airpurifier plugin it downloaded contains only code related to Air Purifier and Air Monitor devices. Properties and related methods I've found in the code: I've also tried brute force some property names. I've found one that is not used in the MiHome app (maybe there are even more but brute force takes a lot of time as it generates all possible letter, digit and underscore combination. I've let it work for around 10-15 minutes but couldn't find anything more, but I've only started with 5-letter long props.
@syssi can you verify my findings on Air Purifier 2? |
You did an awesome job! Thanks a lot! I'm very interested in "how to decompile the mihome app". I will checkout your properties as soon as possible (friday). |
Could you please extend both examples by the new property + value (manually): Thanks! |
Regarding the decompilation, I've first downloaded the MiHome apk (com.xiaomi.mihome.apk) from the Google Play and I've used apk2gold apk decompiler. The results may vary depending on the level and method of optimisation and obfuscation. The resulting Java code is usually not very readable and requires some analysis. First I've tried to look for some known patterns/commands like get_prop, set_volume etc but I couldn't find any in the MiHome itself. Then I've noticed that the app has support for plugins: it downloads separate apk files and run them. |
OK I did more thorough analysis of the code: |
Could you check some additional thing? I'm unsure about the valid operation modes ("set_mode") of the Air Purifier Pro. Could you provide a list of valid modes (auto, silent, favorite, idle) and favorite_levels (0...16) of your device? |
The Pro model doesn't support the idle mode (I've mentioned this in the #141). Other modes are correct. It seems that it supports favorite_level up to 17 (0..17). |
Conclusion for the zhimi.airpurifier.m1 (Air Purifier 2): rfid_product_id, rfid_tag, act_det isn't supported |
|
BTW I've switched to JADX (/~https://github.com/skylot/jadx) for APK decompilation and it creates much better results and thanks to GUI version it's much easier to work with. I'm going to update this PR with more properties. |
|
I can provide some more APKs if interested:
|
7, 19 and 2 are plugins for built-in shops and catalogs. I would like to take a look at the other ones. |
You've mail! |
@@ -95,6 +107,8 @@ def test_status(self): | |||
assert self.state().child_lock == (self.device.start_state["child_lock"] == 'on') | |||
assert self.state().illuminance == self.device.start_state["bright"] | |||
assert self.state().volume == self.device.start_state["volume"] | |||
assert self.state().filter_rfid_product_id == self.device.start_state["rfid_product_id"] | |||
assert self.state().filter_rfid_tag == self.device.start_state["rfid_tag"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (82 > 79 characters)
@@ -95,6 +107,8 @@ def test_status(self): | |||
assert self.state().child_lock == (self.device.start_state["child_lock"] == 'on') | |||
assert self.state().illuminance == self.device.start_state["bright"] | |||
assert self.state().volume == self.device.start_state["volume"] | |||
assert self.state().filter_rfid_product_id == self.device.start_state["rfid_product_id"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line too long (96 > 79 characters)
Air Purifier Pro has a motor2_speed property which actually holds the speed of the main fan motor. The motor1_speed seems to indicate the speed of a small fan which probably sucks air into the laser PM2.5 detector on the back.
Maybe someone with Air Purifier 2 could verify if this property is also available in that model. Depending on the result I'll update the docstrings for both motor speed properties.