iRobot 9xx on openHAB

Oh, you missunderstood. You need a mqtt broker to which the python script can connect. not the otherway around. The python script will publish its messages to a mqtt broker and openhab subscribes with the items to the messages. so

roomba —> script ----> mqttbroker <----- openhab <------ item

so, I would need to install an mqttbroker? The script says that it installs the paho.mqtt broker. Did I miss something?

yeah the script does only installs the broker to connect to roomba, but not a gerneral purpose one

I see.

I just installed an MQTT and used mqtt-spy to verify that I can connect to it, and that works.

Now, I just need to connect the Roomba script to the mqtt?

Yes, there should be something in the configuration file or you pass the broker and credentials directly to the script. second step is the to install the mqtt binding in openhab and configure it to connect to the broker

I am sorry if I am a pain…

I get this now in my logs:

2018-04-02 12:55:17.210 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-04-02 12:55:17.538 [INFO ] [g.discovery.internal.PersistentInbox] - Added new thing ‘chromecast:chromecast:f0af7898c15316a7bd19ae37fa1653a5’ to inbox.
2018-04-02 12:55:19.280 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-02 12:55:19.301 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-02 12:55:19.313 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-02 12:55:19.642 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-04-02 12:55:19.643 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mqtt’
2018-04-02 12:55:20.103 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘’
2018-04-02 12:55:20.105 [ERROR] [penhab.io.transport.mqtt.MqttService] - Error starting broker connection

I have the following info in the mqtt.cfg:

URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883

mqtt.url=tcp://localhost:1883

Check if the ips are the right ones. maybe you can describe your enviroment a little bit more.

mqtt.cfg should lokk something like:

mqtt.url=tcp://mybrokersip:1883

mqtt.clientId=openhab

mqtt.user=myusername

mqtt.pwd=mypassword

so, I re-installed everything, and now in open hab i get:

2018-04-02 14:28:33.724 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘roomba.items’ has errors, therefore ignoring it: [5,125]: mismatched input ‘false’ expecting RULE_STRING
[7,266]: mismatched input ‘false’ expecting RULE_STRING
[8,274]: mismatched input ‘false’ expecting RULE_STRING
[9,257]: mismatched input ‘false’ expecting RULE_STRING
[10,279]: mismatched input ‘false’ expecting RULE_STRING
[11,255]: mismatched input ‘false’ expecting RULE_STRING
[12,293]: mismatched input ‘false’ expecting RULE_STRING

2018-04-02 14:28:34.536 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-04-02 14:28:35.605 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-04-02 14:28:35.637 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-04-02 14:28:35.699 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-04-02 14:28:35.777 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-04-02 14:28:35.777 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection ‘mqtt’

Ok thats looking not so bad.

1.) you started the python script with broker data

2.) Did you see with mqttspy any mesaages?

3.) just use one roomba items an adapt it to your settings. iwould suggest to use the softwareversion item. the proliant should be the name of you mqtt. it shoudl be mqtt if i see that in the log right

4.) see if the software version is there

5.) add step by step new funktions

OK, I think I am getting closer, but I am still stuck.

So, I now see “messages” being recorded into my mqtt broker (updates every few seconds).
I created a binding in openhab, and I can monitor my connecitons in my mqtt server and it does connect to the server. however, as mentioned, it seems to be complaining about:

2018-04-02 14:28:33.724 [WARN ] [el.core.internal.ModelRepositoryImpl] - Configuration model ‘roomba.items’ has errors, therefore ignoring it: [5,125]: mismatched input ‘false’ expecting RULE_STRING
[7,266]: mismatched input ‘false’ expecting RULE_STRING
[8,274]: mismatched input ‘false’ expecting RULE_STRING
[9,257]: mismatched input ‘false’ expecting RULE_STRING
[10,279]: mismatched input ‘false’ expecting RULE_STRING
[11,255]: mismatched input ‘false’ expecting RULE_STRING
[12,293]: mismatched input ‘false’

I think once I figure out what to configure this, I can get it to work. I just don’t know what to update in the Roomba.items file…

BTW, below is my mqtt.cfg:

Define your MQTT broker connections here for use in the MQTT Binding or MQTT

Persistence bundles. Replace with an ID you choose.

URL to the MQTT broker, e.g. tcp://localhost:1883 or ssl://localhost:8883

proliant.url=tcp://localhost:1883

Optional. Client id (max 23 chars) to use when connecting to the broker.

If not provided a random default is generated.

proliant.clientId=openhab

Optional. True or false. If set to true, allows the use of clientId values

up to 65535 characters long. Defaults to false.

NOTE: clientId values longer than 23 characters may not be supported by all

MQTT servers. Check the server documentation.

#.allowLongerClientIds=false

Optional. User id to authenticate with the broker.

proliant.user=openhab

Optional. Password to authenticate with the broker.

proliant.pwd=openhab

then just comment out all roomba item except one maybe the SW Version could the only one and see if the failure still is there

I think I am almost there… I comment out the “settings” sections, and I am now able to see my “items” in the openhab console… :slight_smile:

the only thing I need to figure out now, is how to create the “main pages” like here:

I finall’y got it to work. Needed to go over the entire Roomba site map and re create some of the items.

Looks like with the latest version of firmware, some items are not valid anymore :slight_smile:

1 Like

HI,

I got everything figured out, but now, when I start my Roomba, the python scripts crashes the moment the iRobot start to move:

[I 2018-04-04 11:56:35,292] Received Roomba Data : wifistat, {“state”:{“reported”:{“wlcfg”:{“sec”:7,“ssid”:“4D6F727068657573”}}}}
[I 2018-04-04 11:56:35,295] Received Roomba Data : wifistat, {“state”:{“reported”:{“mac”:“40:9f:38:33:15:0c”}}}
[I 2018-04-04 11:56:35,296] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“country”: “CA”}}}
[I 2018-04-04 11:56:35,321] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“cloudEnv”: “prod”}}}
[I 2018-04-04 11:56:35,322] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“svcEndpoints”:{“svcDeplId”: “v011”}}}}
[I 2018-04-04 11:56:35,405] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“mapUploadAllowed”:true}}}
[I 2018-04-04 11:56:35,407] Received Roomba Data : wifistat, {“state”:{“reported”:{“signal”:{“rssi”:-36,“snr”:54}}}}
[I 2018-04-04 11:56:35,447] Received Roomba Data : wifistat, {“state”:{“reported”:{“localtimeoffset”:-240,“utctime”:1522857385,“pose”:{“theta”:173,“point”:{“x”:462,“y”:125}}}}}
[I 2018-04-04 11:56:35,496] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“batPct”:54,“dock”:{“known”:true},“bin”:{“present”:true,“full”:false},“audio”:{“active”:false}}}}
[I 2018-04-04 11:56:35,611] Received Roomba Data : $aws/things/3145C52061710780/shadow/update, {“state”:{“reported”:{“cleanMissionStatus”:{“cycle”:“none”,“phase”:“charge”,“expireM”:0,“rechrgM”:27,“error”:0,“notReady”:0,“mssnM”:184,“sqft”:992,“initiator”:“rmtApp”,“nMssn”:12},“language”:0,“noAutoPasses”:true,“noPP”:false,“ecoCharge”:false}}}
[I 2018-04-04 11:56:35,615] updated state to: Charging
[I 2018-04-04 11:56:35,617] MAP: ignoring new co-ords in charge phase
[I 2018-04-04 11:56:35,663] MAP: writing text: pos: (0, 0), text: Charging: Battery: 54%
Exception in thread Thread-1:
Traceback (most recent call last):
File “c:\python27\lib\threading.py”, line 801, in __bootstrap_inner
self.run()
File “c:\python27\lib\threading.py”, line 754, in run
self.__target(*self.__args, **self.__kwargs)
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 2630, in _thread_main
self.loop_forever(retry_first_connection=True)
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 1410, in loop_forever
rc = self.loop(timeout, max_packets)
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 926, in loop
rc = self.loop_read(max_packets)
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 1209, in loop_read
rc = self._packet_read()
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 1802, in _packet_read
rc = self._packet_handle()
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 2278, in _packet_handle
return self._handle_publish()
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 2464, in _handle_publish
self._handle_on_message(message)
File “c:\python27\lib\site-packages\paho\mqtt\client.py”, line 2624, in _handle_on_message
self.on_message(self, self._userdata, message)
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 379, in on_message
self.decode_topics(json_data)
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 621, in decode_topics
self.update_state_machine()
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 738, in update_state_machine
self.draw_map(current_mission != self.current_state)
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 1036, in draw_map
self.render_map(self.co_ords, self.previous_co_ords)
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 1071, in render_map
self.save_text_and_map_on_whitebg(self.map_no_text)
File “c:\python27\lib\site-packages\roomba\roomba.py”, line 1269, in save_text_and_map_on_whitebg
self.mapPath + ‘/’ + self.roombaName + ‘map.png’)
WindowsError: [Error 183] Cannot create a file when that file already exists

I finally figured out the mapping issue. The main issue was that I was using WIndows :slight_smile: I installed Linux and transferred all the scripts to this host, and I not longer have any issues. However, I now have 1 last thing to fix.

The real-time mapping and final map always seems stretched, and it does not map out my entire floor. I’ve attached the image of the map for reference.

Also, here is the command I run:

roomba -R ip -u user -w Password -b brooker -U roomba -P roomba -l /var/www/html/roomba.log -M /var/www/html/ -I /var/www/html/icons/ -s ‘(800,1800,-180,-550,90,180)’

It would be nice to have a binding created :sweat_smile:

binding to what? I already have a binding to my MQTT in openhab…

a roomba binding instead all of this installation, i am stucked at the installation
pip install git+https://github.com/NickWaterton/Roomba980-Python.git
it gives me errors and cannot go on

1 Like

What errors are you getting?

sudo pip install git+https://github.com/NickWaterton/Roomba980-Python.git
[sudo] password for openhabian:
Collecting git+https://github.com/NickWaterton/Roomba980-Python.git
  Cloning https://github.com/NickWaterton/Roomba980-Python.git to /tmp/pip-cvKR61-build
Collecting numpy (from Roomba980-Python==1.2.1)
  Using cached numpy-1.14.2.zip
Collecting opencv-python (from Roomba980-Python==1.2.1)
  Could not find a version that satisfies the requirement opencv-python (from Roomba980-Python==1.2.1) (from versions: )
No matching distribution found for opencv-python (from Roomba980-Python==1.2.1)