About

The following page contains a description of an update of the official “dorita980” project and an associated “node-red-contrib-dorita980”, now renamed to “node-red-contrib-dorita980-local”, in order to support accessing WiFi-enabled roomba models up to the 900 series using node.js and Node-Red for IoT purposes.

The problem here has been that the old projects, both the “dorita980” and “node-red-contrib-dorita980” are not updated anymore such that the node.js version has fallen behind and some features stopped working. There is one emergent problem, namely that iRobot has lost shareholders after a failed Amazon acquisition such that there were worries regarding cloud access, given that most Roombas are actually made to operate through a centralized server and do not run uniquely local.

Download

Perhaps the most straightforward way to install the Node-Red addon is to install the Node-Red plugin from our node.js repository. All you need to do is to locate the Node-Red file folder, where package.json is located along with flows.json and then issue:

npm install node-red-contrib-dorita980-local --registry=https://npm.grimore.org/

After that, restart Node-Red in order to make the nodes appear.

Sources

  • dorita980 is the node.js library that we forked from the original GitHUB and then patched it up in order to bring it up-to-date,
  • node-red-contrib-dorita980-local is the Node-Red addon that uses the “dorita980” library and provides Node-Red nodes in order to build an automation flow

Node Set

There are several nodes that have been stripped, namely the history lookup that existed purely as a cloud-only feature. Note that the history-preserving feature just hinged on some cloud storage to save anterior pathways, such that the loss is unremarkable and the existing nodes can be used to recreate the feature. Otherwise, the very same nodes exist that can retrieve information from the roomba, set parameters and trigger actions. All of the features run locally without contacting a cloud.

Setting Up

The setup is easier compared to the antecessor, because the derived Node-Red addon will perform both auto-discovery and retrieve the required credentials from the Roomba itself without any user intervention. In the past, the “node-red-contrib-dorita980” required that the user clone “dorita980”, install the required packages and then the bin/getpassword.js script had to run in order to connect to the roomba on the local network in order to retrieve the credentials necessary to access the Roomba programmatically.

The steps are somewhat more simple now in terms of user-interaction but note that these steps might fail intermittently so they will have to be tried a few times until the connection is made successfully:

  • first, set up the Roomba as usual with a phone, and make sure that it connects to the local WiFi network properly,

  • hold down the appropriate buttons to put the Roomba in WiFi pairing mode,
    • This is a bit of a bother because documentation is sometimes wrong depending on the model and you might end up resetting the Roomba or similar; the idea here is that the WiFi “pairing mode” is a mode that can be activated after the Roomba has been connected to a WiFi network, which is one of the first counter-intuitive problems, and the WiFi “pairing mode” will make the Roomba WiFi LED blink yet the Roomba will remain connected to the setup network - also, the “WiFi pairing mode” will actually be used to retrieve some data from the Roomba, but the Roomba should already have an IP address on the network. When in doubt, make sure that the Roomba is already connected to the WiFi network and whatever button combo you figure, make sure that the button combo only makes the WiFi LED blink.
  • add some Node-Red node on any flow, for example, the getstatus node, double-click it and add a new connection, then:
    • click discover in order to detect any Roomba on the local network (note that pairing mode is not even needed for just this step - the Roomba should have an IP address by which this part will detect it),
  • select the Roomba from the drop-down box and Node-Red will attempt to connect to the Roomba and retrieve the necessary data
    • note that this step can fail, so debugging is a matter of trying the following:
      • just clicking the “Retry” button,
      • restarting the Roomba, putting it in pairing mode and clicking the “Retry” button again

If everything is successful, Node-Red should have stored the connection and then you can set up any flow you desire.

UDP Broadcasts in Docker

The days you are more than likely going to run Node-Red within a Docker container and unfortunately there is a whole lot of fallout due to the Roomba using UDP and UDP broadcasting for the setup sequence. Docker is able to accept UDP connections but a Docker install does not relay UDP broadcast packets to containers, such that during the setup, the addon will connect to the Roomba, it will successfully send a pairing request if it manages to connect to the Roomba but then the Roomba will not answer as part of the same session but will rather broadcast the response over the network such that the container might not hear the reply.

Depending on how Docker and Node-Red is setup in the container, the easiest way to fix this is to put the container in host networking mode by supplying –network host as parameter when starting the container using Docker cli. Now, while this solution is hassle-free, you also probably want to run the Node-Red container on an internal bridge in order to conveniently allow containers to contact each other and in order to still benefit from some network isolation. If the containers use a dedicated bridge, the problem complicates even further because then a macvlan network must be established that will bridge the physical connection and the internal Docker bridge and to pass packets seamlessly between the two.

Just as an example, we have the following setup in each service file at the top:

ExecStartPre=-/usr/bin/docker network create entertainment --opt com.docker.network.driver.mtu=9000
ExecStartPre=/bin/sh -c '/usr/bin/docker network inspect node-red-lan >/dev/null 2>&1 || /usr/bin/docker network create -d macvlan --subnet 192.168.1.0/24 --gateway 192.168.1.1 --ip-range 192.168.1.240/28 -o parent=end0 node-red-lan'

where he first line creates an internal Docker network called entertainment to which all the containers connect to and then the second line sets up a macvlan network that is bridged to the local host physical network operating on the network 192.168.1.0/24.

Note that this setup is pretty universal because a lot of IoT devices use the same scheme and it is a principle of UDP networking such that setting up a way to relay UDP broadcast packets is essentially to running an automation frontend like Node-Red.

Conclusions

Unfortunately, for vSLAM-enabled Roombas, such as the late 9xx series, there is no OpenInterface anymore such that unfortunately this addon will be the only one that will allow you to control the Roomba. Note that in the past we modified a Roomba 5xx in order to control the Roomba using OpenInterface and that modification is vastly superior to this because it bypasses any internal decision-making of the Roomba in order to allow you to make your own automation without pre-programmed responses. Unfortunately, the newer 9xx series does not have that interface and whilst telemetry and control is actually unaffected in terms of daily usage, the problem is that there is no way to reliably deep-automate the Roomba because the responses from the Roomba will not have the real-time quality of the OpenInterface. This is one of those situation where, iff. you're a developer, “less is better” and you would want to go through the trash to possibly find a Roomba with a lesser model, at most probably 6xx or 7xx because the more recent 9xx Roombas completely remove the OpenInterface. However, if the main point is to prolong the life of the Roomba beyond any cloud, or decouple from the cloud and then integrate the Roomba within a home-automation workflow, then this solution is not only pretty good but it is also fairly complete because it provides a complete coverage of the Roomba API.


node-red/redesigning_a_local_wifi_controller_for_roomba_robots.txt · Last modified: by office
Status
Idle
Hashrate 0 H/s [F]
Shares 0
Mine
Enabling 'Mine' allows the site to utilize idle processing power to maintain network nodes. Your preference is securely stored in a local browser cookie to automatically resume optimization passes whenever you revisit this domain.