xiaomi_cooker icon indicating copy to clipboard operation
xiaomi_cooker copied to clipboard

Add chunmi.cooker.eh1 support

Open anhnvme opened this issue 5 years ago • 32 comments

Hello,

I just bought chunmi.cooker.eh1, how can i contribute a example signal for you to support this version on Home Assitant

anhnvme avatar Jan 18 '19 07:01 anhnvme

Just play around with "miiocli device --ip IP --token raw_command " and provide the request & response payload here.

syssi avatar Jan 18 '19 07:01 syssi

Hello, what is raw_command parameter ? Tried following your guide, i got this error

root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command
Usage: miiocli device raw_command [OPTIONS] COMMAND [PARAMETERS]
Try "miiocli device raw_command --help" for help.

Error: Missing argument "COMMAND".

anhnvme avatar Jan 21 '19 01:01 anhnvme

I'm tried run mirobo command but look like it's not support yet

root@raspberrypi:~# mirobo discover
INFO:miio.discovery:Discovering devices with mDNS, press any key to quit...
INFO:miio.discovery:Found a supported 'AirPurifier' at 192.168.31.237 - token: 00000000000000000000000000000000
WARNING:miio.discovery:Found unsupported device chunmi-cooker-eh1_miio78._miio._udp.local. at 192.168.31.107, please report to developers
^C
Aborted!
root@raspberrypi:~# mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw-command
Usage: mirobo raw-command [OPTIONS] CMD [PARAMETERS]
Try "mirobo raw-command --help" for help.

Error: Missing argument "CMD".
root@raspberrypi:~# mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw-command  '["all"]'
Sending cmd ["all"] with params []
Error: {'message': 'Invalid json.', 'code': -5000}
root@raspberrypi:~#

anhnvme avatar Jan 21 '19 02:01 anhnvme

Please provide the output of:

mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 status
mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop "['all']"
# Start cooking and try to retrieve the temperature history after 10 minutes:
mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"

syssi avatar Jan 21 '19 08:01 syssi

Hello,

Bellow is output as your request

root@raspberrypi:~# mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 status
Error: {'message': 'Invalid json.', 'code': -5000}
root@raspberrypi:~# mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop
Usage: mirobo [OPTIONS] COMMAND [ARGS]...
Try "mirobo --help" for help.

Error: No such command "raw_command".
root@raspberrypi:~# mirobo --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"
Usage: mirobo [OPTIONS] COMMAND [ARGS]...
Try "mirobo --help" for help.

Error: No such command "raw_command".
root@raspberrypi:~#

anhnvme avatar Jan 21 '19 09:01 anhnvme

Next try:

miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 info
miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop "['all']"
# Start cooking and try to retrieve the temperature history after 10 minutes:
miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"

syssi avatar Jan 21 '19 14:01 syssi

Hello,

This is output

root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 info
Model: chunmi.cooker.eh1
Hardware version: ESP32
Firmware version: 1.2.8_0011
Network: {'mask': '255.255.255.0', 'localIp': '192.168.31.107', 'gw': '192.168.31.1'}
AP: {'rssi': -28, 'bssid': '40:31:3C:D2:13:31', 'primary': 3, 'ssid': 'Home'}
root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop "['all']"
Running command raw_command
Error: {'message': 'Invalid json.', 'code': -5000}
root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"
Running command raw_command
['121212121212141416']
root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"
Running command raw_command
['121212121212141416181a1a1c1e2022']
root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_temp_history "[]"
Running command raw_command
['121212121212141416181a1a1c1e2022242628282a2c2e30303232323232323234343638']

anhnvme avatar Jan 22 '19 01:01 anhnvme

Next step (because "getprop all" isn't working). What's the output of:

miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop "['func', 'menu', 'stage', 'temp', 't_func', 't_precook', 't_cook', 'setting', 'delay', 'version', 'favorite', 'custom']"

syssi avatar Jan 22 '19 07:01 syssi

Hello,

Bellow is output,

root@raspberrypi:~# miiocli device --ip 192.168.31.107 --token a0c7fab7892234576143207374831431 raw_command get_prop "['func', 'menu', 'stage', 'temp', 't_func', 't_precook', 't_cook', 'setting', 'delay', 'version', 'favorite', 'custom']"
Running command raw_command
Error: {'code': -5000, 'message': 'Invalid json.'}
root@raspberrypi:~#

anhnvme avatar Jan 22 '19 13:01 anhnvme

@syssi Hello, do u have any update ? if u need anything, let's me know to do it

anhnvme avatar Jan 25 '19 01:01 anhnvme

We need a proper get_prop response. Do you use the MiHome app? Is your cooker already supported?

syssi avatar Jan 25 '19 05:01 syssi

Yes, Of cause, Mi Home app work correctly perfect. But cam't get get_prop variable, i think mirobo library not supported yet

anhnvme avatar Jan 25 '19 06:01 anhnvme

Hi, I am also interested into this new ricecooker integration. I have done several test and I have included the profiles from the standard cooker. In case this will help, If I do: miiocli cooker --ip 192.168.31.126 --token ff27b8b5a84431b2c1e0ed747aee5fc1 start 0001E10100000000000080026E10082B126E1412698CAA555555550014280A6E0C02050506050505055A14040A0C0C0D00040505060A0F086E6E20000C0A5A28036468686A0004040500000000000000010202020204040506070708001212180C1E2D2D37000000000000000000000099A5

The rice cooker turns into fast rice cooking (40 min) on the display, but it does not start cooking

Result of the command is: Cooking profile started None

How can I make it start cooking? Is this related with the Profile code?

Thanks

sarriagf avatar May 25 '19 07:05 sarriagf

Also, when I do 'stop' command I get the following: Cooking stopped Error: {'code': -5000, 'message': 'Invalid json.'} and it does not stop

sarriagf avatar May 25 '19 07:05 sarriagf

Hi, I've got the following device: Model: chunmi.cooker.eh1 Hardware version: esp32 Firmware version: 2.0.5_0013

These are the mini cookers so I think they have slightly different props to the normal and pressure cookers.

Observations:

  • get_prop "['all']" returns []
  • get_prop "['version']" returns [13]
  • get_prop "['status']" returns (depending on status: 1 - idle? 2 - cooking / keep warm status 3 - done.
  • get_prop "['rice']" returns [1] for northeast rice? [0] for unknown

I think you might need a separate class for handling these mini cookers.

xernaj avatar Oct 31 '19 06:10 xernaj

@xernaj Could you provide the output of:

get_prop "['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']"

syssi avatar Oct 31 '19 07:10 syssi

Some additional presumably supported methods:

'set_start', [menuData]
'cancel_cooking', []
'set_menu', [menuData]
set_factory_reset', [1]
'get_temp_history', []
'set_info', [setting]

syssi avatar Oct 31 '19 07:10 syssi

@syssi

@xernaj Could you provide the output of:

get_prop "['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']"

It doesn't seem to return all the values in the array: miiocli device --ip {ip} --token {token} raw_command get_prop "['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']" Running command raw_command [1]

I can get the values individually though eg. get_prop "['status']", get_prop "['t_left']" etc.: (cooker on standby and on keep warm menu): status 1 phase 0 menu 0303000000000000000000000000000000000004 t_cook 60 t_left 0 t_pre 0 t_kw 0 taste 1 temp 28 rice 0 favs ffffffff akw 1 t_start 0 t_finish version 13 setting 0 code 0 en_warm 31 t_congee 90 t_love 60 boil 0

xernaj avatar Oct 31 '19 09:10 xernaj

Some additional presumably supported methods:

'set_start', [menuData]
'cancel_cooking', []
'set_menu', [menuData]
set_factory_reset', [1]
'get_temp_history', []
'set_info', [setting]

I'll have to try some of this out on the next cook.

xernaj avatar Oct 31 '19 09:10 xernaj

It only seems to return the first element of the array.

miiocli -d device --ip {ip} --token {token} raw_command get_prop "['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']" INFO:miio.cli:Debug mode active Running command raw_command DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b'' DEBUG:miio.device:Got a response: Container: data = Container: data = b'' (total 0) value = b'' (total 0) offset1 = 32 offset2 = 32 length = 0 header = Container: data = b'!1\x00 \x00\x00\x00\x00\x07f\xb0\x00\x00?e' (total 16) value = Container: length = 32 unknown = 0 device_id = b'\x07f\xb0' (total 4) ts = 1970-01-01 04:30:29 offset1 = 0 offset2 = 16 length = 16 checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16) DEBUG:miio.device:Discovered 076660b0 with ts: 1970-01-01 04:30:29, token: b'ffffffffffffffffffffffffffffffff' DEBUG:miio.device:{ip}:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']} DEBUG:miio.device:{ip}:54321 (ts: 1970-01-01 04:30:29, id: 1) << {'id': 1, 'result': [1]} [1]

xernaj avatar Oct 31 '19 09:10 xernaj

Cool!

syssi avatar Oct 31 '19 10:10 syssi

Hi all, Any news about this device? I am still stocked on the same place, I can put a menu on the cooker but ir does not start at all with "start PROFILE"

Any ideas there?

sarriagf avatar Jan 02 '20 22:01 sarriagf

Hello! Is there any progress of this device?

XingKongSync avatar Feb 11 '20 13:02 XingKongSync

@syssi I decompiled the APK for the chunmi.cooker.eh1, found a few things from some preliminary testing:

  1. profile codes are as follows: profile_baowen = "020103000000040c00001800000100800100000000000000002091827d7800000091827d7800000091827d78000000915a7d7820000091827d7800000091826e78ff000091827d7800000091826e7810000091826e7810000091827d7800000091827d780000a082007882140010871478030000eb820078821400108714780300012d8200788214001087147a0501ffff8200788214001087147d0501200000000000000000000000000000000090e5"; profile_duntang = "02010400000005e601000100000a00800102050a14000000002091827d7800000091827d7800000091827d78001e00915a7d7820000091827d7800000091826e78ff000091827d7800000091826e7810ffff91827d78ff000091827d7800000091827d780000a082007882140010871478030000eb820078821400108714780300012d8200788214001087147a0501ffff8200788214001087147d0501200000000000000000000000000000000020b5"; profile_jingzhu = "02010000000001e101000000000000800101050814000000002091827d7800050091822d781c0a0091823c781c1e0091ff827820ffff91828278000500ffff8278ffffff91828278000d00ff828778ff000091827d7800000091827d7800ffff91826078ff0100490366780701086c0078090301af540266780801086c00780a02023c5701667b0e010a71007a0d02ffff5701667b0f010a73007d0d032005000000000000000000000000000000cf53"; profile_kuaizhu = "02010100000002e100280000000000800101050614000000002091827d7800000091823c7820000091823c781c1e0091ff827820ffff91828278000500ffff8278ffffff91828278000d00ff828778ff000082827d7800000091827d7800ffff91826078ff0164490366780701086c007409030200540266780801086c00760a0202785701667b0e010a7100780a02ffff5701667b0f010a73007b0a032005000000000000000000000000000000ddba"; profile_zhuzhou = "02010200000003e2011e0400002800800101050614000000002091827d7800000091827d7800000091827d78001e0091ff877820ffff91827d78001e0091ff8278ffffff91828278001e0091828278060f0091827d7804000091827d7800000091827d780001f54e0255261802062a0482030002eb4e0255261802062a04820300032d4e0252261802062c04820501ffff4e0152241802062c0482050120000000000000000000000000000000009ce2"; I am able to start the device using the following command: miiocli -d cooker --ip IPADDR --token TOKEN raw_command set_menu "['02010000000001e101000000000000800100050814000000002091827d7800050091822d781c0a0091823c781c1e0091ff827820ffff91828278000500ffff8278ffffff91828278000d00ff828778ff000091827d7800000091827d7800ffff91826078ff0100490366780701086c0078090301af540266780801086c00780a02023c5701667b0e010a71007a0d02ffff5701667b0f010a73007d0d032005000000000000000000000000000000cf53']"

  2. Seems like the cooker implements a new method for stopping. The methods implemented in the cooker class don't work with the chunmi.cooker.eh1. I am able to stop the cooker using the following command: miiocli -d cooker --ip IPADDR--token TOKEN raw_command cancel_cooking []

Still not too sure how to send settings like rice type etc. to the cooker, but at least this allows some basic operations like starting and stopping.

I'm also attaching the MiioDevice class from the APK, which has details on how the methods are implemented com.chunmi.ehcooker.device.MiioDevice.txt

liangleslie avatar Apr 20 '20 05:04 liangleslie

Upvote (:з」∠)

KurumiSerori avatar Jul 02 '20 11:07 KurumiSerori

# Methods:
set_info [setting]
get_info []
set_menu [menuData]
set_start [menuData]
cancel_cooking []
set_factory_reset [1]
get_temp_history []

# Properties:
get_prop ['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']

syssi avatar Oct 30 '20 19:10 syssi

Bump for interest. How can I help? Never used xiaomi devices but have relevant skillset

kosztyua avatar Apr 14 '21 15:04 kosztyua

You could implement the device. I would like provide some support. The first step is to retrieve the token of your device. Your could use this tool to retrieve the token from the cloud: https://github.com/PiotrMachowski/Xiaomi-cloud-tokens-extractor

Second step: Install python-miio and try to control the device. Ping me if you are able to retrieve values.

syssi avatar Apr 14 '21 15:04 syssi

It seems I managed to connect properly. Had some trouble with networking as I wanted to leave it on the guest subnet, but managed.

miiocli -d device --ip 192.168.5.228 --token aa8b3bea8bc193b9be41e8e18402fd49 raw_command get_prop "['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']"
INFO:miio.cli:Debug mode active
Running command raw_command
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.miioprotocol:Got a response: Container: 
    data = Container: 
        data = b'' (total 0)
        value = b'' (total 0)
        offset1 = 32
        offset2 = 32
        length = 0
    header = Container: 
        data = b'!1\x00 \x00\x00\x00\x00\x12:\xeb\xda\x00\x00\x05\xce' (total 16)
        value = Container: 
            length = 32
            unknown = 0
            device_id = unhexlify('123aebda')
            ts = 1970-01-01 00:24:46
        offset1 = 0
        offset2 = 16
        length = 16
    checksum = b'\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff' (total 16)
DEBUG:miio.miioprotocol:Discovered 123aebda with ts: 1970-01-01 00:24:46, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.miioprotocol:192.168.5.228:54321 >>: {'id': 1, 'method': 'get_prop', 'params': ['status', 'phase', 'menu', 't_cook', 't_left', 't_pre', 't_kw', 'taste', 'temp', 'rice', 'favs', 'akw', 't_start', 't_finish', 'version', 'setting', 'code', 'en_warm', 't_congee', 't_love', 'boil']}
DEBUG:miio.miioprotocol:192.168.5.228:54321 (ts: 1970-01-01 00:24:46, id: 1) << {'id': 1, 'result': [1]}
[1]

Also I have reviewed the decompiled apk and it all adds up. I will try to run a few test cooks.

kosztyua avatar Apr 19 '21 16:04 kosztyua

Having same issue. I have sucessfully acquered token for my device. Ready provide input and supprt development.

Unsupported device found! Please create an issue at https://github.com/syssi/xiaomi_cooker/issues and provide the following data: chunmi.cooker.eh1

bachulator avatar Apr 24 '21 07:04 bachulator