Roomba JSON Commands

I have a few Roombas laying around and they all integrate beautifully into HA.

Is there a way to insert JSON commands to instruct a Roomba to clean a specific area/room?

Over three years late, so I admit this is a major thread necro, but since nobody else has replied, I’m going to add my notes on this topic.

Firstly, I’m not using HomeAssistant myself, instead I’m using another home automation solution and using koalazak’s rest980 Node.js solution to control my Roomba locally.

Do a search for “koalazak github rest980” to find it.

I also found it useful to keep his dorita980 package handy, although I don’t think it’s absolutely necessary for the following process.

Do a search for “koalazak github dorita980” to find it.

I found the following works for me. I got rest980 set up and running, and made sure it was working with the following command:

curl http://<ip address of rest980 server>:3000/api/local/info/state

You’ll know it’s working if you get a large blob of JSON back. Keep that command handy, you’ll be using it a bit. This will also be a lot easier if you have jq available.

Do a search for “github jqlang jq” to find it.

I had already mapped my house, and divided it up into multiple rooms. I then used the smartphone app to send the Roomba off to clean a single room. You have to close the smartphone app otherwise rest980 won’t work, but if you issue that .../info/state command while it’s cleaning the room, the data you care about is in the JSON blob. This is where jq comes in handy: if you execute it like this:

curl http://<ip address of rest980 server>:3000/api/local/info/state | jq .lastCommand

it’ll print out just the last command that was issued. That contains the exact JSON you’re looking for, it typically looks like this:

{
  "command": "start",
  "initiator": "rmtApp",
  "time": 1699932542,
  "pmap_id": "[redacted]",
  "regions": [
    {
      "region_id": "1",
      "type": "rid"
    }
  ],
  "user_pmapv_id": "[redacted]",
  "ordered": 1
}

When I send it back via the rest980 API, I just need the pmap_id, the user_pmap_id and the regions in the JSON blob I pass the to the http POST call. With Home Assistant, your actual mileage may vary, you might need the command as well. Assuming you can currently get it to clean your whole house, this ought to get you pointed in the right direction.