Xioami cooker integration

You could use an android emulator.

As @syssi says, you can download a android emulator in you computer as for example NoxPlayer.

https://ru.bignox.com/.

I pass you the russian version if you want.

BlueStacks is another popular emulator.

Have to do some research on that, so probably try to do something like that later this week. Will come back as soon as get any result.
I am a Linux user so it seems NoxPlayer not an option right now as well as BlueStack,

In this case “genymotion” is your friend (virtualbox required).

hi… im free to help but I dont understand your instruction. Can you let me know what you need and how do I get it to you and I’ll try with nox.

Ok done adb backup from other android phone with installed mihome and authorized to my xiaomi account but runnig into a problem

~$ adb backup -noapk com.xiaomi.smarthome -f backup.ab
Now unlock your device and confirm the backup operation…

~$ ls backup.ab
backup.ab

~$ miio-extract-tokens backup.ab
Saving database to /tmp/tmphzwgteed
INFO:miio.extract_tokens:Reading database from /tmp/tmphzwgteed
INFO:miio.extract_tokens:Reading tokens from Android DB

No tekens get returned. And since i dont get any (even known device type) probably structure of DB has changed. Backup is verified and seems to be good (passed encryption verification with backup password) Have been using --password option.

@LaFed,

You told that you have iOS, really?

So first you need to download aplication ibakup viewer. Then, you need to make a backup of you iphone device, and follow thiee steps:

2.- Using iTunes, create an unencrypted backup of your iPhone.
3.- Open the “Raw Data” module.
4.- Navigate to com.xiaomi.mihome.
5.- Search for a file that looks like this: 123456789_mihome.sqlite – note that _mihome.sqlite is not the correct file.
6.- Save this file to your filesystem.
7.- Install DB Browser for SQLite.
8.- Open DB Browser and load the .sqlite file you saved from your backup.
9.- Click on the Execute SQL tab.
10.- Input and run this query: SELECT ZTOKEN FROM ZDEVICE WHERE ZNAME = "Mi Robot Vacuum"
11.- You will obtain a 96 code with numbers and letters.

Once you have this, then tell to us.

Please install an old mi home app version. The token was removed from recent versions.

1 Like

Please use this version: https://www.apkmirror.com/apk/xiaomi-inc/mihome/mihome-5-0-0-release/

It’s the one from the home assistant documentation.

mirobo --ip --token info
chunmi.cooker.normal2 v1.2.8 ([MAC]) @ [IP] - token: [TOKEN]

mirobo --ip [IP] --token [TOKEN] raw_command get_prop '[“func”, “menu”, “stage”, “temp”, “t_func”, “t_precook”, “t_cook”, “setting”, “delay”, “version” ]'
Sending cmd get_prop with params [‘func’, ‘menu’, ‘stage’, ‘temp’, ‘t_func’, ‘t_precook’, ‘t_cook’, ‘setting’, ‘delay’, ‘version’]
[‘waiting’, ‘0001’, ‘null’, ‘22’, ‘60’, ‘-1’, ‘60’, ‘1407’, ‘05060f’, ‘00030017’, ‘0100’, ‘13281323ffff011effff010000001617’]

mirobo --ip [IP] --token [TOKEN] raw_command get_prop '[“all” ]'
Sending cmd get_prop with params [‘all’]
[‘waiting’, ‘0001’, ‘null’, ‘22’, ‘60’, ‘-1’, ‘60’, ‘1407’, ‘05060f’, ‘00030017’, ‘0100’, ‘13281323ffff011effff010000001617’]

1 Like

Perfect! Could you execute this one again (it’s a bit more verbose):

mirobo --ip --token -v info

-v is no valid option, -d seems to be the closest one :wink:

