--------------------------------------------------------------------------
--------------------------------------------------------------------------
Please refere to "Ermittlung_TOKEN_DE.pdf" to see, how you can check which token-id your robot useQuick & dirty description:
- reset WLAN from you robot
- robot establish a new AdHoc network "rockrobo....."
- remove robot device in your App on your smartphone
- Alternative 1:
- install python script
- python xiaomi_robot.py -info
- robot answer with a status and the current token (16 Bytes)
- save YOUR token
- if this way didn't work for you go to alternative 2
- Alternative 2:
- open PacketSender
- insert in field Hex: 21 31 00 20 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
- insert a name
- save
- send
- Robot should answer immediately with a status and his token
- Robot answer with : 21 31 00 20 00 00 00 00 03 4C 94 1D 58 FE 4B F2 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF
but the FF FF... is exchanged with YOUR Token (16 Bytes) - copy this 16 bytes and save them - you need it later
- using the python script
- Install python script (works only with Python 2.7)
- maybe you have to install python cryptography library with pip install cryptography
- check if pip install libs for python 2.7 and not for 3.5 (=> pip -V)
- test if script run without error messages. If you get error messages normally a lib is missing
- python xiaomi_robot.py -h
- you should see a help screen - if yes you won :-)
- Start: python xiaomi_robot.py -ip "ip from your robot" -cmd "start" -token "your token"
- Pause: python xiaomi_robot.py -ip "ip from your robot" -cmd "pause" -token "your token"
- Home: python xiaomi_robot.py -ip "ip from your robot" -cmd "home" -token "your token"
- Good luck and have fun
LunaX 25-MAR-17
Python script to use this robot
--------------------------------------------------------------------------
--------------------------------------------------------------------------
- all commands must be sniffed via Wireshark for you own environment
- if you work with wireshark use this filter to find you own commands
- (data.len == 80 || data.len == 64 || data.len == 96 || data.len == 144) && (ip.proto == 17)
Using this tool:
it is possible to send several commands in a sequence to the bot
examples:
./xiaomi_vaccum_cleaner_script.py --cmd find start standard
First send FIND-command, than start robot cleaning and set hoover to standard
./xiaomi_vaccum_cleaner_script.py -vv --cmd find start standard
same as above but with verbose-verbose output
./xiaomi_vaccum_cleaner_script.py -vv -w 10 --cmd find start standard
same as above but wait 10secs between every command
./xiaomi_vaccum_cleaner_script.py -i 192.189.8.100 -vv --cmd find start standard
same as above but use new IP-Addrress as in script
-------------------------------------------------------------------------------
usage: xiaomi_vaccum_cleaner_script.py [-h] [-i] [-p] [-w WAIT] -c
[{stop,start,home,silent,standard,power,find} [{stop,start,home,silent,standard,power,find} ...]]
[-v]
XIAOMI vaccum cleaner
optional arguments:
-h, --help show this help message and exit
-i, --ip UDP destination ip
-p, --port UDP destination port
-w WAIT, --wait WAIT wait in seconds between two commands
-c [{stop,start,home,silent,standard,power,find} [{stop,start,home,silent,standard,power,find} ...]], --cmd [{stop,start,home,silent,standard,power,find} [{stop,start,home,silent,standard,power,find} ...]]
-v, --verbose verbose output
-------------------------------------------------------------------------------
############################################################################
############################################################################
Preconditions:
- download and install "WireShark" on your pc
- download and install "PaketSender" on your pc
- install an ANDROID emulator on your pc (MAC OS => BlueStack)
- install XIAOMI MI application
- configure the application
- test application if robot works - IMPORTANT !!!!!
- Start Wireshark
- setup network card to sniff (e.g. WiFI)
- insert into filter text field this filter criteria
- (data.len == 80 || data.len == 64 || data.len == 96 || data.len == 144) && (ip.proto == 17)
- Start sniffing (icon upper left blue shark fin)
- go to android app and go to main screen (MAP is shown) - do nothing
- you should see packets in Wireshark
- click middle button (CLEAN) 1x time - wait until robot moves
- click middle button again (STOP) - robot should stop
- go to wireshark and stop recording (red square)
- now you should see all packetes from app to robot and answer from robot
- Short introduction into UDP Packets
PING/CARD command: Host send every second 80Bytes, Robot return 256 Bytes
(this packets can be ignored)
Normal commands: host sends 80Bytes, robot answer: 64Bytes
(start,stop,find,home)
Power commands: Host: 96 Bytes, Robot: 64Bytes
(silent, standard, power)
Joystick commands: Host: 144 Bytes, Robot: 64Bytes
(not implemented yet)
- to find YOUR START-Command, find a 80/64 Byte sequence.
- Wireshark combine both (send & receive with a bracket (left side)).
- copy only DATA-Packet (80 Bytes)
- these packets start every time with HEX: 213100xx
- xx = Number of Bytes, for 80Bytes = 50, 96Bytes = 60, ...
- start PaketSender
- insert 80Byte packet in HEX-Field
- click SAVE-Button
- click SEND-Button
- IMPORTANT:
- in below log table you must see
- first: your SEND udp package
- second: a 64 Byte response from both
- If you do not see this response than the bot didn't recognize the command
Use RESET-Command - sometimes this avoid the "not responding"
21310020ffffffffffffffffffffffffffffffffffffffffffffffffffffffff
Good luck and enjoy your XIAOMI Robot
March 2017, LunaX