python-miio
python-miio copied to clipboard
Support for the Xiaomi Induction Cooker
This is a first attempt at supporting the Xiaomi Induction Cooker models (#491), which include models
chunmi.ihcooker.eg1 chunmi.ihcooker.exp1 chunmi.ihcooker.chefnic chunmi.ihcooker.hk1 chunmi.ihcooker.korea1 chunmi.ihcooker.tw1 chunmi.ihcooker.v1
Turns out the device is a bit more advanced than the app makes it appear. It supports 16-step recipes with each step having specific power, temperature, timer and next-phase settings. This enables building 'smart' recipes for e.g. automated rice cooking, kettle, pressure cooking, etc.
Supported features:
- [x] Stopping device
- [x] Starting a profile with and without confirmation
- [x] Status of cooker including temperature, power/fire output, recipe phase.
- [x] Saving a recipe to the menu.
- [x] Making custom recipes with
CookProfile. - [x] Update recipe settings while running.
- [x] Factory reset.
- [x] Interpreting existing recipes.
To do:
- [x] Build successfully; currently stuck on an issue with poetry/tox
AttributeError: type object 'Callable' has no attribute '_abc_registry'<- I could use some advice here :-). - [ ] Run some more real-world tests.
- [ ] Verify with beta testers.
- [ ] Verify that other models are correctly supported.
- [ ] Figure out some of the remaining mystery bits & bytes in the recipe and status fields.
- [ ] Write more tests on integration.
- [ ] Figure out how to make recipe building accessible (default yaml file that can be passed to CLI?)
Shout-out to @aquarat, @EUA and @hossF for initial analysis and @esgie for the plugin APK 👍
Here's a read-out of a rice-cooker program.

Hi basveeling,
thanks for this works.
for Build successfully; currently stuck on an issue with poetry/tox AttributeError: type object 'Callable' has no attribute '_abc_registry' <- I could use some advice here :-) : maybe it's on line 621 of ihcooker.py, change menu to recip_name : "Menu: {result.recipe_name}\n"
in my side build works.
Any news on this issue?
I'm willing to test it. It is working on my induction cooker.
There is also #1018 (which aims to support only one model listed in your description). I think it would be great if you @basveeling and @sschirr could combine your efforts & knowledge on this topic :-)
There is also #1018 (which aims to support only one model listed in your description). I think it would be great if you @basveeling and @sschirr could combine your efforts & knowledge on this topic :-)
It seems this is a different device class (chunmi.cooker, whereas this PR concerns chunmi.ihcooker) and the multicooker seems closer to the rice cookers in operation.
@rytilahti Thank you for the review! With a bit of delay on my side, I believe I have made most of the changes requested, outside of moving the bytestring building to Construct. I can take a look at that at a later point, I leave it up to you to decide if that is a blocking issue for this PR. In the mean time I'm happy to address any other issues, looking forward to hearing your thoughts!
@rytilahti Thank you for the feedback! A couple of changes in this new version.
- moved the recipe building to Construct (I needed to add two custom Subconstructs for this, perhaps you know a good place to place these in the directory structure?)
- I went for a parametrised construct for the two versions, I could not get a single construct to work for both versions.
- Added a JSON recipe conversion option and example recipe.
- Some extra commands for making simple recipes based on single power and temperature settings.
Hi @basveeling and thanks for the update!
- moved the recipe building to Construct (I needed to add two custom Subconstructs for this, perhaps you know a good place to place these in the directory structure?)
Great! Since #1160 we started to move integrations to their own packages, the idea being that contents of that directory do not spill over to other integrations.
This will allow storing all code, auxiliary files and tests inside a single package. So I would suggest creating miio/integrations/ihcooker/ and move everything contained in this PR there, the directory structure could be something like:
ihcooker/data/for the profile filesihcooker/tests/for the test file(s)ihcooker/ihcooker.pyfor the main entry point (the Device-derived class)- Additional files, so maybe it makes sense to separate the structures into separate file(s) to make the main module cleaner
- I went for a parametrised construct for the two versions, I could not get a single construct to work for both versions.
Without reading the code yet, that sounds like a good approach :+1: If you don't mind reshuffling the parts prior I do a full review, that would be great!
Hi @rytilahti, thanks for the suggestion. I've refactored the code to use the new dir structure. It's a large PR so I'd understand if it takes some time :-). Looking forward to your review!
Hi Teemu / @rytilahti,
I hope all is well. I see there's still a change requested status on this PR, but I think I've addressed all the comments. Just wanted to make sure it's clear this is ready for your review whenever you find the time :-).
Enjoy the holiday period!
Hi! Following this issue since the start. Want to build my brew master with this cooker. Any news on this? 😁
I have chunmi.ihcooker.v2
tried running miiocli cooker --ip blablabla --token blablabla status and got
WARNING:miio.device:Found an unsupported model 'chunmi.ihcooker.v2' for class 'Cooker'. If this is working for you, please open an issue at https://github.com/rytilahti/python-miio/
Error: {'code': -9999, 'message': 'user ack timeout'}
@syssi where can I read about extracting react plugin from android (or jailbroken iPhone) device?
what to do to reactivate this?
@basveeling Maybe you will be interested, and it will be great if you can take a look I rewrote this PR in Dart and use it in a cross-platform Flutter app which controls the cooker. Here is the repository: https://github.com/thewh1teagle/MiCook.