Samsung Smart Home Vacuum Cleaner Robot


I am not able to find any information on how to get my Samsung Robot Vacuum Cleaner (VR20J9040WG/EE) into OpenHAB … the Robot Vacuum Cleaner uses the Samsung Smart Home and is a part of the Samsung Smartthings series, connected through WiFi … I would like it enrolled to OpenHAB so that I Can bridge it to Apple HomeKit, see status, start cleaning etc.

Can someone help me in the right Direction ( I am Total new to OpenHAB) :blush:

Best Regards
Stig :slight_smile:

Do you have a Samsung Smart Things Hub?

No, Only the Vacuum robot :blush:

Does someone have a solution for this? :slight_smile:

When a command is sent to the Vacuum, via the app, can you capture the message with something like wireshark? Is the message encrypted? If not encrypted try getting all the commands then use OH to send the info. Is there an API for this vacuum?

I will try capture it through wireshark and see if it is encrypted or not :wink: … There seems to be an API but as far as I can tell it is a closed API that is only available through signup as partner developer :

If it’s free, look into signing up as a developer and see what you can gain.

1 Like

Unfortunately the data being send is encrypted (See screenshot)

The signup is an Samsung approved process that depends on application approval, and I aint a developer ;-(

1 Like

Hmm … I get an idea … The Samsung Smart Home App and the Vacuum Cleaner does have capabilities to being controlled using IFTTT … Would it somehow be possible to take advantage of that in OpenHap? … remember I am total Novice in the OpenHAB :smiley:

1 Like

I don’t use IFTTT so cant help much on that end. Good thing is, OH does work with IFTTT here;s the doc’s. Looks easy enough to setup.:crossed_fingers:

1 Like

Perfect, thank you so much! … I will give it a try :slight_smile:

1 Like

Thanks so much for information. My friend writes reviews about appliances for a smart home, I hope it will be interesting to someone.

Samsung’s new range of Wi-Fi robot vacuum cleaners is expected to launch in Europe in July 2019. The connected robot vacuum cleaner includes new mapping capabilities to help it analyze and chart its surroundings when entering a new environment. These capabilities enable the vacuum to create a floorplan of an entire home. Specific rooms or areas can be selected for the robot to clean. This can be done at home or remotely via Wi-Fi connectivity. The vacuum automatically returns to its charging station once the job is finished.

I have the Samsung POWERbot R7070, and I was able to integrate it with my openHAB install by connecting the vacuum to WiFi and accessing it through the Samsung SmartThings cloud API. In openHAB, I am able to obviously start/stop vacuuming, as well as see the battery percentage and set the suction mode (turbo, normal, or quiet).

I can post detailed steps if anyone is interested.

Very interested! Am curious though, do you have the ability to see the map that the bot creates of “cleaned areas”. This is something that interests me in getting integrated into my openHab!

Thanks in advance, for your help

I do not believe the API gives you access to the “cleaned areas.” I have only been able to find this in the SmartThings app. Samsung has a site that lists the Capabilities for all of their devices, including the POWERbot R7070, so you could double-check there in case I missed something.

You’ll need a SmartThings API Personal Token.

Basically, what I ended up doing is first creating a script that POSTs to the SmartThings API whenever a command changes. From what I can remember, the HTTP binding in openHAB do not let you set HTTP headers with a POST request (which I needed to pass the authorization token), and the HTTP util functions don’t allow it either, so I had to write this script for it:

import org.eclipse.xtext.xbase.lib.Functions
import java.nio.charset.StandardCharsets

// Function called to send command to Samsung SmartThings API. This was required
// because the HTTP binding does not allow us to POST with headers.
// Inspiration:
val Functions$Function3<String, String, String, String> sendVacuumCommand= [ capability, command, argument |
    val String filename = "robotvacuum.rules"
    var String jsonResponse = null

    logInfo(filename, "Sending command to Samsung Robot Vacuum.")

    try {

	var commandUrl = new URL("[device ID here]/commands");
	var HttpsURLConnection connection = commandUrl.openConnection() as HttpsURLConnection
	var request = '{"commands": [{"capability": "%1$s", "command": "%2$s", "arguments": ["%3$s"] }]}'.format(capability, command, argument)
	var byte[] postData = request.getBytes(StandardCharsets.UTF_8)

	connection.requestMethod = "POST"
    connection.setRequestProperty("Accept", "*/*")
    connection.setRequestProperty("Authorization", "Bearer [API key here]")
	connection.setRequestProperty("Content-Type", "application/json; charset=utf-8")

	connection.doOutput = true
	connection.setDoInput = true

	var responseCode = connection.responseCode

	logInfo(filename, "Got HTTP response code:" + responseCode)
	logInfo(filename, "Got message: " + connection.responseMessage)

	var StringBuffer sb = new StringBuffer()
	var inputStream = new BufferedInputStream(connection.getInputStream())
	var BufferedReader br = new BufferedReader(new InputStreamReader(inputStream))
	var String inputLine = ""

	while ((inputLine = br.readLine()) !== null) {

	jsonResponse = sb.toString()

	} catch (Exception e) {
		logError(filename, "Error sending command to Samsung Robot Vacuum: " + e.toString)
	return jsonResponse

So far, I am using this script to send 3 commands:

sendVacuumCommand.apply("robotCleanerMovement", "setRobotCleanerMovement", [oneof: "cleaning", "homing", "charging"])
sendVacuumCommand.apply("robotCleanerCleaningMode", "setRobotCleanerCleaningMode", [oneof: "auto", "repeat", "stop"])
sendVacuumCommand.apply("robotCleanerTurboMode", "setRobotCleanerTurboMode", [oneof: "on", "off", "silence"])

To activate the vacuum, I use

// Order matters here, at least it did for my experimentation.
sendVacuumCommand.apply("robotCleanerCleaningMode", "setRobotCleanerCleaningMode", "auto")
sendVacuumCommand.apply("robotCleanerMovement", "setRobotCleanerMovement", "cleaning")

To deactivate it, I use,

sendVacuumCommand.apply("robotCleanerMovement", "setRobotCleanerMovement", "homing")

And finally, to retrieve the status of the vacuum, I can actually use the HTTP binding since GET requests allow headers. Define the item:

String RobotVacuumStatusJson " Robot Vacuum Status" { http="<[[device ID here]/status{Authorization=Bearer [API key here]&Content-Type=application/json; charset=utf-8}:60000:REGEX((.*))]" }

This JSON needs to be parsed out to get the status of each individual capability. Whenever that JSON gets updated, I run the following in a rule:

RobotVacuumBatteryLevel.postUpdate(transform("JSONPATH", "components.main.battery[*].value", RobotVacuumStatusJson.state.toString))
RobotVacuumCleanerMovement.postUpdate(transform("JSONPATH", "components.main.robotCleanerMovement[*].value", RobotVacuumStatusJson.state.toString))
RobotVacuumCleaningMode.postUpdate(transform("JSONPATH", "components.main.robotCleanerCleaningMode[*].value", RobotVacuumStatusJson.state.toString))
RobotVacuumCleanerSuctionMode.postUpdate(transform("JSONPATH", "components.main.robotCleanerTurboMode[*].value", RobotVacuumStatusJson.state.toString))

Hope you can get this working :slight_smile: If you do manage to get a map or extend/improve this implementation, please let me know! I would be very interested.

1 Like

Thank you. I rooted my phone and can no longer access the smart things app so I will probably end up doing what you’ve done here at some point.