Python script for roomba j9+

I would like to run my script by everyone, I would love to know if there are stuff I can improve/make easier.

Context:

I bought a robot vacuum (roomba j9+ from irobot), and since a recent(?) release the maps are not available anymore from the local api. My goal was to cut it from the internet, for multiple reasons (privacy, still want to use it if the internet is down, …). So I managed to get the blid, password, map id and region ids (initially setup/created from the irobot app) by using dorita980 (awesome project btw).

My setup:

So from that, and some testing, I created a script that triggers a new job from a list of regions/zones.

In order to do that, I had to create a toggle for each regions/zones, meaning I have 8 regions + 2 zones. When the script runs, if the toggle is on, then it will clean that room and turn the toggle off. That also means in the script I have a similar list of regions/zones with the corresponding id. On top of than I have the same list, also as toggles, in order to vacuum only, or vacuum + mop. So now I have to maintain 3 lists (I mean they should not change, but still, not optimal).

Now this script can be triggered manually on it’s own, all good, but I also have an automation based on calendar events, that automatically turn on some rooms and start the cleaning (plus some additional checks and notifications).

In order to match the features of the robot, I’ve created a bunch of toggles/dropdowns so anything can more or less match what the irobot app is doing (scrubbing, fan speed, number of pass, …)

So in the end I have:

  • 1 script
  • 10 toggles for cleaning a room
  • 10 toggles for mopping it
  • 1 extra toggle or dropdown for each additional settings (total of 4 + 2 I hardcoded as I don’t need them)

It works just great, but is there any way to have something easier to setup? Anyone came up with something better?

I’d love to have some feedback :slightly_smiling_face:

Here’s the python script for anyone interested: https://gist.github.com/po8rewq/b99c16b4f1452d1fcd88aeb5669cc37f

Great job on the script and lovelace.

I tried to make it work properly, is there any chance you would be able to share the lovelace and automation?

Thanks! I wrote a quick tutorial on my website, you can see how it’s displayed on the dashboard, and how the automation runs (nothing fancy) here.

Hello, I have 2 beginner questions. How can I integrate the script? How can I install npm or Docker on HA?

That’s how you use python scripts: Python Scripts - Home Assistant
You don’t need npm or docker on HA, just run those steps locally to get the different IDs and then you’re done with that.

Sadly, does not work. Would you care to elaborate a little bit please? I had a i7 roomba without mop working and integrated correctly, but the j9+ seems to mop the whole house by default using this script and i cant seem to find whats the problem. my wild guess is the params structure, but i dont have a clue. Could you care to tell me where did you obtain the message structure for the roomba service call?

I’d been trying for days, i’d appreciate so much…Thank you very much!

Hello, have you managed to integrate the robot ???

You need to get the region_id from the official app: you start the job to a specific room, then use dorita980 to get the ids. Those ids needs to be specified in the script.
See my full post here, everything I’ve done is explained, I didn’t do anything more than that.

I have a j9+ (only vacuüm not the combo). Ik wil try your script within a week.

I would love to use this script but I get an error


dorita980.Local is not a constructor

I retrieved de BLID and password and just wanted to use the roomba locally as I cannot get the j9+ to work trough the integration (is that even possible?)

Hello,

in your guide at 2.4
### Install the iRobot extension

Add the officiel HA integration for iRobot (here) and log in to your robot using the credentials.

It is for me and other impossible to login/connect to the j9+ wit home assistant. Older models connect without any problem.
look at this thread: Roomba Intergration - Unable to connect to Roomba · Issue #94419 · home-assistant/core · GitHub

EDIT: figured it out with the local API, working as a charm!