Re: iRobot Roomba 980 integration
Posted: Monday 18 January 2021 18:32
It is in the procedure in the readme on GitHub
Open source Home Automation System
https://forum.domoticz.com/
Hello Filip,Filip wrote: ↑Sunday 17 January 2021 11:21 I made a plugin for the ROOMBA i7... Don't know if it works with the Roomba 980 however would be interesting if somebody can give it a try and give feedback. The plugin is available on https://github.com/FilipDem/Domoticz-iR ... MBA-plugin.
Filip,Filip wrote: ↑Sunday 24 January 2021 15:20 Seems strange as the error seems to come from the LUA framework while I am not using this in the plugin.
What is Staat Lydia? This is a device I suppose... Did you rename the generated Roomba devices that we're created automatically? This could be the problem...
If necessity you need to activate the debug mode of the plugin and post the relevant traces.
Seems that this is indeed working well. I give some information that I posted to help somebody else on https://github.com/FilipDem/Domoticz-iR ... n/issues/2. Especially the test with mosquitto_sub is interesting to do.Svennie wrote: ↑Sunday 24 January 2021 19:34Filip,Filip wrote: ↑Sunday 24 January 2021 15:20 Seems strange as the error seems to come from the LUA framework while I am not using this in the plugin.
What is Staat Lydia? This is a device I suppose... Did you rename the generated Roomba devices that we're created automatically? This could be the problem...
If necessity you need to activate the debug mode of the plugin and post the relevant traces.
Lydia is de name of my Roomba. Cloud it be that Domoticz is translating to Dutch in de log-file? State translated to Dutch is Staat. And no I didn't rename the device that had been created.
I activated the debug mode. see below for the result:
pi@raspberrypi:~/domoticz/plugins/Roomba $ python3 mqtt_Roomba.py -D 3
CV or numpy module not found, falling back to PIL
<CTRL C> to exit
Subscribe to /roomba/feedback/# to see published data
Broker Connected with result code 0
Broker Subscribed: 1 (0,)
Broker Subscribed: 2 (0,)
^CSystem exit Received - Exiting program
Broker disconnected
Can you make anything out of it. I'm going to install your plugin on my other Rpi. Maybe the other Raspberry is nog functioning correct. Keep me posted on what you think.
Flilip,Filip wrote: ↑Monday 25 January 2021 8:45Seems that this is indeed working well. I give some information that I posted to help somebody else on https://github.com/FilipDem/Domoticz-iR ... n/issues/2. Especially the test with mosquitto_sub is interesting to do.Svennie wrote: ↑Sunday 24 January 2021 19:34Filip,Filip wrote: ↑Sunday 24 January 2021 15:20 Seems strange as the error seems to come from the LUA framework while I am not using this in the plugin.
What is Staat Lydia? This is a device I suppose... Did you rename the generated Roomba devices that we're created automatically? This could be the problem...
If necessity you need to activate the debug mode of the plugin and post the relevant traces.
Lydia is de name of my Roomba. Cloud it be that Domoticz is translating to Dutch in de log-file? State translated to Dutch is Staat. And no I didn't rename the device that had been created.
I activated the debug mode. see below for the result:
pi@raspberrypi:~/domoticz/plugins/Roomba $ python3 mqtt_Roomba.py -D 3
CV or numpy module not found, falling back to PIL
<CTRL C> to exit
Subscribe to /roomba/feedback/# to see published data
Broker Connected with result code 0
Broker Subscribed: 1 (0,)
Broker Subscribed: 2 (0,)
^CSystem exit Received - Exiting program
Broker disconnected
Can you make anything out of it. I'm going to install your plugin on my other Rpi. Maybe the other Raspberry is nog functioning correct. Keep me posted on what you think.
mqtt_Roomba.py connects to the ROOMBA and publishes (MQTT PUB) ROOMBA data to the mosquitto (MQTT brooker). The domoticz plugin (plugin.py) is the MQTT client/subscriber.
Check if mosquitto is really running. All is based on 'localhost' so be sure it is running on the same machine as your domoticz. You can check it with sudo service mosquitto status. I suppose it will be the case seen the domoticz client can connect (otherwise I would have seen an error message in the log). I am rather sure it is between the ROOMBA and domoticz.
Be sure that mqtt_Roomba.py is also running. If you start it manually, be sure that at every reboot it is started. If you created a service (as indicated in the procedure, check if the service is running with sudo service roomba status.
You can test without domoticz by starting a MQTT subscriber manually. If you run mosquitto_sub -v -t /roomba/feedback/# (again on the same machine), you should receive the raw output that is sent regularly by ROOMBA. Output should be something like:
/roomba/feedback/netinfo_dhcp True
/roomba/feedback/netinfo_addr 3232261301
/roomba/feedback/netinfo_mask 4294967040
/roomba/feedback/netinfo_gw 3232261121
/roomba/feedback/netinfo_dns1 3232261121
/roomba/feedback/netinfo_dns2 0
/roomba/feedback/netinfo_bssid 6c:b0:ce:14:2f:cd
/roomba/feedback/netinfo_sec 4
/roomba/feedback/wifistat_wifi 1
/roomba/feedback/wifistat_uap False
/roomba/feedback/wifistat_cloud 1
/roomba/feedback/netinfo_dhcp True
... (deleted a part)
/roomba/feedback/bbsys_hr 517
/roomba/feedback/bbsys_min 57
/roomba/feedback/state Charging
/roomba/feedback/signal_rssi -35
/roomba/feedback/signal_snr 54
/roomba/feedback/state Charging
/roomba/feedback/signal_rssi -36
/roomba/feedback/signal_snr 53
/roomba/feedback/state Charging
If you don't have this, it will certainly not work in Domoticz.
Hope it helps. Success
Happy with your feedback and glad it works!Svennie wrote: ↑Tuesday 26 January 2021 18:20Flilip,Filip wrote: ↑Monday 25 January 2021 8:45Seems that this is indeed working well. I give some information that I posted to help somebody else on https://github.com/FilipDem/Domoticz-iR ... n/issues/2. Especially the test with mosquitto_sub is interesting to do.Svennie wrote: ↑Sunday 24 January 2021 19:34
Filip,
Lydia is de name of my Roomba. Cloud it be that Domoticz is translating to Dutch in de log-file? State translated to Dutch is Staat. And no I didn't rename the device that had been created.
I activated the debug mode. see below for the result:
pi@raspberrypi:~/domoticz/plugins/Roomba $ python3 mqtt_Roomba.py -D 3
CV or numpy module not found, falling back to PIL
<CTRL C> to exit
Subscribe to /roomba/feedback/# to see published data
Broker Connected with result code 0
Broker Subscribed: 1 (0,)
Broker Subscribed: 2 (0,)
^CSystem exit Received - Exiting program
Broker disconnected
Can you make anything out of it. I'm going to install your plugin on my other Rpi. Maybe the other Raspberry is nog functioning correct. Keep me posted on what you think.
mqtt_Roomba.py connects to the ROOMBA and publishes (MQTT PUB) ROOMBA data to the mosquitto (MQTT brooker). The domoticz plugin (plugin.py) is the MQTT client/subscriber.
Check if mosquitto is really running. All is based on 'localhost' so be sure it is running on the same machine as your domoticz. You can check it with sudo service mosquitto status. I suppose it will be the case seen the domoticz client can connect (otherwise I would have seen an error message in the log). I am rather sure it is between the ROOMBA and domoticz.
Be sure that mqtt_Roomba.py is also running. If you start it manually, be sure that at every reboot it is started. If you created a service (as indicated in the procedure, check if the service is running with sudo service roomba status.
You can test without domoticz by starting a MQTT subscriber manually. If you run mosquitto_sub -v -t /roomba/feedback/# (again on the same machine), you should receive the raw output that is sent regularly by ROOMBA. Output should be something like:
/roomba/feedback/netinfo_dhcp True
/roomba/feedback/netinfo_addr 3232261301
/roomba/feedback/netinfo_mask 4294967040
/roomba/feedback/netinfo_gw 3232261121
/roomba/feedback/netinfo_dns1 3232261121
/roomba/feedback/netinfo_dns2 0
/roomba/feedback/netinfo_bssid 6c:b0:ce:14:2f:cd
/roomba/feedback/netinfo_sec 4
/roomba/feedback/wifistat_wifi 1
/roomba/feedback/wifistat_uap False
/roomba/feedback/wifistat_cloud 1
/roomba/feedback/netinfo_dhcp True
... (deleted a part)
/roomba/feedback/bbsys_hr 517
/roomba/feedback/bbsys_min 57
/roomba/feedback/state Charging
/roomba/feedback/signal_rssi -35
/roomba/feedback/signal_snr 54
/roomba/feedback/state Charging
/roomba/feedback/signal_rssi -36
/roomba/feedback/signal_snr 53
/roomba/feedback/state Charging
If you don't have this, it will certainly not work in Domoticz.
Hope it helps. Success
I did run de command you gave me. I didn't get any result on my Rpi4. So I try to install your plug-in on a RPi3 with Domoticz. It worked on that one. Thnx for you help. Eventually I wanna run Domoticz with your plugin on the Rpi4. So now I know what the do. It does do what I needed. Now I have the get some scripts running what turning on my lights so my Roomba can vacuum at night.
greetz Sven
If you look to one of the "issues" on the GitHub, you will see that somebody reported that update stopped after there was a connection interrupt (probably between ROOMBA and router). He detected this because he had a daily reboot and afterwards it did not work.Svennie wrote: ↑Wednesday 27 January 2021 21:34 Filip,
I encountered an issue. The Plugin works great. But... after 10, 30, 60 or 2 hours the plugin isn't updating the status of my Roomba S9.
Even do my Roomba is running.
When u run the command: sudo service roomba status, I get the following.
pi@raspberrypi:~ $ sudo service roomba status
● roomba.service - Roomba mqtt client
Loaded: loaded (/etc/systemd/system/roomba.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-27 18:11:53 CET; 31min ago
Main PID: 3233 (python3)
Tasks: 1 (limit: 2182)
CGroup: /system.slice/roomba.service
└─3233 /usr/bin/python3 /home/pi/domoticz/plugins/Roomba/mqtt_Roomba.py
So de service is running. But there is no change in Domoticz. But when I run "sudo service roomba stop" and then "Sudo service roomba start" or I run "Sudo service roomba restart" the status in Domoticz is updated after a couple of seconds.
In a couple of post earlier you gave me a command to run to test the response of the Roomba. "mosquitto_sub -v -t /roomba/feedback/#" When my Roomba is running it gives a response. That stops when he is on his dock and charging.
Can I do anything to keep the roomba service sort of alive?
Thank you again for your help.
Filip,Filip wrote: ↑Thursday 28 January 2021 21:46If you look to one of the "issues" on the GitHub, you will see that somebody reported that update stopped after there was a connection interrupt (probably between ROOMBA and router). He detected this because he had a daily reboot and afterwards it did not work.Svennie wrote: ↑Wednesday 27 January 2021 21:34 Filip,
I encountered an issue. The Plugin works great. But... after 10, 30, 60 or 2 hours the plugin isn't updating the status of my Roomba S9.
Even do my Roomba is running.
When u run the command: sudo service roomba status, I get the following.
pi@raspberrypi:~ $ sudo service roomba status
● roomba.service - Roomba mqtt client
Loaded: loaded (/etc/systemd/system/roomba.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-27 18:11:53 CET; 31min ago
Main PID: 3233 (python3)
Tasks: 1 (limit: 2182)
CGroup: /system.slice/roomba.service
└─3233 /usr/bin/python3 /home/pi/domoticz/plugins/Roomba/mqtt_Roomba.py
So de service is running. But there is no change in Domoticz. But when I run "sudo service roomba stop" and then "Sudo service roomba start" or I run "Sudo service roomba restart" the status in Domoticz is updated after a couple of seconds.
In a couple of post earlier you gave me a command to run to test the response of the Roomba. "mosquitto_sub -v -t /roomba/feedback/#" When my Roomba is running it gives a response. That stops when he is on his dock and charging.
Can I do anything to keep the roomba service sort of alive?
Thank you again for your help.
So I would suggest you two things:
* check if there are network interrupts
* I propose you stop the service and start the python script manually (with debug information). It is indicated in the procedure on GitHub how to do. Of course you will need to keep your SSH session open...
"That stops when he is on his dock and charging." I don't know exactly anymore the behavior at my side. Will check once this weekend... Now. If mosquitto_sub does not receive updates, it is normal that the python script/service does not get it either. This makes me thinking about another possible topic... You should also check the status of the mosquitto service... As there is a dependency of the roobma service with mosquitto, it is possible after a restart of the roomba service, the mosquitto is restarted again... And perhaps the problem is at the mosquitto service. Thanks to supply your findings about this topic.
From my side (but this weekend probably) I will see to make the script more robust in case of network interrupt... However strange enough, I never detected such problem at my side... All is running since some months without any problem. I regularly check (since your message) if the updates are still in Domoticz and it is... However I know that I already had network interrupts...
Hey Sven,Svennie wrote: ↑Friday 29 January 2021 21:39Filip,Filip wrote: ↑Thursday 28 January 2021 21:46If you look to one of the "issues" on the GitHub, you will see that somebody reported that update stopped after there was a connection interrupt (probably between ROOMBA and router). He detected this because he had a daily reboot and afterwards it did not work.Svennie wrote: ↑Wednesday 27 January 2021 21:34 Filip,
I encountered an issue. The Plugin works great. But... after 10, 30, 60 or 2 hours the plugin isn't updating the status of my Roomba S9.
Even do my Roomba is running.
When u run the command: sudo service roomba status, I get the following.
pi@raspberrypi:~ $ sudo service roomba status
● roomba.service - Roomba mqtt client
Loaded: loaded (/etc/systemd/system/roomba.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2021-01-27 18:11:53 CET; 31min ago
Main PID: 3233 (python3)
Tasks: 1 (limit: 2182)
CGroup: /system.slice/roomba.service
└─3233 /usr/bin/python3 /home/pi/domoticz/plugins/Roomba/mqtt_Roomba.py
So de service is running. But there is no change in Domoticz. But when I run "sudo service roomba stop" and then "Sudo service roomba start" or I run "Sudo service roomba restart" the status in Domoticz is updated after a couple of seconds.
In a couple of post earlier you gave me a command to run to test the response of the Roomba. "mosquitto_sub -v -t /roomba/feedback/#" When my Roomba is running it gives a response. That stops when he is on his dock and charging.
Can I do anything to keep the roomba service sort of alive?
Thank you again for your help.
So I would suggest you two things:
* check if there are network interrupts
* I propose you stop the service and start the python script manually (with debug information). It is indicated in the procedure on GitHub how to do. Of course you will need to keep your SSH session open...
"That stops when he is on his dock and charging." I don't know exactly anymore the behavior at my side. Will check once this weekend... Now. If mosquitto_sub does not receive updates, it is normal that the python script/service does not get it either. This makes me thinking about another possible topic... You should also check the status of the mosquitto service... As there is a dependency of the roobma service with mosquitto, it is possible after a restart of the roomba service, the mosquitto is restarted again... And perhaps the problem is at the mosquitto service. Thanks to supply your findings about this topic.
From my side (but this weekend probably) I will see to make the script more robust in case of network interrupt... However strange enough, I never detected such problem at my side... All is running since some months without any problem. I regularly check (since your message) if the updates are still in Domoticz and it is... However I know that I already had network interrupts...
Today I have taken a closer look a the Domoticz log. This morning de service wasn't working correctly. So I stopped it. And start 'python3 mqtt_Roomba.py' And to test it's performance I manually started a job for the Roomba. The change in status came thru in Domoticz. So far so good. Then I stopped the job. That's where it all went wrong. See below for the output:
pi@raspberrypi:~/domoticz/plugins/Roomba $ python3 mqtt_Roomba.py
CV or numpy module not found, falling back to PIL
PIL module not found, maps are disabled
<CTRL C> to exit
Subscribe to /roomba/feedback/# to see published data
Broker Connected with result code 0
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
self.run()
File "/usr/lib/python3.7/threading.py", line 865, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3452, in _thread_main
self.loop_forever(retry_first_connection=True)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1779, in loop_forever
rc = self.loop(timeout, max_packets)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1181, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1572, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 2310, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 2936, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3216, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
self.on_message(self, self._userdata, message)
File "/home/pi/domoticz/plugins/Roomba/roomba/roomba.py", line 459, in on_message
self.decode_topics(json_data)
File "/home/pi/domoticz/plugins/Roomba/roomba/roomba.py", line 713, in decode_topics
self.update_state_machine()
File "/home/pi/domoticz/plugins/Roomba/roomba/roomba.py", line 820, in update_state_machine
self.current_state = self.states[self.cleanMissionStatus_phase]
KeyError: 'evac'
After that there where no changes in Domoticz anymore. So I Rebooted my Pi and checked to see if the Roomba service was running and it was. After that I kept my my I eye on the Domoticz log after I switch to the debug mode for the plugin in Domoticz. In a constant pace de updates kept coming in. After a couple of hours I started a job and let it finished it. That to went well. Did another job shortly after that en that went oke to.
So I believe that stopping a job and canceling it, so that the Roomba go's back to the dock, is the problem somehow.
Hopefully you can do something with my comments.
greetz Sven
Hi Sven,Svennie wrote: ↑Saturday 13 February 2021 21:52 Hi Filip.
I got the time today to install your plugin on my other Pi. I saw that you change the install. I have the old version of your plugin semi working on my Rpi 3. It works with mij Roomba S9 after hij restart the Roomba Service. Now I try to install it on my Rpi 4. When I try to check if there is a connection between my S9 en the Pi with the command: python3 roomba --topic /roomba/feedback/# --broker localhost --brokerFeedback /roomba/feedback --mapPath '' --mapSize '' --log '' from the folder /home/pi/domoticz/plugins/Roomba I get the next output.
pi@raspberrypi:~/domoticz/plugins/Roomba $ python3 roomba --topic /roomba/feedback/# --broker localhost --brokerFeedback /roomba/feedback --mapPath '' --mapSize '' --log ''
CV or numpy module not found, falling back to PIL
CV or numpy module not found, falling back to PIL
[I 2021-02-13 21:42:38,493] *******************
[I 2021-02-13 21:42:38,493] * Program Started *
[I 2021-02-13 21:42:38,494] *******************
[I 2021-02-13 21:42:38,494] Roomba.py Version: 1.2.9
[I 2021-02-13 21:42:38,494] Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
[I 2021-02-13 21:42:38,494] Paho MQTT Version: 1.5.1
[I 2021-02-13 21:42:38,494] PIL Version: 5.4.1
[I 2021-02-13 21:42:38,494] <CNTRL C> to Exit
[I 2021-02-13 21:42:38,494] Roomba 980 MQTT data Interface
[I 2021-02-13 21:42:38,496] reading info from config file ./config.ini
[I 2021-02-13 21:42:38,497] connecting to broker
[I 2021-02-13 21:42:38,503] Creating Roomba object 192.168.1.62
[I 2021-02-13 21:42:38,503] connecting Roomba 192.168.1.62
This is the output I get. Until I push CNTRL C en then it stops. I believe it cannot connect to my Roomba.
When I run the commend: 'python3 roomba --topic /roomba/feedback/# --broker localhost --brokerFeedback /roomba/feedback --mapPath '' --mapSize '' --log '' --debug' This is the output.
CV or numpy module not found, falling back to PIL
CV or numpy module not found, falling back to PIL
[I 2021-02-13 21:54:50,548] *******************
[I 2021-02-13 21:54:50,548] * Program Started *
[I 2021-02-13 21:54:50,549] *******************
[I 2021-02-13 21:54:50,549] Roomba.py Version: 1.2.9
[I 2021-02-13 21:54:50,549] Python Version: 3.7.3 (default, Jul 25 2020, 13:03:44) [GCC 8.3.0]
[I 2021-02-13 21:54:50,549] Paho MQTT Version: 1.5.1
[I 2021-02-13 21:54:50,549] PIL Version: 5.4.1
[D 2021-02-13 21:54:50,549] -- DEBUG Mode ON -
[I 2021-02-13 21:54:50,549] <CNTRL C> to Exit
[I 2021-02-13 21:54:50,549] Roomba 980 MQTT data Interface
[I 2021-02-13 21:54:50,551] reading info from config file ./config.ini
[I 2021-02-13 21:54:50,553] connecting to broker
[I 2021-02-13 21:54:50,558] Creating Roomba object 192.168.1.62
[I 2021-02-13 21:54:50,559] connecting Roomba 192.168.1.62
Error: [Errno 111] Connection refused
Attempting new Connection to Roomba (#1)
Error: [Errno 111] Connection refused
Attempting new Connection to Roomba (#2)
Error: [Errno 111] Connection refused
Attempting new Connection to Roomba (#3)
Error: [Errno 111] Connection refused
Unable to connect to Roomba Lydia
[D 2021-02-13 21:54:53,959] Broker disconnected
What can I do to fix this?
i have edit the conf file in the /etc/mosquitto folder and i believe it has to be copied into the conf.d folder?# Place your local configuration in /etc/mosquitto/conf.d/
#
# A full description of the configuration file is at
# /usr/share/doc/mosquitto/examples/mosquitto.conf.gz
pid_file /run/mosquitto/mosquitto.pid
persistence false
persistence_location /var/lib/mosquitto/
log_dest none
include_dir /etc/mosquitto/conf.d
Code: Select all
mosquitto_sub -v -t /roomba/feedback/#
Code: Select all
-bash: mosquitto_sub: opdracht niet gevonden