Skip to content
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

Xiaomi Mi Robot Vacuum 2nd support #90

Closed
cxlwill opened this issue Oct 15, 2017 · 7 comments
Closed

Xiaomi Mi Robot Vacuum 2nd support #90

cxlwill opened this issue Oct 15, 2017 · 7 comments

Comments

@cxlwill
Copy link

cxlwill commented Oct 15, 2017

Actually it is not an issue, but I think it is pleasant to let you know that miIO works on the latest Mi Robot Vacuum 2nd, which is out in China mainland. This model adds mopping function but the protocol stays the same now, that's why original miIO vacuum part still works on it. And thanks for your work.

@rytilahti
Copy link
Owner

Thanks for letting us know, it's good to hear it is working! I have seen in the advertisement materials that the new one can also be ordered to go and clean/mop a specific area which could be interesting for some people. What is unclear there is whether this is done with another API or just by issuing manual commands, so I will keep this issue open until that's confirmed :-)

@cxlwill
Copy link
Author

cxlwill commented Oct 17, 2017

Is there anyway to fetch this information through existing method? Like mirobo's command line? I could encourage my friend to help.

@rytilahti
Copy link
Owner

There is some description how to do that (https://github.com/aholstenson/miio/blob/master/docs/protocol.md#analyzing-the-capture), but I have not ever tested it myself. It involves sniffing the traffic between the app and the device and testing out all possible actions on the app.

@fanthos
Copy link
Contributor

fanthos commented Dec 14, 2017

I did a test on my device and it seems does not work on my Rock Robot(2nd for mi robot).

(venv) c:\Workspaces\github\home-assistant>mirobo discover
INFO:miio.discovery:Discovering devices with mDNS, press any key to quit...
WARNING:miio.discovery:Found unsupported device roborock-vacuum-s5_miio74464285._miio._udp.local. at 192.168.201.224, please report to developers

Add "roborock-vacuum-s5": Vacuum, line after "rockrobo-vacuum-v1": Vacuum, should be a fix.

@fanthos
Copy link
Contributor

fanthos commented Dec 14, 2017

After package capture I got:

 ->  10.8.0.1 data= {"id":6528,"method":"get_consumable","params":[]}
 <-  192.168.201.224 data= {"result":[{"main_brush_work_time":63089,"side_brush_work_time":63089,"filter_work_time":63089,"sensor_dirty_time":62486}],"id":6528}
 ->  10.8.0.1 data= {"id":6529,"method":"get_log_upload_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"log_upload_status":7}],"id":6529}
 ->  10.8.0.1 data= {"id":6530,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":212,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6530}
 ->  10.8.0.1 data= {"id":6531,"method":"get_map_v1","params":[]}
 <-  192.168.201.224 data= {"result":["retry"],"id":6531}
 ->  10.8.0.1 data= {"id":6532,"method":"get_timezone","params":[]}
 <-  192.168.201.224 data= {"result":["Asia\/Shanghai"],"id":6532}
 ->  10.8.0.1 data= {"id":6533,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":213,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6533}
 ->  10.8.0.1 data= {"id":6534,"method":"get_consumable","params":[]}
 <-  192.168.201.224 data= {"result":[{"main_brush_work_time":63089,"side_brush_work_time":63089,"filter_work_time":63089,"sensor_dirty_time":62486}],"id":6534}
 ->  10.8.0.1 data= {"id":6535,"method":"get_timezone","params":[]}
 <-  192.168.201.224 data= {"result":["Asia\/Shanghai"],"id":6535}
 ->  10.8.0.1 data= N/A
 <-  192.168.201.224 data= N/A
 ->  10.8.0.1 data= {"id":6536,"method":"app_rc_end","params":[{}]}
 <-  192.168.201.224 data= {"result":["ok"],"id":6536}
 ->  10.8.0.1 data= {"id":6537,"method":"get_consumable","params":[]}
 <-  192.168.201.224 data= {"result":[{"main_brush_work_time":63089,"side_brush_work_time":63089,"filter_work_time":63089,"sensor_dirty_time":62486}],"id":6537}
 ->  10.8.0.1 data= {"id":6538,"method":"get_timezone","params":[]}
 <-  192.168.201.224 data= {"result":["Asia\/Shanghai"],"id":6538}
 ->  10.8.0.1 data= N/A
 <-  192.168.201.224 data= N/A
 ->  10.8.0.1 data= N/A
 <-  192.168.201.224 data= N/A
 ->  10.8.0.1 data= {"id":6539,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":214,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6539}
 ->  10.8.0.1 data= {"id":6540,"method":"app_rc_start"}
 <-  192.168.201.224 data= {"result":["ok"],"id":6540}
 ->  10.8.0.1 data= {"id":6541,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":215,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6541}
 ->  10.8.0.1 data= {"id":6542,"method":"app_rc_move","params":[{"omega":0,"velocity":0,"seqnum":1,"duration":1500}]}
 <-  192.168.201.224 data= {"result":["ok"],"id":6542}
 ->  10.8.0.1 data= {"id":6543,"method":"app_rc_end","params":[{}]}
 <-  192.168.201.224 data= {"result":["ok"],"id":6543}
 ->  10.8.0.1 data= {"id":6544,"method":"get_consumable","params":[]}
 <-  192.168.201.224 data= {"result":[{"main_brush_work_time":63089,"side_brush_work_time":63089,"filter_work_time":63089,"sensor_dirty_time":62486}],"id":6544}
 ->  10.8.0.1 data= {"id":6545,"method":"get_timezone","params":[]}
 <-  192.168.201.224 data= {"result":["Asia\/Shanghai"],"id":6545}
 ->  10.8.0.1 data= {"id":6546,"method":"get_consumable","params":[]}
 <-  192.168.201.224 data= {"result":[{"main_brush_work_time":63091,"side_brush_work_time":63091,"filter_work_time":63091,"sensor_dirty_time":62486}],"id":6546}
 ->  10.8.0.1 data= {"id":6547,"method":"get_log_upload_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"log_upload_status":7}],"id":6547}
 ->  10.8.0.1 data= {"id":6548,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":221,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6548}
 ->  10.8.0.1 data= {"id":6549,"method":"get_map_v1","params":[]}
 <-  192.168.201.224 data= {"result":["robomap%2F74464285%2F4"],"id":6549}
 ->  10.8.0.1 data= {"id":6550,"method":"get_timezone","params":[]}
 <-  192.168.201.224 data= {"result":["Asia\/Shanghai"],"id":6550}
 ->  10.8.0.1 data= {"id":6551,"method":"get_status","params":[]}
 <-  192.168.201.224 data= {"result":[{"msg_ver":1,"msg_seq":222,"state":8,"battery":100,"clean_time":3531,"clean_area":55787500,"error_code":0,"map_present":1,"in_cleaning":0,"fan_power":60,"dnd_enabled":0}],"id":6551}
 ->  10.8.0.1 data= {"id":6552,"method":"get_map_v1","params":[]}
 <-  192.168.201.224 data= {"result":["robomap%2F74464285%2F5"],"id":6552}

@fanthos
Copy link
Contributor

fanthos commented Dec 14, 2017

This issue seems fixed by #142 .

(hass) $ mirobo -d --ip 192.168.201.224 --token 42624bxxxx577130 info
INFO:miio.vacuum_cli:Debug mode active
ERROR:miio.vacuum_cli:Unable to read the stored msgid: Expecting value: line 1 column 1 (char 0)
DEBUG:miio.vacuum_cli:Connecting to 192.168.201.224 with token 42624bxxxx577130
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
    data = Container:
        value =  (total 0)
        data =  (total 0)
        offset2 = 32
        offset1 = 32
        length = 0
    header = Container:
        value = Container:
            length = 32
            unknown = 0
            devtype = default (total 7)
            serial = 15389
            ts = 2017-12-14 05:16:15
        data = !1\x00 \x00\x00\x00\x00\x04p<\x1dZ2\t\x1f (total 16)
        offset2 = 16
        offset1 = 0
        length = 16
    checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
DEBUG:miio.device:Discovered default 15389 with ts: 2017-12-14 05:16:15, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:192.168.201.224:54321 >>: {'id': 1, 'method': 'miIO.info', 'params': []}
ERROR:miio.device:Got error when receiving: timed out
WARNING:miio.device:Retrying with incremented id, retries left: 3
DEBUG:miio.protocol:Unable to decrypt, returning raw bytes: b''
DEBUG:miio.device:Got a response: Container:
    data = Container:
        value =  (total 0)
        data =  (total 0)
        offset2 = 32
        offset1 = 32
        length = 0
    header = Container:
        value = Container:
            length = 32
            unknown = 0
            devtype = default (total 7)
            serial = 15389
            ts = 2017-12-14 05:16:20
        data = !1\x00 \x00\x00\x00\x00\x04p<\x1dZ2\t$ (total 16)
        offset2 = 16
        offset1 = 0
        length = 16
    checksum = \xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff (total 16)
DEBUG:miio.device:Discovered default 15389 with ts: 2017-12-14 05:16:20, token: b'ffffffffffffffffffffffffffffffff'
DEBUG:miio.device:192.168.201.224:54321 >>: {'id': 102, 'method': 'miIO.info', 'params': []}
^C

@rytilahti
Copy link
Owner

Let's close this as the protocol looks the same as with v1 and #143 for discovery is also merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants