Sending Roomba to specific rooms

I’m new to Node-Red and super excited by what it can do! I’m working to get my Roomba vacuums automated and am a bit stuck. I’m using the official iRobot Integration and have all my vacuums into HA and responding to commands. I have successfully discovered the room ids that my Roomba uses and am now trying to send it to a specific room. I have been able to successfully use the follow parameters in the service dev tool using a Vacuum: Send command to send my Roomba to the correct room.

pmap_id: iiNOTREALpkwEOn
regions:
  - region_id: "17"
    type: rid
user_pmapv_id: 22NOTREAL38

I am now trying to get this same command into a call service node in Node-Red. I am using JSON data with the code below. This call service node as configured will start up my vacuum, but it will not direct Roomba towards a specific room but rather just turn on and start vacuuming. Am I translating the command from the service dev tool to Node-Red incorrectly? I’ve done my best to search the forums for an answer, but I’m at a dead end. Any thoughts would be much appreciated.

{
    "command": "start",
    "params": {
        "pmap_id": "{{msg.pmap_id}}",
        "regions": [
            {
                "region_id": "17",
                "type": "rid"
            }
        ],
        "user_pmapv_id": "{{msg.user_pmapv_id}}"
    }
}

As per the Mustache Templates documentation, you should exclude the “msg.” part - so rather than {{msg.pmap_id}}, you would use {{pmap_id}}.

Generally I prefer to set the data in a change node before the call service. Then you can stick in a debug node (showing ‘complete msg object’) to ensure you’re getting what you expect.

Thanks Michael, that was it. No “msg.” prefix in the JSON editor. So many things to learn! I do have my sequence proceeding from a change node into the call service node, so at least I’m doing some things right :slight_smile:

How are you getting the region_id and other info? Using your code I can make it start, but not in a room.

When I use the commands above it starts and says “Vacuuming : new space” so it seems to be working, just doesn’t know where to go.

The process of determining the region_id and pmapv_id is pretty cumbersome. You need to run a bunch of commands in a Linux terminal. The process is outlined here. The key for me was making sure you uncheck “Continuous” in your iRobot integration configuration and close the app on your phone, otherwise your command line will not execute.

Would it be possible for you to share this particular flow? When I try to send the call service, I receive the following error:

“Call-service error. extra keys not allowed @ data[‘command’]”

Pulling my hair out over this one. I managed to obtain the region_id and pmapv_id, but I cannot make the service call do what is needed.

Here is the information fro the SSH (slightly redacted).

Here is the Call Service Node (slightly redacted)

… and here is the JSON

{
    "command": "start",
    "params": {
        "pmap_id": "XXXXz7glTL2YawbM—64yUw",
        "regions": [
            {
                "region_id": "7",
                "type": "rid"
            }
        ],
        "user_pmapv_id": "23XXXT221758"
    }
}

Whether in Node Red or using a call Service Node, the vacuum just vacuums everywhere and not in the intended room (Master Bathroom).

Lastly, I see a ‘favorite_id’ parameter that seems to do nothing when input into the call service or into node red, but I suspect that this aligns with my Roomba favorites.

Has anyone had the ability to use HA to call a favorite (because that would be the easy button).

Hey, sorry this flow is causing you such a headache. It was a lot of effort to set it up, but it’s been working reliably for me since I set it up a year ago.

Here’s my overall Node Red Flow:

The lux values and vetoes are for my lights (I turn them on for the vacuum when its dark outside).

I use this join node to combine region ids:

I use a change node to assign the user_pmapv_id and pmap_id.

The room count switch node determines whether I’m sending the Roomba to single or multiple rooms.

Here is what I do for single rooms:

Call Service Node:

JSON:

Here is what I do for multiple rooms:

Call Service Node:

JSON:

I hope that helps. If you need more detail, let me know.

Yes, would you mind simply exporting your flow.

My flow is much simpler, but something is wrong with the JSON because when I run the call service, the Roomba App throws an error that says ‘Roomba Battery Not Detected’. Then the app saves the map and nothing happens.

Thank You,

Here is my flow:

`[{"id":"653b6982271361fe","type":"server-state-changed","z":"99dc8ef930de5404","name":"Office Lights","server":"6e751b1b.8f17c4","version":5,"outputs":2,"exposeAsEntityConfig":"","entityId":"light.office_main_lights","entityIdType":"exact","outputInitially":false,"stateType":"str","ifState":"off","ifStateType":"str","ifStateOperator":"is","outputOnlyOnStateChange":true,"for":"15","forType":"num","forUnits":"minutes","ignorePrevStateNull":false,"ignorePrevStateUnknown":false,"ignorePrevStateUnavailable":false,"ignoreCurrentStateUnknown":false,"ignoreCurrentStateUnavailable":false,"outputProperties":[{"property":"payload","propertyType":"msg","value":"","valueType":"entityState"},{"property":"data","propertyType":"msg","value":"","valueType":"eventData"},{"property":"topic","propertyType":"msg","value":"","valueType":"triggerId"}],"x":130,"y":740,"wires":[["e831f689b67de127"],[]]},{"id":"e831f689b67de127","type":"weekday","z":"99dc8ef930de5404","name":"Sunday","sun":true,"mon":false,"tue":false,"wed":false,"thu":false,"fri":false,"sat":false,"x":320,"y":740,"wires":[["621048956dc57b63"],[]]},{"id":"621048956dc57b63","type":"api-call-service","z":"99dc8ef930de5404","name":"Vacuum Office","server":"6e751b1b.8f17c4","version":5,"debugenabled":false,"domain":"vacuum","service":"send_command","areaId":[],"deviceId":[],"entityId":["vacuum.gym"],"data":"{\"command\":\"start\",\"params\":{\"pmap_id\":\"4z7_8kMfS5CHwu7wn6RD0A\",\"regions\":[{\"region_id\":\"O3\",\"type\":\"rid\"}],\"user_pmapv_id\":\"221024T101635\"}}","dataType":"json","mergeContext":"","mustacheAltTags":false,"outputProperties":[],"queue":"none","x":680,"y":720,"wires":[[]]},{"id":"6e751b1b.8f17c4","type":"server","name":"Home Assistant","version":5,"addon":true,"rejectUnauthorizedCerts":true,"ha_boolean":"y|yes|true|on|home|open","connectionDelay":true,"cacheJson":true,"heartbeat":false,"heartbeatInterval":30,"areaSelector":"friendlyName","deviceSelector":"friendlyName","entitySelector":"friendlyName","statusSeparator":"at: ","statusYear":"hidden","statusMonth":"short","statusDay":"numeric","statusHourCycle":"h23","statusTimeFormat":"h:m","enableGlobalContextStore":true}]`

jsteele and others…
I have a build very similar to yours. Worked great until January. Now when I pick my targets, my Roomba chirps but never leaves the cradle.
If I do a straight button launch from Home Assistant, it seems to work as expected.
Does your Node-Red run still work? I am assuming the issue is in the JSON.
A “last.command” dump from the Roomba looks fine. It just never goes on the run.
Is yours still working?

Didnt work for me either the above flow with my roomba J9+. After I deleted the user_pmapv_id from json (it isn’t needed anymore cause is is just a timestamp) it worked flawless!

{
“command”: “start”,
“params”: {
“pmap_id”: pmap_id,
“regions”:
($map(region_id, function ($e) {
{
“region_id”: $e,
“type”: “rid”
}
}))
}
}