mirobo -d --ip [IP] --token [TOKEN] info
INFO:miio.vacuum_cli:Debug mode active
DEBUG:miio.vacuum_cli:Read stored sequence ids: {‘seq’: 4, ‘manual_seq’: 0}
DEBUG:miio.vacuum_cli:Connecting to [IP] with token [TOKEN]
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\x03\x9a\xf5\x1d\x00\x00@\x11’ (total 16)
value = Container:
length = 32
unknown = 0
device_id = b’\x03\x9a\xf5\x1d’ (total 4)
ts = 1970-01-01 04:33:21
offset1 = 0
offset2 = 16
length = 16
checksum = b’\xc7\xd5\xb4R5s\xec\x92!M\xb0QY\x80\xe1Y’ (total 16)
DEBUG:miio.device:Discovered 039af51d with ts: 1970-01-01 04:33:21, token: b’[TOKEN]’
DEBUG:miio.device:[IP]:54321 >>: {‘id’: 5, ‘method’: ‘miIO.info’, ‘params’: []}
DEBUG:miio.device:[IP]:54321 (ts: 1970-01-01 04:33:21, id: 5) << {‘result’: {‘life’: 16401, ‘token’: ‘[TOKEN]’, ‘mac’: ‘[MAC]’, ‘fw_ver’: ‘1.2.8’, ‘hw_ver’: ‘ESP8266’, ‘model’: ‘chunmi.cooker.normal2’, ‘mcu_fw_ver’: ‘0023’, ‘wifi_fw_ver’: ‘1.4.0(30e0bd0)’, ‘ap’: {‘rssi’: -61, ‘ssid’: ‘[SSID]’, ‘bssid’: ‘[BSSID]’}, ‘netif’: {‘localIp’: ‘[IP]’, ‘mask’: ‘255.255.255.0’, ‘gw’: ‘[GW]’}, ‘mmfree’: 11176}, ‘id’: 5}
chunmi.cooker.normal2 v1.2.8 ([MAC]) @ [IP] - token: [TOKEN]
DEBUG:miio.vacuum_cli:Full response: {‘ap’: {‘bssid’: ‘[BSSID]’, ‘rssi’: -61, ‘ssid’: ‘[SSID]’},
‘fw_ver’: ‘1.2.8’,
‘hw_ver’: ‘ESP8266’,
‘life’: 16401,
‘mac’: ‘[MAC]’,
‘mcu_fw_ver’: ‘0023’,
‘mmfree’: 11176,
‘model’: ‘chunmi.cooker.normal2’,
‘netif’: {‘gw’: ‘[GW]’,
‘localIp’: ‘[IP]’,
‘mask’: ‘255.255.255.0’},
‘token’: ‘[TOKEN]’,
‘wifi_fw_ver’: ‘1.4.0(30e0bd0)’}
DEBUG:miio.vacuum_cli:Writing {‘seq’: 5, ‘manual_seq’: 0} to python-miio/python-mirobo.seq

1 Like

Could you request the property “favorite” as well?

mirobo raw_command get_prop '["favorite"]'

mirobo --ip [IP] --token [TOKEN] raw_command get_prop '[“favorite”]'
Sending cmd get_prop with params [‘favorite’]
[‘precook’, ‘0001’, ‘009ce63cff’, ‘21’, ‘769’, ‘1180’, ‘60’, ‘1407’, ‘05060f’, ‘00030017’, ‘0100’, ‘13281323ffff011effff010000001516’]

In application you can favorite some cooking modes so I guess that command is relevant to this functionality and not that essential for automation part I guess.

do you still need help or @bachulator alone is enough? I m not understanding this mirobo command and where u can run it.

@LaFed I would be happy if some more people are involved. Did you extract your access token? If yes I will explain the python-miio install and using the included command line tool mirobo.

As much people get involve as much more chance of achieving something we get.:+1:

1 Like

ok… will install nox when i get home in an hour and try extracting it

ok managed to install nox player and mihome 5.0.15 but when extracting, it says there’s something wrong and way too small… I did enable USB debugging and enable backup (with no password) within nox…