Add support for irobot roomba clean specific room

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

same problem

I’ve found a way to log the roomba commands to the home assistant log without needing to modify the roomba python files and add them to the custom_components folder.

Its possible to enable Debug logging for the existing roomba component using the Home Assistant logger
https://www.home-assistant.io/integrations/logger/

I added the following code to my configuration.yaml

# Logger:
logger:
  default: info
  logs:
    homeassistant.components.roomba: debug

This will now log out debug information when the roomba integration interacts with the robot. It will log out the IP address(es) of the robot(s) and all commands sent to the robot(s)

Restart Home Assistant.
Trigger a clean for the roomba via the Roomba app
Check the Home Assistant logs

2024-01-02 15:17:05.899 DEBUG (Thread-3 (_thread_main)) [homeassistant.components.roomba.irobot_base] Got new state from the vacuum: {‘state’: {‘reported’: {‘lastCommand’: {‘command’: ‘start’, ‘favorite_id’: None, ‘initiator’: ‘rmtApp’, ‘ordered’: 1, ‘params’: None, ‘pmap_id’: ‘TlX_nz0ZR1111111111111’, ‘regions’: [{‘params’: {‘noAutoPasses’: True, ‘twoPass’: False}, ‘region_id’: ‘6’, ‘type’: ‘rid’}], ‘time’: 1704208626, ‘user_pmapv_id’: ‘236573T123456’}}}}

The lastCommand object is logged out each time a new command is issued to the robot. E.g. start, pause, cancel etc.

This should work for both Roomba and Braava mops.

Once you have the id’s of all the rooms, then the logging level can be set back to default level to avoid filling the logs with unneeded log messages.

NOTE - if you have edited the python code for the roomba component and added the files to the custom_components folder, then you will need to delete this folder so that the default roomba component bundled with Home Assistant is used.

11 Likes

I’m interested in removing the manual steps involved here - take a look at my proposal

Thanks a lot for this. It worked really fine !

Thank you!!

Works like a charm, for me worked in the original way the first time, but last time (I needed to update the user map id and took me too much time, but today again updating the map id I was not able to do it in the old way. But with this option, it took me 2 minutes.

Thanks again.