iRobot 9xx on openHAB

I am trying to get the Rest980 working, but when I try to start as described in the readme, I get an error, that port 3000 is already in use.

What can I do, to get the rest980 working, so that I can use it with openHAB?

Hi Jay,

may I ask for your START & STOP rule(s)? I got my setup finally fixed - stupid typo in the channel setup - and working, curious to setup rules for home automation.

Thanks, Thomas

Here is Home, Start and Stop.

Virtual Switches:

Switch	MainFloor_Roomba_Home_Switch	"Main Roomba Home [MAP(On_Off.map):%s]"								(Roomba)		[ "Switchable" ]
Switch	MainFloor_Roomba_Switch			"Main Roomba On/Off [MAP(On_Off.map):%s]"							(Roomba)		[ "Switchable" ]

Rules:

rule "Roomba MainFloor_Roomba_Home_Switch changed to ON"
	when
		Item MainFloor_Roomba_Home_Switch changed to ON
	then

		var mqttThing = getThingStatusInfo("mqtt:broker:roomba").getStatus()

		if (systemStarted.state != ON && mqttThing.toString() == 'ONLINE') {

			// val RuleRoombaActions = getActions("mqtt","mqtt:broker:roomba")
			RuleRoombaActions.publishMQTT("cmd", GetCommandJSON.apply("dock"))
			logInfo("Roomba", "MainFloor_Roomba_Home_Switch.state is " + MainFloor_Roomba_Home_Switch.state)
			logInfo("Roomba", "Requested Roomba to go HOME")
	
			MainFloor_Roomba_Switch.postUpdate(ON)

		} else if (systemStarted.state != ON && mqttThing.toString() != 'ONLINE') {

			logInfo("Roomba", "mqttThing is " + mqttThing)
			logInfo("Roomba", "MainFloor_Roomba_Home_Switch did NOT execute due to mqttThing being OFFLINE.")
			MainFloor_Roomba_Home_Switch.postUpdate(OFF)
		}
end


rule "Roomba MainFloor_Roomba_Switch changed to ON"
	when
		Item MainFloor_Roomba_Switch changed to ON
	then

		var mqttThing = getThingStatusInfo("mqtt:broker:roomba").getStatus()

		if (systemStarted.state != ON && mqttThing.toString() == 'ONLINE') {

			// val RuleRoombaActions = getActions("mqtt","mqtt:broker:roomba")
			RuleRoombaActions.publishMQTT("cmd", GetCommandJSON.apply("start"))
			logInfo("Roomba", "MainFloor_Roomba_Switch.state is " + MainFloor_Roomba_Switch.state)
			logInfo("Roomba", "Requested Roomba to START")

		} else if (systemStarted.state != ON && mqttThing.toString() != 'ONLINE') {

			logInfo("Roomba", "mqttThing is " + mqttThing)
			logInfo("Roomba", "MainFloor_Roomba_Switch did NOT execute due to mqttThing being OFFLINE.")
			MainFloor_Roomba_Switch.postUpdate(OFF)
		}
end


rule "Roomba MainFloor_Roomba_Switch changed to OFF"
	when
		Item MainFloor_Roomba_Switch changed to OFF
	then

		var mqttThing = getThingStatusInfo("mqtt:broker:roomba").getStatus()

		if (systemStarted.state != ON && mqttThing.toString() == 'ONLINE') {

			// val RuleRoombaActions = getActions("mqtt","mqtt:broker:roomba")
			RuleRoombaActions.publishMQTT("cmd", GetCommandJSON.apply("stop"))
			logInfo("Roomba", "MainFloor_Roomba_Switch.state is " + MainFloor_Roomba_Switch.state)
			logInfo("Roomba", "Requested Roomba to STOP")

			MainFloor_Roomba_Home_Switch.postUpdate(OFF)

		} else if (systemStarted.state != ON && mqttThing.toString() != 'ONLINE') {

			logInfo("Roomba", "mqttThing is " + mqttThing)
			logInfo("Roomba", "MainFloor_Roomba_Switch did NOT execute due to mqttThing being OFFLINE.")
			MainFloor_Roomba_Home_Switch.postUpdate(OFF)
		}
end

I’m still waiting for more Roomba examples myself from @ falkena.

Best, Jay

Hello,

interesting codes indeed. I tried Dorita980 and Rest980 and I had quite some fun with it. However, I was wondering: did someone succeed in accessing the camera and sensors data? Do you think it will ever be possible to command Roomba movements from Python?

1 Like

After some updates, seems that I can’t get my roomba back online.
When I check online, seems it has something to do with python3 and SSL?

Any suggestions what I can do?

