Smartthings Roomba Control via RooWifi (DEAD)

1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0

3 Likes

your hubaction has the wrong thing in the HOST: section. Remove the ${rooUser}:${rooPass}@ and move it to the headers section, assuming it uses BASIC auth.

Check my generic camera device example for more details:

https://github.com/pstuart/smartthings/blob/master/generic_camera.groovy

Oh trust me i’ve looked @ your code thoroughly.
You mean like this, i gave it a shot in a previous troubleshooting step w/ no love ?

def hubAction = new physicalgraph.device.HubAction(
  	method: "GET",
    path: "/roomba.cgi?button=${command}",
    headers: [HOST:"$rooIp:$rooPort",Authorization:"${rooUser}:${rooPass}"]
    )

Think you are missing a section.

def userpassascii = "${CameraUser}:${CameraPassword}"
def userpass = "Basic " + userpassascii.encodeAsBase64().toString()

def headers = [:]
headers.put(“HOST”, “$ip:$Port”)   
headers.put(“Authorization”, userpass)    }

So you would need to change your code to then be

headers: headers

I’ll explain each step…
First we need to build the username and password in this form “user:password”

then we need to encode that to base64 and prepend the word "Basic " in front of that base64 string

Then we need to insert this into the headers map along with the host.

Then call it…

Hopefully that makes sense.

Always log.debug hubaction so you can see how the request is being formed. Compare it to a web browser request, using the developer tools (F12 on most modern browsers).

1 Like

Cool, got it working… looks like too much info is a bad thing. It’s not normally with HTTP. Now to get Clean, Spot and dock coded up and then pull battery info and find some way to pull the status the device. The roowifi api leaves a lot to be desired. :smile:

@sidjohn1, will you be posting this code on GitHub at all (I first need to get a Roomba, though ;-)).

As soon as i get it done, absolutely. I feel everyone who has smartthings, a roomba and roowifi should be able to automate cleaning. I almost had it done but i ran into some snags… :frowning:

1 Like

Below is a copy of the log.debug hubAction

fddcf318-ff0c-41a4-9ee4-447740f29d8a 1:09:34 PM CDT: debug [GET /roomba.cgi?button=CLEAN HTTP/1.1 
Accept: */* 
User-Agent: Linux UPnP/1.0 SmartThings 
HOST: 192.168.192.41:80 

, delay 1000, GET /rwr.xml HTTP/1.1 
Accept: */* 
User-Agent: Linux UPnP/1.0 SmartThings 
HOST: 192.168.192.41:80 

]
fddcf318-ff0c-41a4-9ee4-447740f29d8a 1:09:34 PM CDT: debug GET /rwr.xml HTTP/1.1 
Accept: */* 
User-Agent: Linux UPnP/1.0 SmartThings 
HOST: 192.168.192.41:80 

In this block in the control() method, do you need to do a sendHubCommand(hubAction)? Now it looks like you are building up the hubAction but only logging it.

adding sendHubCommand(hubAction) generated the following error:

Hit Exception groovy.lang.MissingMethodException: No signature of method: script14083924520701652945287.sendHubCommand() is applicable for argument types: (physicalgraph.device.HubAction)

My apologies, I was confusing the device type and the smart app code. So back to this code in the control() method:

try {
   def hubAction = [new physicalgraph.device.HubAction(
   method: "GET",
   path: "/roomba.cgi?button=${command}",
      headers: [HOST: "${rooIp}:${rooPort}"]
      ), delayAction(1000), refresh()]
   hubAction
   log.debug hubAction
}

That method needs to just return the hubAction. Since you have the log.debug message as the last line in the file, nothing is being returned. So it looks like you could just move the log.debug line before the hubAction. This will make the method return the hubAction since that is the last thing in that method. You could also explicitly change it to “return hubAction” to be clear.

The sendHubCommand(hubAction) is needed if you are using HubActions from within a SmartApp.

I’ve done that as well and it still doesn’t work. I can point it to another web server and it does work as i would expect it to. There is something in how the hub communicates with the roowifi that is not happy anymore, as the code did work at one time. Is there a way to verify the hub can ping the device or connect to a port? i know the roowifi does not always respond very quickly. Is there a way to extend the timeout that the hub is expecting a response?

Was any progress made after the last update? Can you please publish the code if you are able to turn Roomba on using smartthings?

No, i put this on hold. I should have some time next month to work on this again and i should also have a thinking cleaner device aswell to test out and get to work. One way or another i will get roombas and smartthings playing together. :smile:

That’s awesome. Keep us updated.

Sid,
I got this working on another device. Enjoy.

Awesome. How did you manage to get the Thinking Cleaner face plate?

i ordered it before they went kickstarter

Unfortunately it failed to fund. Any chance you got the RoWifi to work?

The RoWifi site actually links to this page saying there is a Functional ST plugin…

i’m not sure which roomba you have… but the thinking cleaner for 500/600 series roomba is for sale on the http://www.thinkingcleaner.com webshop. Yes i know Roowifi says there is a functional plug in. It links to my code that does not work. I asked them to remove the link and they have not.

I’m not sure if i will ever be able to get the roowifi to work with smartthings… consistantly. The wifi on the roowifi is a bit wonky and no where near as stable as thinking cleaner. Right now work and play have me pretty busy until work lets up i won’t have the time to work on the integration. Until that changes roowifi is on the back burner for me.