No module Published on Offcanvas position

Getting Roomba status and push to Domoticz

I tried using the REST980 plugin for Domoticz but it kept crashing every day and I got tired of it.
Instead of sifting through another man's code and finding the error I might as well leverage the API's to do my thing.

First I need the status of the robot vacuum's pushed to Domoticz so it can do it's thing.

There are two REST api's we'll be using: Domoticz and REST980.
Therefore it's important that you already have REST980 already installed on a VM, the machine itself or one or more dockers.
This method will support multiple vacuum's or a single one, it doesn't matter.

The second thing you'll need is the User Variables already setup in Domoticz, you can find this option under Setup > More Options > User Variables
These will the locations where the Domoticz API will write the vacuum status values to.
Give the variable any name you want and take note of it, make sure the Variable type is String.

REST980 produces everything JSON format. If you know how to write scripts Python that parses JSON data, then that's all you need to do.
Step by step:

  1. Read the JSON data from REST980
  2. Parse the data
  3. Push the data to Domoticz User Variables

In case you don't know how to do it, i've written a script here.

There are a few things you need to change for your own use:

#Roomba devices

devices = ["http://192.168.1.1">http://192.168.1.1:3001/api/local/info/state","http://192.168.1.1">http://192.168.1.1:3000/api/local/info/state","http://192.168.1.1">http://192.168.1.1:3002/api/local/info/state"]

 Add/Remove devices and change the IP address to the machine that hosts REST980. By default the first portnumber is 3000 when you install REST980.


if name == "Downstairs":
domoticzurl = "http://127.0.0.1">http://127.0.0.1:8080/json.htm?type=command&param=updateuservariable&vname=RoombaDownstairsStatus&vtype=string&vvalue=" + status
calldomoticz(domoticzurl)


If you only have one device, change the if name == "Downstairs" line to the name you gave your Roomba. You can find in the Roomba App for example.
In the domoticzurl line, after vname= change the name to the name of the variable you created in Domoticz.
If you have more devices, copy the same 3 lines.

It's a simple script that loops through all the devices you enter in the devices variable.

Update 17-01-2022:
I've updated the script so I can update the Selector Switches in Domoticz based on the status of the Roomba compared to the status that's in Domoticz in the User Variable. 
The selector switch allows me to start and dock the roomba by sending HTTP commands using the REST980 API, but I also added extra switches that show me if the Roomba has stopped or is running. 

Changing the switch can be done with this line, you just have to find the IDX in your own domoticz
http://127.0.0.1">http://127.0.0.1:8080/json.htm?type=command&&parm=switchlight&idx=803&switchcmd=Set%20Level&level=0
I have the Pushsafer API added as well just to notify me when the Roomba is running or stopped. Pushsafer isn't exactly free, but not expensive either. Also works with Blocky in Domoticz.