./getpassword.py -R 192.168.111.26
waiting on port: 5678 for data
found 1 Roomba(s)
Make sure your robot (Anastacia) at IP 192.168.111.26 is on the Home Base and powered on (green lights on). Then press and hold the HOME button on your robot until it plays a series of tones (about 2 seconds). Release the button and your robot will flash WIFI light.
Press Enter to continue…
Received: {
“robotname”: “Anastacia”,
“sku”: “R960040”,
“nc”: 0,
“ver”: “3”,
“proto”: “mqtt”,
“ip”: “192.168.111.26”,
“hostname”: “Roomba-3164421080308590”,
“sw”: “v2.4.9-96”,
“mac”: “80:C5:F2:DF:69:CC”,
“cap”: {
“pp”: 1,
“multiPass”: 2,
“binFullDetect”: 1,
“ota”: 2,
“maps”: 1,
“pose”: 1,
“eco”: 1,
“langOta”: 1,
“edge”: 1,
“svcConf”: 1
}
}
Roomba (Anastacia) IP address is: 192.168.111.26
Connection Error TLS/SSL connection has been closed (EOF) (_ssl.c:727)
Traceback (most recent call last):
File “./getpassword.py”, line 39, in
main()
File “./getpassword.py”, line 36, in main
Password(arg.roombaIP,file=arg.configfile)
File “/etc/openhab2/scripts/roomba/password.py”, line 39, in init
self.get_password()
File “/etc/openhab2/scripts/roomba/password.py”, line 136, in get_password
wrappedSocket.send(packet)
File “/usr/lib/python2.7/ssl.py”, line 707, in send
v = self._sslobj.write(data)
ssl.SSLZeroReturnError: TLS/SSL connection has been closed (EOF) (_ssl.c:1829)

Hey guys,
My usb died and now I’m trying to set up my system again. I have latest 2.5 release and I’m trying to set up roomba trough MQTT (2). Brooker works fine, I’m receiving wifi status messages and also some state of robot. But I’m not able to start any command. I receiving this message in console:
[WARN ] [nhab.binding.mqtt.action.MQTTActions] - MQTT publish to cmd failed!

Things:

Bridge mqtt:broker:roomba “Roomba” [ clientID=“XXX”, host=“10.1.0.9”, port=8883, secure=true, username=“XXX”, password=“XXX”, certificatepin=true, publickeypin=true ]
{
Thing topic state “Roomba state” {
Channels:
Type string : wifistat “WiFi” [ stateTopic=“wifistat” ]
Type string : shadow “Status” [ stateTopic=“$aws/things/CLIENTID/shadow/#”]
}
}

Items:

String Roomba_command “Roomba command” (gRoomba)
String Roomba_Wifi “Roomba Wifi [%d dB]” (gRoomba)
String Roomba_Battery “Roomba Battery [%d %%]” (gRoomba)

Rules:


val RuleRoombaActions = getActions(“mqtt”,“mqtt:broker:roomba”)
val GetCommandJSON = [ String command | String::format(“{“command”:”%s",“time”:%d,“initiator”:“localApp”}“, command, now.millis / 1000) ]
val GetSettingJSON = [ String command | String::format(”{“state”:“%s”}") ]

rule “Roomba command”
when
Item Roomba_command received command
then
if (Roomba_command.state == “start”){
RuleRoombaActions.publishMQTT(“cmd”, GetCommandJSON.apply(“start”))
}else if(Roomba_command.state == “stop”){
RuleRoombaActions.publishMQTT(“cmd”, GetCommandJSON.apply(“stop”))
}

Can somebody please help me?
Thanks

I seem to be running into the same issue as Yogi is running into. I’ve setup the Roomba with MQTT & Mosquitto on a RPI Zero and I can easily read any MQTT message that comes around. I have the battery and the bin registering and working through BasicUI. That said, I can’t send any command to the Roomba. I get the following in my logs:

2020-01-11 23:17:19.533 [INFO ] [clipse.smarthome.model.script.ROOMBA] - {"command":"cmd","time":1578813439,"initiator":"localApp"}
2020-01-11 23:17:19.713 [WARN ] [nhab.binding.mqtt.action.MQTTActions] - MQTT publish to cmd failed!
2020-01-11 23:17:29.693 [INFO ] [.reconnect.PeriodicReconnectStrategy] - Try to restore connection to '192.168.1.142'. Next attempt in 60000ms
2020-01-11 23:17:29.907 [INFO ] [.transport.mqtt.MqttBrokerConnection] - Starting MQTT broker connection to '192.168.1.142' with clientid 3176C01070504730

I’m not sure why it tries to reconnect right after the failure, but it does that consistently. My setup is pretty much a copy/paste of everyone’s setup here. I’ve created a single update rule just to make it work

rule "RoombaStateUpdated"
when
        Item RoombaState received update
then
        val RoombaActions = getActions("mqtt", "mqtt:broker:roomba")

        // Commands: "start", "stop", "pause", "resume", "dock"
        val GetCommandJSON = [ String command |
          String::format("{\"command\":\"%s\",\"time\":%d,\"initiator\":\"localApp\"}", command, now.millis / 1000)
        ]

        logInfo("ROOMBA", GetCommandJSON.apply("cmd"))

        switch(RoombaState.state) {
                case 0: RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("start"))
                case 1: RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("stop"))
                case 2: RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("pause"))
                case 3: RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("resume"))
                case 4: RoombaActions.publishMQTT("cmd", GetCommandJSON.apply("dock"))
        }
end

I’d appreciate any direct help or hints about how I could go about debugging this issue.
Thanks

I used the dorita980 script to check that I can connect to my roomba and it works fine.
However when I try to use mqtt-spy, I simply cannot get it to connect to the roomba.
Has anyone managed to use mqtt-spy to connect to their roomba and can provide the connection properties?
I think, I’m, missing something in the “Security” tab.
I set the “TLS/SSL mode” to “Certificates & keys provided externally” and tried every possible protocol.
However I’m always getting “unable to find valid certificate path to requested target”.

Hi everyone! Would like to notify about my project: https://github.com/Sonic-Amiga/openhab2.roomba
I am unhappy with a need for a dedicated MQTT broker, especially considering that Roomba already contains a built-in one.
Currently the code doesn’t handle any commands yet, but it successfully discovers and connects to the robot. And it is able to automatically retrieve a password, no need for external scripts.

3 Likes

@wertzui Hi! Just read your message. Yes, Roomba uses a custom CA. It depends on your app whether you can connect or not. It should provide for unverified connections, or you’ll have to retrieve the CA cert from the Roomba or its app.
My binding is currently using the former option. See the code.
And be also aware about blid and password. blid is used as both client id and username.

Same problem here with iRobot Roomba 980 and OH2.5.

Command via publishMQTT() results in “MQTT publish to cmd failed!” and sendCommand() works without error but the Roomba is ignoring it.

Hello, I got Dorita980 and Rest980 working in a OH 2.5.4 Test with Openhabian and an Roomba 671 with firmware 3.3.47-77
I cant get Roomba980-Python working, to many errors so i will do with the rest980 i got working, but for that i now have to keep a putty session open to the pi that runs the rest980.
I found this link to make it run as a deamon? (I’m not a Linux man) in windows we would say as “a service” has anyone got this working on openhabian? https://community.smartthings.com/t/roomba-980-wifi-connectivity-reverse-engineering/44860/172

I am also not too much of a Linux man, but here is what I figured out.

Create a file with any name, e.g. rest980_start. Put this code in the file

#!/bin/bash

cd /srv/rest980

/usr/bin/nohup /usr/bin/node ./bin/www &

exit 0

Make sure you replace /srv/rest980 with the directory you installed rest980 in.

execute chmod +x yourfilename

Execute the file: ./yourfilename

Now the webserver is started and you can exit the session.

If someone knows how to execute this at every system start, I like to learn

1 Like

Any news about this?
See that the last commit was 8 March.

Hi! I am here. Didn’t have much time since that because i’ve got some more work for Devi binding. And now i’m too much exhausted due to corona lockdown. I work from home, and get completely exhausted of sitting in front of my computer in the evening. So on hold, sorry. :frowning:

2 Likes

I completly understand.

port 3000 is often used by Grafana
Try change port to 3001, in default.json

Pavel,
I tried to install your Roomba binding on openhab2, but I cannot find a .jar file on your github project, only a directory containing the code. Can you please provide me with a org.openhab.binding.vacuum.jar file?

Thanks in advance
Werner

Hi! There’s no .jar file released because the binding is not complete and does not actually do anything yet. It is able to discover the Roomba and establish communication, but does not send any commands.
Sorry, i’m too busy, i have a lot of things to do for my own home, and Roomba is currently not a priority.

1 Like

Hey guys,
I have problem with connection to my roomba. Don’t know why, but I’m not able to establish connection with broker.
My thing file:

Bridge mqtt:broker:roomba “Roomba” [ clientID=“XXX”, host=“10.1.0.9”, port=8883, secure=true, username=“XXX”, password=“XXX”, certificatepin=true, publickeypin=true ]
{
Thing topic state “Roomba state” {
Channels:
Type string : wifistat “WiFi” [ stateTopic=“wifistat” ]
Type string : shadow “Status” [ stateTopic=“$aws/things/CLIENTID/shadow/#”]
}
}

And log:

2020-05-24 23:05:25.936 [hingStatusInfoChangedEvent] - ‘mqtt:broker:roomba’ changed from OFFLINE to OFFLINE (COMMUNICATION_ERROR): io.netty.channel.ConnectTimeoutException: connection timed out: /10.1.0.9:8883

Connection to another broker which is on same rpi works fine, but this one not.
Any idea?
Thanks