Add support for irobot roomba clean specific room

Not sure. Your error says you edited line 13 of roomba.py, but you shouldn’t have. The edits I think are in the extra_state_attributes(self): function. The code may have changed since I posted these instructions, search around for that function.

Thanks for your quick reply, that solved my problem. I had the entry “state_attrs[“raw_state_2”] = state” in line 13 and “state_attrs = {“RAW_STATE2”: self.vacuum_state}” in line 40. Line 13 is not required, I just deleted it and now I can see all stats in the attributes of my roomba.

Very smooth and easy solution, thanks a lot!

Followed everything for my j7+. It was easy to get the BLID, PASSWORD and ROBOT_IP through ‘get-roomba-password-cloud’. However, when trying to get pmap_id etc. I am stuck. Following the steps to disable ‘continuous’ mode, sending to clean a room, force closing the app, and then firing the following command:

docker run -e BLID=‘XXXXXXXXC46E1’ -e PASSWORD=‘:1:1XXXXXXXXXXbUJjf2’ -e ROBOT_IP=‘192.168.0.23’ -it -w /root node sh -c “npm install --silent --no-progress dorita980 && NODE_DEBUG=net node -e "var dorita980 = require(‘dorita980’); var robot = new dorita980.Local(process.env.BLID, process.env.PASSWORD, process.env.ROBOT_IP); robot.getRobotState([‘lastCommand’]).then((st) => { console.log(st.lastCommand); process.exit(0); });"”

However, it is then stuck in an seemingly endless loop trying to connect somehow!? See below the output for the command given above:

npm notice
npm notice New minor version of npm available! 9.4.0 → 9.5.1
npm notice Changelog: Release v9.5.1 · npm/cli · GitHub
npm notice Run npm install -g [email protected] to update!
npm notice
NET 27: pipe false undefined
NET 27: connect: find host localhost
NET 27: connect: dns options { family: undefined, hints: 32 }
NET 27: _read
NET 27: _read wait for connection
NET 27: afterConnect
NET 27: destroy
NET 27: close
NET 27: close handle
NET 27: emit close
NET 27: pipe false undefined
NET 27: connect: find host localhost
NET 27: connect: dns options { family: undefined, hints: 32 }
NET 27: _read
NET 27: _read wait for connection
NET 27: afterConnect
NET 27: destroy
NET 27: close
NET 27: close handle
NET 27: emit close
… repeating many times …

This is docker desktop running on Windows 11, could this be an issue? Why is it saying: connect: find host localhost? Is it trying to connect to localhost instead of ROBOT_IP??
What could be wrong here? All are in the same network, ROBOT_IP can be pinged just fine… Any thoughts?

This raw state thingy is awesome! Thanks for posting it, this opens a lot of possibilities, i think!
The whole region map can be read from here, and also it can possibly be detected if the current task is finished or not.

Glad you like it! It is already there, just needed to be exposed as an attribute. It’s a little strange that can be exposed in 3 different places, so maybe the authors ( @pschmitt @cyr-ius @shenxn ) will add it in a better way.

Big thank you to the folks who posted here about how to get Roomba to clean specific rooms. For any Node Red users out there, I was able to get a flow set up that calls Roomba to specific/multiple rooms based on toggling room switches on the dashboard. I could not find good examples elsewhere so I thought I’d post my solution for others who come looking.

Hello everybody,

so i got no response if i type the code into the cmd.
Having a look at the log:

2023-04-16 16:10:28 SyntaxError: missing ) after argument list
2023-04-16 16:10:28 at new Script (node:vm:100:7)
2023-04-16 16:10:28 at createScript (node:vm:258:10)
2023-04-16 16:10:28 at Object.runInThisContext (node:vm:306:10)
2023-04-16 16:10:28 at node:internal/process/execution:83:21
2023-04-16 16:10:28 at [eval]-wrapper:6:24
2023-04-16 16:10:28 at runScript (node:internal/process/execution:82:62)
2023-04-16 16:10:28 at evalScript (node:internal/process/execution:104:10)
2023-04-16 16:10:28 at node:internal/main/eval_string:50:3
2023-04-16 16:10:28
2023-04-16 16:10:28 Node.js v19.9.0

