Open fsontheim opened 7 years ago
Florian,
In my version of paho-mqtt the version number is stored in the library variable VERSION_NUMBER, but this is an old convention. The modern convention is to store it in a variable version so the current version of the library may use this convention (I don’t know when I last updated my copy of the library).
So you can comment out this line 1598 (it just prints the version number of the paho mqtt library), or change VERSION_NUMBER to version and it should work.
Nick Waterton P.Eng.
From: fsontheim [mailto:notifications@github.com] Sent: June-24-17 10:56 AM To: NickWaterton/Roomba980-Python Roomba980-Python@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: EXT: [NickWaterton/Roomba980-Python] Error after executing roomba.py (#4)
Hi Nick,
i get an error when executing the ./roomba.py the first time:
florian@roomba-service:/Roomba980-Python$ sudo ./roomba.py libdc1394 error: Failed to initialize libdc1394 [I 2017-06-24 16:45:44,411] [I 2017-06-24 16:45:44,411] Program Started [I 2017-06-24 16:45:44,412] Traceback (most recent call last): File "./roomba.py", line 1598, in log.info("Paho MQTT Version: %s" % mqtt.VERSION_NUMBER) AttributeError: 'module' object has no attribute 'VERSION_NUMBER' florian@roomba-service:/Roomba980-Python$
Do you have any ideas?
Thanks and Best Regards, Florian
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/NickWaterton/Roomba980-Python/issues/4, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALCUZyiT041rsRq3Nc_eTM_SgYmIZBaeks5sHSNjgaJpZM4OEV_W.
Florian,
OK I’ve fixed it on github. Should now work with paho-mqtt V1.3 which removed the VERSION_NUMBER variable.
NOTE: V1.3 now requires Python 2.7.9 for TLS to work (kind of a problem, as this is a breaking change for Ubuntu 14.04 users like me).
If you are using Ubuntu 14.04, or are otherwise stuck on python 2.7.6, I suggest you stay with V 1.2.3, as this works just fine as is.
Command to install a specific version is pip install paho-mqtt==1.2.3
Otherwise you get V1.3 that requires python 2.7.9 as a minimum.
Regards,
Nick Waterton P.Eng.
From: fsontheim [mailto:notifications@github.com] Sent: June-24-17 10:56 AM To: NickWaterton/Roomba980-Python Roomba980-Python@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: EXT: [NickWaterton/Roomba980-Python] Error after executing roomba.py (#4)
Hi Nick,
i get an error when executing the ./roomba.py the first time:
florian@roomba-service:/Roomba980-Python$ sudo ./roomba.py libdc1394 error: Failed to initialize libdc1394 [I 2017-06-24 16:45:44,411] [I 2017-06-24 16:45:44,411] Program Started [I 2017-06-24 16:45:44,412] Traceback (most recent call last): File "./roomba.py", line 1598, in log.info("Paho MQTT Version: %s" % mqtt.VERSION_NUMBER) AttributeError: 'module' object has no attribute 'VERSION_NUMBER' florian@roomba-service:/Roomba980-Python$
Do you have any ideas?
Thanks and Best Regards, Florian
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/NickWaterton/Roomba980-Python/issues/4, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALCUZyiT041rsRq3Nc_eTM_SgYmIZBaeks5sHSNjgaJpZM4OEV_W.
Hi Nick, many thanks for your fast reply - that worked for me. Now i can see the receiving Roomba Data. Next step is to integrate that in my openHAB2 Setup :-)
Two more questions for my understanding:
Do i have to start the roomba.py script every time when i'am rebooting the server? Or is this coming up like a service?
For this setup i did a fresh setup of a virtual machine with ubuntu 14.04.5 because i read you have this version up and running. May it make sense to set this up with a 16.04.2? Or do you think this would not work?
Thank you and Best Regards, Florian
Florian,
Yes you would have to start roomba.py every time (it's not a service). It would be easy to make it a service though.
I use the following script with monit to start the script automatically:
#!/bin/bash
pid_file=/var/run/roomba.pid
if [ -e $pid_file ]; then
/home/nick/Scripts/stop_process $pid_file
fi
echo "Starting Roomba"
cd /home/nick/Scripts/roomba/python
nohup ./roomba.py -R 192.168.100.181 -u 311xxxxxxxxxxxx -w :1:xxxxxxxxxxxxxxxxxxxx -b 192.168.100.119 -l /home/nick/Scripts/Roomba.log -M /etc/openhab2/html/roomba -s '(800,1650,-250,-150,2,0)' > /dev/null 2>&1 & echo $! > $pid_file
echo "End of start Roomba"
I have another script (stop_process) to kill processes based on pid (from the pid file).
Also, no reason why it shouldn't work with later versions of Ubuntu, 14.04 just happens to be what I'm using. Probably works better with later versions. Python 3 should work also.
Hi Nick, thank you for your support. The MQTT Data Exchange ist working now. I see Roomba information in the openhab sitemap. The only problem i stuck is the creation of the map:
[I 2017-07-04 14:25:11,018] MAP: Maps Enabled [I 2017-07-04 14:25:11,019] MAP: openening existing line image [W 2017-07-04 14:25:11,021] MAP: line image problem: [Errno 2] No such file or directory: u'.//Fipsilines.png': created new image [I 2017-07-04 14:25:11,021] MAP: openening existing problems image [W 2017-07-04 14:25:11,023] MAP: problems image problem: [Errno 2] No such file or directory: u'.//Fipsiproblems.png': created new image [I 2017-07-04 14:25:11,023] MAP: openening existing map no text image [W 2017-07-04 14:25:11,024] MAP: map no text image problem: [Errno 2] No such file or directory: u'.//Fipsimap_notext.png': set to None [W 2017-07-04 14:25:11,024] error loading font: cannot open resource, loading default font [I 2017-07-04 14:25:11,035] MAP: home_pos: (100,775) [I 2017-07-04 14:25:11,044] MAP: Initialisation complete [I 2017-07-04 14:25:11,044] Connecting Fipsi
I tried something with chmod etc but it does not work. I'm running out of ideas... ;-)
Parallel i set up a 16.042 ubuntu machine but there i stuck with certificate problems...
... MAP: Initialisation complete [I 2017-07-04 14:30:51,732] Connecting Fipsi [E 2017-07-04 14:30:51,740] Error: check_hostname needs a SSL context with either CERT_OPTIONAL or CERT_REQUIRED ...
Do you have a idea? Thanks and Best Regards, Florian
Florian,
Two things, it looks like I have the default path for mapPath and iconpath wrong (I was defining "./" I think it should be ".", so the default should now be "./Fipsilines.png" not ".//Fipsilines.png".
The second thing is that for Openhab2 to work, the default path for the maps should be "/etc/openhab2/html" optionally using a subdirectory (I use "/etc/openhab2/html/roomba" - which you would have to create with write permissions). You then have to specify this directory on the command line:
Roomba.py -M /etc/openhab2/html/roomba
so that you can see the maps using the openhab2 built in web viewer (at http://openhab2_ip:openhab2_port/static/roomba/Fipsi_map.html)
The exact location of these files, ip address and port depends on your configuration of openhab2.
If you use the default settings (in the latest github commit), the maps should be created in your roomba980-python directory now, but you won't be able to see them in Openhab2 until you define the default directory location as I describe above.
I'll look into the 16.042 ubuntu certificate issue.
Sorry, messed up icon paths - fixed also.
OK,
The error in Ubuntu 16.042 is caused by paho-mqtt changes to TLS encryption. If you use V 1.2.3, it works fine. With V1.3 TLS is now different, so I have made changes to the encryption/verification.
The new roomba.py (v1.1.1) I just pushed, now tries the old (v1.2.3) TLS version, and if that fails switches to the new (v1.3) method. I have tested both (spun up an ubuntu 16.04 VM) and they work at my end.
Note: Ubuntu 14.04 NEEDS paho-mqtt v1.2.3, as the python version doesn't support the new TLS in v1.3. Ubuntu 16.06 should now work with either version.
Hi Nick,
i did a clean 16.04.2 install in a virtualbox but there are still issues with the certficate process:
florian@roomba-server:/Roomba980-Python$ sudo ./roomba.py -b 192.168.1.9
CV or numpy module not found, falling back to PIL
[I 2017-07-10 22:59:47,463]
[I 2017-07-10 22:59:47,463] Program Started
[I 2017-07-10 22:59:47,464]
[I 2017-07-10 22:59:47,464] Roomba.py Version: 1.2.0
[I 2017-07-10 22:59:47,464] Python Version: 3.5.2 (default, Nov 17 2016, 17:05:2 3) [GCC 5.4.0 20160609]
[I 2017-07-10 22:59:47,464] Paho MQTT Version: 1.2.3
[I 2017-07-10 22:59:47,464] PIL Version: 4.2.1
[I 2017-07-10 22:59:47,465]
Any idea what´s going wrong?
Best Regards, Florian
Florian,
That doesn't look like a TLS error. I've been using Paho-MQTT v1.3 (the latest) with Ubuntu 16.04 - you only need to use the old version with Ubuntu 14.04. If you use v1.3 you should get the message "trying 1.3 version".
Can you connect via the app? (Not cloud mode - direct ie no "world" icon).
You might need to reset your Roomba (press and hold start) -doesn't erase anything, just a reset. Blid and password stay the same.
I have no problems with my set up, but during development I did have to reset Roomba occasionally.
I've tried every combination of python 2,3 Ububtu 14,16 and Paho-MQTT, and they all work except the one Ubuntu 14 and 1.3 case.
I'm using virtual box and virtualenv to test.
Nick Waterton P.Eng Sent from my iPhone
On Jul 10, 2017, at 5:09 PM, fsontheim notifications@github.com<mailto:notifications@github.com> wrote:
Hi Nick,
i did a clean 16.04.2 install in a virtualbox but there are still issues with the certficate process:
florian@roomba-server:/Roomba980-Python$ sudo ./roomba.py -b 192.168.1.9 CV or numpy module not found, falling back to PIL [I 2017-07-10 22:59:47,463] [I 2017-07-10 22:59:47,463] Program Started [I 2017-07-10 22:59:47,464] [I 2017-07-10 22:59:47,464] Roomba.py Version: 1.2.0 [I 2017-07-10 22:59:47,464] Python Version: 3.5.2 (default, Nov 17 2016, 17:05:2 3) [GCC 5.4.0 20160609] [I 2017-07-10 22:59:47,464] Paho MQTT Version: 1.2.3 [I 2017-07-10 22:59:47,464] PIL Version: 4.2.1 [I 2017-07-10 22:59:47,465] to Exit [I 2017-07-10 22:59:47,465] Roomba 980 MQTT data Interface [I 2017-07-10 22:59:47,465] reading info from config file ./config.ini [I 2017-07-10 22:59:47,466] connecting to broker [I 2017-07-10 22:59:47,468] Creating Roomba object 192.168.1.21 [I 2017-07-10 22:59:47,469] CONTINUOUS connection [I 2017-07-10 22:59:47,469] connecting Roomba 192.168.1.21 [I 2017-07-10 22:59:47,470] Posting DECODED data [I 2017-07-10 22:59:47,470] MAP: Maps Enabled [I 2017-07-10 22:59:47,470] MAP: openening existing line image [W 2017-07-10 22:59:47,472] MAP: line image problem: [Errno 2] No such file or d irectory: './Fipsilines.png': created new image [I 2017-07-10 22:59:47,472] MAP: openening existing problems image [W 2017-07-10 22:59:47,474] MAP: problems image problem: [Errno 2] No such file or directory: './Fipsiproblems.png': created new image [I 2017-07-10 22:59:47,474] MAP: openening existing map no text image [W 2017-07-10 22:59:47,474] MAP: map no text image problem: [Errno 2] No such fi le or directory: './Fipsimap_notext.png': set to None [W 2017-07-10 22:59:47,475] error loading font: cannot open resource, loading de fault font [I 2017-07-10 22:59:47,489] MAP: home_pos: (400,750) [I 2017-07-10 22:59:47,497] MAP: Initialisation complete [I 2017-07-10 22:59:47,497] Connecting Fipsi [I 2017-07-10 22:59:47,498] Seting TLS [E 2017-07-10 23:01:54,785] Error: [Errno 110] Connection timed out florian@roomba-server:/Roomba980-Python$
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/NickWaterton/Roomba980-Python/issues/4#issuecomment-314243990, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALCUZ40jWjpdyc3TgptKAC4AX2qTkrSsks5sMpLbgaJpZM4OEV_W.
Unsubscribe from GE's commercial electronic messages: http://sc.ge.com/*casl-unsubscribe Désabonner des messages électroniques commerciaux de GE: http://sc.ge.com/*lcap-desabonnement
Hello Nick, first, i really want to say a big thank you for your fast and perfect support. After your hint i'am one step closer to a solution. I did a Roomba Reset (battery plug off/on) and updatet paho to 1.3.0.
Now the MQTT communication between Roomba-Server, iRobot and Openhab Server seems to work. But i got one more Error and have no idea what this could be:
florian@roomba-server:/Roomba980-Python$ sudo ./roomba.py -b 192.168.1.9
CV or numpy module not found, falling back to PIL
[I 2017-07-11 20:36:38,851]
[I 2017-07-11 20:36:38,851] Program Started
[I 2017-07-11 20:36:38,852]
[I 2017-07-11 20:36:38,852] Roomba.py Version: 1.2.0
[I 2017-07-11 20:36:38,852] Python Version: 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609]
[I 2017-07-11 20:36:38,852] Paho MQTT Version: 1.3.0
[I 2017-07-11 20:36:38,853] PIL Version: 4.2.1
[I 2017-07-11 20:36:38,853]
Regards, Florian
It’s probably a bug, because I’m using OpenCV, I haven’t tested just using PIL too thoroughly.
I’ll take a look.
Nick Waterton P.Eng.
From: fsontheim [mailto:notifications@github.com] Sent: July-11-17 2:43 PM To: NickWaterton/Roomba980-Python Roomba980-Python@noreply.github.com Cc: Waterton, Nick (GE Healthcare) Nick.Waterton@med.ge.com; Comment comment@noreply.github.com Subject: EXT: Re: [NickWaterton/Roomba980-Python] Error after executing roomba.py (#4)
Hello Nick, first, i really want to say a big thank you for your fast and perfect support. After your hint i'am one step closer to a solution. I did a Roomba Reset (battery plug off/on) and updatet paho to 1.3.0.
Now the MQTT communication between Roomba-Server, iRobot and Openhab Server seems to work. But i got one more Error and have no idea what this could be:
` florian@roomba-server:/Roomba980-Python$ sudo ./roomba.py -b 192.168.1.9 CV or numpy module not found, falling back to PIL [I 2017-07-11 20:36:38,851] [I 2017-07-11 20:36:38,851] Program Started [I 2017-07-11 20:36:38,852] [I 2017-07-11 20:36:38,852] Roomba.py Version: 1.2.0 [I 2017-07-11 20:36:38,852] Python Version: 3.5.2 (default, Nov 17 2016, 17:05:23) [GCC 5.4.0 20160609] [I 2017-07-11 20:36:38,852] Paho MQTT Version: 1.3.0 [I 2017-07-11 20:36:38,853] PIL Version: 4.2.1 [I 2017-07-11 20:36:38,853] to Exit [I 2017-07-11 20:36:38,853] Roomba 980 MQTT data Interface [I 2017-07-11 20:36:38,854] reading info from config file ./config.ini [I 2017-07-11 20:36:38,854] connecting to broker [I 2017-07-11 20:36:38,857] Creating Roomba object 192.168.1.21 [I 2017-07-11 20:36:38,858] CONTINUOUS connection [I 2017-07-11 20:36:38,858] connecting Roomba 192.168.1.21 [I 2017-07-11 20:36:38,859] Posting DECODED data [I 2017-07-11 20:36:38,859] MAP: Maps Enabled [I 2017-07-11 20:36:38,859] MAP: openening existing line image [I 2017-07-11 20:36:38,883] MAP: openening existing problems image [I 2017-07-11 20:36:38,896] MAP: openening existing map no text image [W 2017-07-11 20:36:38,897] MAP: map no text image problem: [Errno 2] No such file or directory: './Fipsimap_notext.png': set to None [W 2017-07-11 20:36:38,898] error loading font: cannot open resource, loading default font [I 2017-07-11 20:36:38,904] MAP: home_pos: (400,750) [I 2017-07-11 20:36:38,911] MAP: Initialisation complete [I 2017-07-11 20:36:38,912] Connecting Fipsi [I 2017-07-11 20:36:38,912] Seting TLS [W 2017-07-11 20:36:38,919] TLS Setting failed - trying 1.3 version [I 2017-07-11 20:36:41,245] Roomba Connected Fipsi [I 2017-07-11 20:36:41,248] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"netinfo":{"dhcp":true,"addr":3232235797,"mask":4294967040,"gw":3232235777,"dns1":3232235783,"dns2":3232235777,"bssid":"54:a0:50:e4:42:30","sec":4}}}}' [I 2017-07-11 20:36:41,287] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"wifistat":{"wifi":1,"uap":false,"cloud":1}}}}' [I 2017-07-11 20:36:41,290] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"netinfo":{"dhcp":true,"addr":3232235797,"mask":4294967040,"gw":3232235777,"dns1":3232235783,"dns2":3232235777,"bssid":"54:a0:50:e4:42:30","sec":4}}}}' [I 2017-07-11 20:36:41,294] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"wlcfg":{"sec":7,"ssid":"7365637572652D6E"}}}}' [I 2017-07-11 20:36:41,296] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"mac":"f0:03:8c:1e:73:6e"}}}' [I 2017-07-11 20:36:41,298] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"country": "US"}}}' [I 2017-07-11 20:36:41,300] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"cloudEnv": "prod"}}}' [I 2017-07-11 20:36:41,314] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"svcEndpoints":{"svcDeplId": "v005"}}}}' [I 2017-07-11 20:36:41,405] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"mapUploadAllowed":true}}}' [I 2017-07-11 20:36:41,497] Received Roomba Data Fipsi: wifistat, b'{"state":{"reported":{"localtimeoffset":120,"utctime":1499798190,"pose":{"theta":159,"point":{"x":287,"y":237}}}}}' [I 2017-07-11 20:36:41,595] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"batPct":96,"dock":{"known":true},"bin":{"present":true,"full":false},"audio":{"active":false}}}}' [I 2017-07-11 20:36:41,686] Received Roomba Data Fipsi: $aws/things/3117440C10622790/shadow/update, b'{"state":{"reported":{"cleanMissionStatus":{"cycle":"quick","phase":"run","expireM":0,"rechrgM":0,"error":0,"notReady":0,"mssnM":6,"sqft":37,"initiator":"localApp","nMssn":138},"language":0,"noAutoPasses":false,"noPP":false,"ecoCharge":false}}}' [I 2017-07-11 20:36:41,692] updated state to: Running [I 2017-07-11 20:36:41,693] MAP: old x,y: (637, 1037) new x,y: (637, 1037) theta: 69 roomba pos: [612, 1012, 662, 1062] [I 2017-07-11 20:36:41,696] MAP: drawing roomba: pos: [612, 1012, 662, 1062], theta: 69 [I 2017-07-11 20:36:41,811] MAP: checking room outline Exception in thread Thread-1: Traceback (most recent call last): File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner self.run() File "/usr/lib/python3.5/threading.py", line 862, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2606, in _thread_main self.loop_forever(retry_first_connection=True) File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1470, in loop_forever rc = self.loop(timeout, max_packets) File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 995, in loop rc = self.loop_read(max_packets) File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1273, in loop_read rc = self._packet_read() File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 1838, in _packet_read rc = self._packet_handle() File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2285, in _packet_handle return self._handle_publish() File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2456, in _handle_publish self._handle_on_message(message) File "/usr/local/lib/python3.5/dist-packages/paho/mqtt/client.py", line 2603, in _handle_on_message self.on_message(self, self._userdata, message) File "./roomba.py", line 469, in on_message self.decode_topics(json_data) File "./roomba.py", line 685, in decode_topics self.update_state_machine() File "./roomba.py", line 779, in update_state_machine self.draw_map(current_mission != self.current_state) File "./roomba.py", line 1011, in draw_map self.render_map(self.co_ords, self.previous_co_ords) File "./roomba.py", line 1158, in render_map self.draw_room_outline(draw_final) File "./roomba.py", line 1310, in draw_room_outline edges = ImageOps.invert(self.room_outline.convert('L')) AttributeError: 'Roomba' object has no attribute 'room_outline'
`
— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/NickWaterton/Roomba980-Python/issues/4#issuecomment-314535908, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALCUZ9l8lT-pdwPbRYd1qxkGV25mPt1pks5sM8JGgaJpZM4OEV_W.
Unsubscribe from GE's commercial electronic messages: http://sc.ge.com/*casl-unsubscribe Désabonner des messages électroniques commerciaux de GE: http://sc.ge.com/*lcap-desabonnement
fsontheim,
OK, it's a bug because you aren't using openCV (and I am) these things creep in...
Two options, run with the new -o option (disables room outlines - which may or may not work in PIL anyway) - room outlines is where the bug is (you still get live maps etc, just not the final outline), and/or try the latest version I just pushed (1.2.1), it has a quick untested hack to see if it fixes it...
Or (third option) just install openCV V2, or 3.2 - either work
I made room outlines optional as it is buggy (maybe it should be off by default).
Let me know what happens.
Hi Nick,
i get an error when executing the ./roomba.py the first time:
_florian@roomba-service:/Roomba980-Python$ sudo ./roomba.py libdc1394 error: Failed to initialize libdc1394 [I 2017-06-24 16:45:44,411] [I 2017-06-24 16:45:44,411] Program Started [I 2017-06-24 16:45:44,412] Traceback (most recent call last): File "./roomba.py", line 1598, in
log.info("Paho MQTT Version: %s" % mqtt.VERSION_NUMBER)
AttributeError: 'module' object has no attribute 'VERSIONNUMBER'
florian@roomba-service:/Roomba980-Python$
Do you have any ideas?
Thanks and Best Regards, Florian