Roomba980-Python icon indicating copy to clipboard operation
Roomba980-Python copied to clipboard

Not quite working with new Roomba S9

Open DirtyCthulu opened this issue 4 years ago • 3 comments

After the latest change to fix the SSL Connection error, everything is nearly (or at least closer to) working with the new Roomba S9. However, when trying to do an initial setup using Python 2.7, I get the below error messages. I also tried to do a roomba.connect() and roomba.send_command("start") with the information that the script retrieved before erroring out, but roomba.master_state stays null and the Roomba does not start.

Received: { "robotname": "Test, "sku": "s915020", "nc": 0, "ver": "3", "proto": "mqtt", "ip": "192.168.1.165", "hostname": "iRobot-B66559F1D21E445E9C785DA092FFDE6B", "sw": "soho+3.0.11+soho-release-rt319+13", "robotid": "B66559F1D21E445E9C785DA092FFDE6B", "mac": "50:14:79:13:A0:B3", "cap": { "pmaps": 1, "carpetBoost": 1, "pp": 0, "pose": 1, "sched": 1, "log": 2, "ota": 2, "dockComm": 1, "binFullDetect": 1, "prov": 3, "area": 1, "eco": 1, "svcConf": 1, "maps": 3, "edge": 0, "team": 1, "multiPass": 2, "5ghz": 1 } } Roomba (Test) IP address is: 192.168.1.165 blid is: None Password=> :1:1570151115:8iV7hZGiYIyi6e9q <= Yes, all this string. Use these credentials in roomba.py Traceback (most recent call last): File "/home/cthulu/.local/bin/roomba", line 10, in sys.exit(main()) File "/home/cthulu/.local/lib/python2.7/site-packages/roomba/main.py", line 482, in main Password(file=arg.configfile) File "/home/cthulu/.local/lib/python2.7/site-packages/roomba/password.py", line 34, in init self.get_password() File "/home/cthulu/.local/lib/python2.7/site-packages/roomba/password.py", line 174, in get_password Config.set(addr,'blid', blid) File "/usr/lib/python2.7/dist-packages/backports/configparser/init.py", line 1236, in set _, option, value = self._validate_value_types(option=option, value=value) File "/usr/lib/python2.7/dist-packages/backports/configparser/init.py", line 1223, in _validate_value_types raise TypeError("option values must be strings") TypeError: option values must be strings

DirtyCthulu avatar Oct 08 '19 01:10 DirtyCthulu

What OS are you using? 2.7.1 seems like a very old version of Python, the earliest I've ever tried is 2.7.9, and really 2.7.12 is better (more compatible libraries).

The problem is that the Blid is shown as None which is a problem. You should have a valid Blid to be able to connect (and to save the config.ini file. In your case your Blid is B66559F1D21E445E9C785DA092FFDE6B

This is the line (112) in password.py that extracts the Blid from the hostname:

hostname = parsedMsg["hostname"].split('-')
if hostname[0] == 'Roomba' or hostname[0] == 'iRobot':  #for i7 robot name is now iRobot
    blid = hostname[1]

You are also missing the final " from the robotname - is this a cut and paste error?

Can you paste the full output from the connect attempt, and maybe try a later version of python? I don't really know why the Blid parsing should not work.

Also, now you have the ip, Blid and password, you could try a roomba.connect using these credentials, and see if it works (as given below).

example python:

from roomba import Roomba

#uncomment the option you want to run, and replace address, blid and roombaPassword with your own values

address = "192.168.1.165"
blid = "B66559F1D21E445E9C785DA092FFDE6B"
roombaPassword = ":1:1570151115:8iV7hZGiYIyi6e9q"

myroomba = Roomba(address, blid, roombaPassword)
#or myroomba = Roomba() #if you have a config file - will attempt discovery if you don't
myroomba.connect()

#myroomba.set_preference("carpetBoost", "true")
#myroomba.set_preference("twoPass", "false")

myroomba.send_command("start")

NickWaterton avatar Oct 08 '19 15:10 NickWaterton

I'm running Python 2.7.16 on Ubuntu 19.04. Yes, the missing " on the robotname is a copy-paste error. I think that the root of my earlier issue was that pip was not updating things correctly for me, though I'm not sure why. Using pip3 to install from github, I was getting roomba.py version 1.2.5, whereas regular pip was giving me 1.2.1. Now that I'm actually using the correct version of the script, things are working better. The initial run of the script worked fine up until the end:

[I 2019-10-08 19:14:39,143] ******************* [I 2019-10-08 19:14:39,143] * Program Started * [I 2019-10-08 19:14:39,143] ******************* [I 2019-10-08 19:14:39,143] Roomba.py Version: 1.2.5 [I 2019-10-08 19:14:39,144] Python Version: 2.7.16 (default, Jul 9 2019, 16:43:02) [GCC 8.3.0] [I 2019-10-08 19:14:39,144] Paho MQTT Version: 1.4.0 [I 2019-10-08 19:14:39,144] CV Version: 4.1.1 [I 2019-10-08 19:14:39,144] PIL Version: 6.1.0 [I 2019-10-08 19:14:39,144] <CNTRL C> to Exit [I 2019-10-08 19:14:39,144] Roomba 980 MQTT data Interface [I 2019-10-08 19:14:39,145] reading info from config file ./config.ini [W 2019-10-08 19:14:39,145] No roomba or config file defined, I will attempt to discover Roombas, please put the Roomba on the dock and follow the instructions: [I 2019-10-08 19:14:39,145] Using Password version 1.2.5 waiting on port: 5678 for data [W 2019-10-08 19:14:39,392] supplied address 255.255.255.255 does not match discovered address 192.168.1.165, using discovered address... found 1 Roomba(s) Make sure your robot (Test IV) at IP 192.168.1.165 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": "Test IV", "sku": "s915020", "nc": 0, "ver": "3", "proto": "mqtt", "ip": "192.168.1.165", "hostname": "iRobot-B66559F1D21E445E9C785DA092FFDE6B", "sw": "soho+3.0.11+soho-release-rt319+13", "robotid": "B66559F1D21E445E9C785DA092FFDE6B", "mac": "50:14:79:13:A0:B3", "cap": { "pmaps": 1, "carpetBoost": 1, "pp": 0, "pose": 1, "sched": 1, "log": 2, "ota": 2, "dockComm": 1, "binFullDetect": 1, "prov": 3, "area": 1, "eco": 1, "svcConf": 1, "maps": 3, "edge": 0, "team": 1, "multiPass": 2, "5ghz": 1 } } Roomba (Test IV) IP address is: 192.168.1.165 blid is: B66559F1D21E445E9C785DA092FFDE6B Password=> :1:1570151115:8iV7hZGiYIyi6e9q <= Yes, all this string. Use these credentials in roomba.py [I 2019-10-08 19:14:56,387] reading info from config file ./config.ini [I 2019-10-08 19:14:56,387] Success! 1 Roombas Found! [I 2019-10-08 19:14:56,387] Creating Roomba object 192.168.1.165 [I 2019-10-08 19:14:56,387] CONTINUOUS connection [I 2019-10-08 19:14:56,387] connecting Roomba 192.168.1.165 [W 2019-10-08 19:14:56,387] CSS file not found, creating ./style.css [W 2019-10-08 19:14:56,388] html file not found, creating ./Test IVroomba_map.html [I 2019-10-08 19:14:56,388] Posting DECODED data [I 2019-10-08 19:14:56,388] MAP: Maps Enabled [I 2019-10-08 19:14:56,394] MAP: openening existing map no text image [W 2019-10-08 19:14:56,394] MAP: map no text image problem: [Errno 2] No such file or directory: u'./Test IVmap_notext.png': set to None [I 2019-10-08 19:14:56,407] MAP: home_pos: (400,750) [I 2019-10-08 19:14:56,438] MAP: Initialisation complete [I 2019-10-08 19:14:56,438] Connecting Test IV [I 2019-10-08 19:14:56,438] Setting TLS [I 2019-10-08 19:14:56,445] Setting TLS - OK [E 2019-10-08 19:14:56,460] Error: [Errno 111] Connection refused [E 2019-10-08 19:14:56,460] Attempting new Connection# 1 [I 2019-10-08 19:14:57,461] Connecting Test IV

Subsequent runs using the created config file from above give me the below output (slightly different connection error). I've checked the config file and it does seem to be populated correctly.

[I 2019-10-08 19:20:36,735] ******************* [I 2019-10-08 19:20:36,735] * Program Started * [I 2019-10-08 19:20:36,736] ******************* [I 2019-10-08 19:20:36,736] Roomba.py Version: 1.2.5 [I 2019-10-08 19:20:36,736] Python Version: 2.7.16 (default, Jul 9 2019, 16:43:02) [GCC 8.3.0] [I 2019-10-08 19:20:36,736] Paho MQTT Version: 1.4.0 [I 2019-10-08 19:20:36,736] CV Version: 4.1.1 [I 2019-10-08 19:20:36,736] PIL Version: 6.1.0 [I 2019-10-08 19:20:36,736] <CNTRL C> to Exit [I 2019-10-08 19:20:36,737] Roomba 980 MQTT data Interface [I 2019-10-08 19:20:36,737] reading info from config file ./config.ini [I 2019-10-08 19:20:36,738] Creating Roomba object 192.168.1.165 [I 2019-10-08 19:20:36,738] CONTINUOUS connection [I 2019-10-08 19:20:36,739] connecting Roomba 192.168.1.165 [I 2019-10-08 19:20:36,739] Posting DECODED data [I 2019-10-08 19:20:36,739] MAP: Maps Enabled [I 2019-10-08 19:20:36,747] MAP: openening existing map no text image [W 2019-10-08 19:20:36,747] MAP: map no text image problem: [Errno 2] No such file or directory: u'./Test IVmap_notext.png': set to None [I 2019-10-08 19:20:36,751] MAP: home_pos: (400,750) [I 2019-10-08 19:20:36,775] MAP: Initialisation complete [I 2019-10-08 19:20:36,775] Connecting Test IV [I 2019-10-08 19:20:36,776] Setting TLS [I 2019-10-08 19:20:36,789] Setting TLS - OK [I 2019-10-08 19:20:37,103] Roomba Data: {} [I 2019-10-08 19:20:37,395] Roomba Connected Test IV [E 2019-10-08 19:20:37,396] Roomba Connected with result code 4 [E 2019-10-08 19:20:37,396] Please make sure your blid and password are correct Test IV [I 2019-10-08 19:20:42,106] Roomba Data: {} [I 2019-10-08 19:20:47,112] Roomba Data: {} [I 2019-10-08 19:20:52,118] Roomba Data: {}

DirtyCthulu avatar Oct 08 '19 23:10 DirtyCthulu

This usually means that you already have a connection to the Roomba from somewhere else (usually the app). Roomba only allows one connection at a time.

You need to disconnect the app (and this is sometimes hard to do), then reconnect roomba.py. After roomba.py is connected, you can reconnect the app (it will detect that the local connection is in use, and will use a cloud connection instead - the "world" icon shows this).

NickWaterton avatar Oct 09 '19 13:10 NickWaterton