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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Xiaomi Purifier 4 Lite #75949
Conversation
This pull request needs to be manually signed off by @home-assistant/core before it can get merged. |
Hey there @rytilahti, @syssi, @starkillerOG, @bieniu, mind taking a look at this pull request as it has been labeled with an integration ( |
OK, tested again Dev Build -Device its correctly Detected -Sensors -Switch |
Display brightness Max is not working due to a bug in xiaomi-miio library(rytilahti/python-miio#1477), it was fixed and should work once a new release is made and integrated in HA. With Mode is not present you mean that it is not present on the fan entity? You can't change modes? Also Favorite level works only if the Favorite Mode is active. |
About Max brightness, perfect. About Mode, entity is not available/exposed to HA, so cannot be changed. The fan.turn_on/off only poweroff/on the device. And even when mode is changed by app (for example), Fan control still dont work, a short error about: "Favorite Level no longer available" after any change try. |
could you try directly with python-miio(v0.5.12) library via the command: miiocli airpurifiermiot --ip "x.x.x.x" --token "xxxxx" set_mode favorite ? Please try to change between the modes to make sure that the library is working ok and that the problem comes from the configuration in HA. Also is there any error related to the purifier in the HA log? |
-Yes, miiocli can change perfectly between all modes, this work fine, but again, property is not exposed to HA... I will try again from scratch all integration with miio, just in case -miiocli is not working fine at least to fan control. A simple status check dont retrieve any value, never, even after changing mode to favorite. Power: on Trying to set manually Level favorite, bring back a error status code: Setting favorite level to 10 If I monitor the value of the parameter with miio_raw, the value (favorite_level) varies over time without even modifying the fan with the application, It seems to be a counter, which goes from 300 to zero (about 5-6 min), which is reset if the value of the fan is modified from the application and the counter had already reached zero. If the counter has not reached zero, modifying the fan in the application does not reset it. Which makes me think that the specification that we currently have is wrong, and there is some other parameter that is controlling it via another property. If I have time I will intercept the traffic to really see what is going in and out of the application/device |
so you have the zhimi.airp.rmb1. I think the mapping of the favorite level is wrong in the python-miio, in the spec linked to in the code it is siid=9 and piid=11, but in the miio it is siid=9 and piid=5. You could try to clone the repo and try to see if doing this change makes it work(siid=9 and piid=11). |
Right, its "{'did': 'favorite_level', 'piid': 11, 'siid': 9}" <- Work fine. my original code in miio_raw was inverted. |
then please create a bug issue on the https://github.com/rytilahti/python-miio/issues repo if you did not already or a pull request with the fix because you have the device to proper test. |
hey guys, sorry but had a really really busy weekend, do you need help with additional testing? |
@alexdrl i guess from what i understood there seems to be a wrong mapping of the favorite level in the python-miio library. You could double check it by updating the mapping for it and see if it works after. If this is the case then we need an update in that library first(create an issue or PR to fix it) and wait for a new version to be released. |
IMO it's a very bad idea to merge something if it doesn't work. Favorite level should be removed or this PR should wait for a new version of python-miio. |
Agree with that, favorite mode could be set aside for that, just removing the feature. And waiting for the new version with that fixed... @borky did you test the favorite level on this PR? Not have that device to test, but tested with the same results as @Theliel there. |
@alexdrl yes i tested both devices for that PR as i have those, the favorite level is working ok. So should i remove the favorite level from here and continue with the merge? i saw that there is no issue or pull request made for this on the https://github.com/rytilahti/python-miio repository, i think someone that has this device should do that otherwise this feature might be missing for some time. |
@borky I have no background on Python development but I can give it a try, anyways there is no harm on removing the favorite level feature if I can't make it in a reasonable time |
@borky trying that and using python-miio locally was a lot easier than expected. I have created a PR for that rytilahti/python-miio#1486 Tested locally and that works for me :D |
@alexdrl great:)! then should i remove for the moment the favorite level from this device and continue with the merge? |
@borky can you remove the favorite level so this get merged? python-miio release process is slower than i expected and would be nice to have this on home-assistant 2022.10 |
Yeah, sorry for the slow release cycle (of python-miio), I'd also suggest not wait for a quick upstream release at the moment.. I'm currently working on refactoring the library to make it the only source of truth when it comes to which devices are supported and what functionality is offered by them. It would be great if someone could take a look at rytilahti/python-miio#1495 (esp. "Call for help") and create a PR to add the decorators to python-miio. This way the future homeassistant integration will expose the available sensors & settings automatically without changes at homeassistant's end :-) |
What happened here? I would really like to see this merged so it at least could be available in Home Assistant 2022.11 |
Didn't have time to give a try the dev env for this, but this could be merged removing the favourite level feature from the purifier 4 lite on this PR |
Yes, I have been using it, patching the files in core manually. It is working fine, but it's a pain to do this every time I upgrade HA. |
@bieniu @rytilahti Can I create a copy of this PR without the favorite level so we can merge it? |
Hey, you could fork the branch of this PR, add your changes on top your fork, and create a new PR based on your branch, while still keeping the initial commits (and thus the credit) intact :) |
@rytilahti completely makes sense, created this one #79758 |
Proposed change
Add support for the Xiaomi Mi Air Purifier 4 Lite.
Type of change
Additional information
Checklist
black --fast homeassistant tests
)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest
.requirements_all.txt
.Updated by running
python3 -m script.gen_requirements_all
..coveragerc
.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: