Control robot vacuum cleaner from Openhab

control vacuum cleaner by tcp from openhab
Robzone, Proscenic or any other vacuums controlled by tcp request.

– sniff packets on android
– create script
– add into Openhab
– Control your vacuum from your home automation

I used this instruction for my Robzone duoro Xcontrol / It is copy of Proscenic 790T.
Connect through original android app for your vacuum (RobZone in my case)
Start sniffing app tPacketCapture this will capture all requests coming out of your android phone.
Start capturing by clicking on capture.


Then switch to your original android app and click buttons you want to learn. I pushed power on/start, pause and go home/off.
Go back to the sniffing app and click “Running”. Follow the steps to disconnect VPN made by tPacketCapture app.
Go back to tPacketCapture app click File List tab -> click on the last capture file created and click share button. Choose how to send it to your computer. (i used Google Drive but you can use mail or anything else)

Now download it to on your computer to analyze by wireshark or other similar application to read pcap file.

Open the file in wireshark. Find message which was sent to your vacuum IP. (10.20.1.229 in my case). If you find the right line you can also see message being sent. There are usually more connection lines before the message being send, it is not important in this step to find the one with message.


Now either right click on the line->Follow->TCP Stream or ctrl+alt+shift+T
You will see following. choose only the communication coming to the vacuum and “show and save data as Raw”

In here i can see that the messages are the ones starting with “bd” (this is HEX code and will be different in your case, message includes authorization code, IP and other specific attributes)
lines staring with “14” are only some keep alive traffic.
Now you can save this 3 lines with the code to text file for later use.
the messages appear in order you pushed the buttons. So for me these are ON, PAUSE, HOME.

Now the part on Openhhab server. I am running Openhabian on raspberry PI . If you are running on windows you will have to slightly modify this steps.
I created script /etc/openhab2/robzone/robzone.sh (path and name is up to you). Dont forget to give it executable permissions

chmod +x /etc/openhab2/robzone/robzone.sh

And here is the script content, change the bd000… to your own HEX codes and IP and port of your vacuum cleaner (you can see the port in the wireshark, in my case 8888):

#/bin/bash
case "$1" in
  -r|--start)
    echo -n bd000000fa00c8000000a927a8270000000000007b22636d64223a302c22636f6e74726f6c223a7b2261757468436f6465223a223633333631222c226465766963654970223a2231302e32302e312e323239222c22646576696365506f7274223a2238383838222c227461726765744964223a2238383863373639316337636437303933222c2274617267657454797065223a2233227d2c22736571223a302c2276616c7565223a7b227472616e736974436d64223a22313030227d7d| perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | nc -4 -q1 10.20.1.229 8888
    ;;
  -s|--stop)
    echo -n bd000000fa00c8000000a927a8270000000000007b22636d64223a302c22636f6e74726f6c223a7b2261757468436f6465223a223633333631222c226465766963654970223a2231302e32302e312e323239222c22646576696365506f7274223a2238383838222c227461726765744964223a2238383863373639316337636437303933222c2274617267657454797065223a2233227d2c22736571223a302c2276616c7565223a7b227472616e736974436d64223a22313032227d7d| perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | nc -4 -q1 10.20.1.229 8888
    ;;
  -h|--home)
    echo -n bd000000fa00c8000000a927a8270000000000007b22636d64223a302c22636f6e74726f6c223a7b2261757468436f6465223a223633333631222c226465766963654970223a2231302e32302e312e323239222c22646576696365506f7274223a2238383838222c227461726765744964223a2238383863373639316337636437303933222c2274617267657454797065223a2233227d2c22736571223a302c2276616c7565223a7b227472616e736974436d64223a22313034227d7d| perl -pe 's/([0-9a-f]{2})/chr hex $1/gie' | nc -4 -q1 10.20.1.229 8888
    ;;
  *)
    echo "parameters are -start -stop -home"
    exit 1
    ;;
esac

I use exec1 binding. I still did not get well in touch with exec 2 binding.
Items (../items/default.items)

String Robzone	"Robot vacuum" [ "Switchable" ] { exec=">[ON:/bin/sh@@-c@@cd /etc/openhab2/robzone/;sh robzone.sh -r] >[PAUSE:/bin/sh@@-c@@cd /etc/openhab2/robzone/;sh robzone.sh -s] >[OFF:/bin/sh@@-c@@cd /etc/openhab2/robzone/;sh robzone.sh -h]" }

Sitemap (../items/default.items)

Switch item=Robzone label="Vacuum[]" icon="woman_3" mappings=[ON="Start", PAUSE="Pause", OFF="Go Home"]

Optional creating item to be controlled by Google home.
Items (../items/default.items)

Switch Robzone_voice "Robot vacuum" [ "Switchable" ]

rules for voice control (../rules/vacuum.rules)

rule "rVacuum_voice"
when
	Item Robzone_voice received command
then 
	switch (receivedCommand) {
		case ON : 
			Robzone.sendCommand("ON")
  		case OFF :
			Robzone.sendCommand("OFF")
	}
end

  1. hi there, i tried to run my proscenix via “run.sh -r” but it nothing happened. heres an example of my wireshark output

  2. i think i found the problem. the application is sending the request to a server out of my network. so i need to find a way making my app talk directly to the vacuum cleaner…can you tell me which fw version and app version u have?

  3. Hello Tobias,
    i have the Robzone duoro Xcontrol with latest firmware 1.9.911
    In my case the request also goes outside of the network (as it is “cloud” application)
    but then next request goes to the vacuum itself and that is the one you want to find.
    There is option it might go to cloud server and then sending it dirrectly to your vacuum but that would mean that the vacuum is directly connectable from internet ,i dont believe it is the case but you can also sniff the packets from your router if you believe it is the case (i will not make tutorial for that, you can try google).

Leave a Reply

Your email address will not be published. Required fields are marked *