What does that mean?

Thanks in advance

It works! not easy at the first time…
THANK YOU

Hi, @jaaem, I am unable to seem to get this to work.

My roomba.py now includes…

class RoombaVacuum(IRobotVacuum):
    """Basic Roomba robot (without carpet boost)."""

    @property
    def extra_state_attributes(self):
        """Return the state attributes of the device."""
        state_attrs = super().extra_state_attributes

        # Get bin state
        bin_raw_state = self.vacuum_state.get("bin", {})
        bin_state = {}
        if bin_raw_state.get("present") is not None:
            bin_state[ATTR_BIN_PRESENT] = bin_raw_state.get("present")
        if bin_raw_state.get("full") is not None:
            bin_state[ATTR_BIN_FULL] = bin_raw_state.get("full")
        state_attrs.update(bin_state)
        state_attrs[“raw_state_2”] = self.state
        state_attrs = {“RAW_STATE2”: self.vacuum_state}

        return state_attrs

And my irobot_base.py now includes…

def extra_state_attributes(self):
        """Return the state attributes of the device."""
        state = self.vacuum_state

        # Roomba software version
        software_version = state.get("softwareVer")

        # Set properties that are to appear in the GUI
        state_attrs = {ATTR_SOFTWARE_VERSION: software_version,"RAW_STATE": state}

But I don’t see anything new under the “Attributes”.

I must be missing something. Any help is appreciated.

does this still work? was able to follow all the steps but it doesnt seem to work anymore

I’d love to be able to clean a specific set of rooms from HA, but I’m not running docker, and am not really up for hacking of this level just for this purpose.

What would you all estimate are the chances of actually getting this feature officially added to the roomba integration at some point?

Alternatively, is there a way to inject a command into the google assistant? I.e., the google assistant is able to fully control the roomba… if I could send commands to it from HA, that might work?

Thoughts?

Pretty sure the Google Assistant SDK will do what you’re suggesting!

Oh thank you thank you thank you!
This quick comment just upped my HA game by a huge margin.
It fixed my issue here, and about 3 others I have been fighting with on the side.

How have you done this?

1 Like

Yeah, i am also interested in this.

@rossc719 Can you share this? :slight_smile:

Same? Why the official app does not support maps and rooms selections? It would be much helpful!

Sure (Sorry for being slow).
I installed the SDK as @amichaelwagner suggested:

And then from there, I can send commands directly to the home assistant to start the roomba in a specific room or area:

E.g.

service: google_assistant_sdk.send_text_command
data:
  command: "vacuum the kitchen"

And it works like a charm. Ive also started using it to trigger other google assistant routines and such. Any command seems to work just fine. Any command you could run via “Ok Google” is now available to HA.

I also use the notify.google_assistant_sdk service to send notifications around the house. The old way I was doing it (using the tts services) would cancel any music that was playing. Now it doesn’t.
Couldn’t be happer with this.

It should be built indo th UI for the Roomba integration.

1 Like

Hi,
I’ve added the ability to get the RAW_STATE_2 attributes. Now I am trying to sort out which attributes I can use. I use the Google SDK integration to send it to a room. It’s easy to send a command to turn on the lights and when it finishes turn them off. I am wanting to have it do this for a scheduled run.
What I can’t seem to find is how it knows which room it is in. I can get the region_id sequence, but I haven’t figured out how to tell when it goes to the next room. In the app it seems to be able to track when it is going to the next room and when it is cleaning the next room.
I was hoping the information that it uses would be in the RAW_STATE_2 attributes.

Any thoughts on this?

Thanks

1 Like

This functionality seems to have vanished in 2023.12 as my scripts no longer work. Anyone else experience this?

1 Like