iRobot Roomba i7+ Configuration using Rest980

Yes you need to delete this file for it to use the js version.

I have the check-button-card forked so you can actually specify this as a custom HACS repository rather than copying the files manually. Same with the Roomba card.

The dev has merged my PR but has not yet issues a new release (so it’s not updated in HACS yet) once it’s offical I’ll submit a PR to get Roomba vacuum card added to the default repo also

I spoke to the developer about adding an option to show the due date (based on visibility time / timestamp) rather than last done - so watch this space :+1:

Thanks @Syrius,
when I saw commit value my brain just went into “git checkout …”
different git repos having the same commit value didn’t cross my mind.

I’ve uninstalled the check-button-card, and added your repos check-button-card
and re-installed it.

Humbly learned a lot from this experience.

-MQTT explorer is a great free tool to troubleshoot mqtt messages.
-never assume anything.
-mqtt entities are very resilient from being deleted
until you find they were published with RETAINED.

I look forward for the visibility_time (due date) being displayed.

thanks for all the help.
/Pierre

1 Like

In case anyone else is interested in aligning vacuum cleaning path with floor plan of your home.
I went to wikipedia for rotation of axes formula, found x’ and y’ equations.
my roomba consistently gives x,y data that is about 2.5 degrees rotated clockwise, don’t know why.
the formula from wikipedia is for counter-clockwise, hence I used -2.5.


snippet from wikipedia
“rotates the xy axes counterclockwise through an angle θ into the x’y’ axes”

here’s an image of vacuum cleaning path with original data

here’s the same vacuum.log data with just these 3 lines of code.

$rot_angle_in_degrees = -2.5;
$x=($x*cos(deg2rad($rot_angle_in_degrees))+$y*sin(deg2rad($rot_angle_in_degrees)));
$y=(-1*$x*sin(deg2rad($rot_angle_in_degrees))+$y*cos(deg2rad($rot_angle_in_degrees)));

for myself I tweaked scale of x’ and y’ calculated values and added another x’ and y’ offset

$rot_angle_in_degrees = -2.5;
$scale=0.97;
$xp_offset=35;
$yp_offset=0;
$x=$xp_offset+($x*cos(deg2rad($rot_angle_in_degrees))+$y*sin(deg2rad($rot_angle_in_degrees)))*$scale;
$y=$yp_offset+(-1*$x*sin(deg2rad($rot_angle_in_degrees))+$y*cos(deg2rad($rot_angle_in_degrees)))*$scale;

I put the new calculated $x, $y code after ($theta = $split[2]) in image.php, around line 112

$x = $split[1]+$x_offset;
$y = $split[0]+$y_offset;
$theta = $split[2];

you can put the setup values near the top.

1 Like

Thanks @pnakashian great work… Finally I manage to align vacuum cleaning path with floor plan.
Before, with original image.php:

After, with your code and parameter adjustment;

I have also one question. For Roomba 980 hence it doesn’t have individual Room cleaning feature is it possible somehow within Frontend setting the type of cleaning (All, kitchen, bedroom…) and then after placing Roomba to the specific location and pressing CLEAN on the robot to have vacuum map aligned to specific room with different parameter setup (x,y, scale,offset) depending on boolean value which represents a specific room.

I’ll try to answer this question as best as I can.

if you were planning to put the roomba 980 into a room press clean then close the door behind it.
I suppose you can pass a flag to image.php I don’t code PHP, but I’ve seen Jeremy’s code in configuration.yaml shell_command

vacuum_clear_image: curl -X GET -s -O /dev/null '{{ states("input_text.vacuum_map") }}?clear=true'
vacuum_generate_image: curl -X GET -s -O /dev/null '{{ states("input_text.vacuum_map") }}?last=true'

he passes clear=true, and last=true into image.php

inside the image.php he uses isset($_GET['clear']) and isset($_GET['last']) to get values
you can do something similar without having to get room Xprime, Yprime boundary min/max values.

Another way is to obtain X prime, Y prime boundary values as the roomba enters a specific room using the wikipedia formula. Because of the rotation on the original X,Y data, you can’t use the original X,Y data to obtain a pair of X boundary min/max values or a pair of Y boundary min/max values when entering a room.

You can do this watching in home assistant gui X prime, Y prime value as roomba crosses into that room.

add the following script below into lovelace markdown card
you’ll see in realtime the transformed Xprime, Yprime values

{% set x = state_attr('sensor.rest980', 'pose')['point']['x'] %},
{% set y = state_attr('sensor.rest980', 'pose')['point']['y'] %},
{% set rot_angle_in_degrees = -2.5 %}
{% set scale=0.97 %}
{% set xp_offset=35 %}
{% set yp_offset=0 %}
{% set xp=xp_offset+(x*cos(rot_angle_in_degrees*pi/180)+y*sin(rot_angle_in_degrees*pi/180))*scale %}
{% set yp=yp_offset+(-1*x*sin(rot_angle_in_degrees*pi/180)+y*cos(rot_angle_in_degrees*pi/180))*scale %}

origX, origY {{ x, y }}

Xprime,Yprime {{ xp, yp }}

once you get room boundary Xprime, Yprime values you can put in
if -else if logic inside image.php around line 112, after my previous code snippet where x,y values were recalculated.

your top left room for instance would have php if else like this

if ($x>=$x_room1_boundary_min && $x<=$x_room1_boundary_max
&& $y>=$y_room1_boundary_min && $y<=$y_room1_boundary_max) {
//here you can fine tune and add room specifix X_offset, Y_offset, scale
}

1 Like

Thank you for your suggestions. But, after removing Roomba 980 from Dock and placing it to desired Room for cleaning the coordinates are (0,0,0) at the beginning so comparing to X-Y boundary values for specific room identifications will not work. I think I will somehow use input_booleans to set the “flag” which Room I plan to clean so the cleaning map should be placed correctly to my floorplan after using correct set of parameters (angle, offset, scale…)

Just got software update 3.2.9… Everything still appears to be working but can’t see any release notes for it yet :thinking:

Hi @Syrius
I think your repo
jeremywillans/check-button-card has visibility_timestamp broken, there have been a few commits since e80ef56, latest commit now is 68e4549. When I switched to your repo I had already created the entities and didn’t single click the check-button entity until I had to perform maintenance today.
The entities already created from commit e80ef56 will still have visibility_timestamp attribute even after upgrading the code.

Only after single clicking the check-buttons the attribute visibility_timestamp goes away with latest code. Since the HACS plugin install for jeremywilans/check-button-card doesn’t let you choose version or commits, I reverted it manually downloading the e80ef56 .js and creating .js.gz from it in the /config/www/community/check-button-card folder. I got visibility_timestamp back now.

I’m at HA version 0.105.5 in case you don’t see an issue in your config.

/Pierre

1 Like

Try using master for the version in my repo, however dont touch it if you have a workaround :rofl:

I’m in the process of updating my repo to use the new timeout_timestamp option which the proper check-button-card now uses - just waiting for one last PR to be merged to fix an outstanding issue

Got some new updates coming also… Watch this space!! :partying_face:

First off, thank you for all the hard work.
I am trying to get this to work and having issues. I am trying to do this without docker so everything is manually installed downloaded and configured.
I have the robot-vacuum-card working. It updates with information and I can start and stop my roomba (s9+)
My issues is that the clean individual rooms is not working.
This is the contents of my secrets.yaml (maps are not working either but I will focus on that later)

vacuum_state:  http://192.###.#.###:3000/api/local/info/state
vacuum_action: http://192.###.#.###:3000/api/local/action/
vacuum_verify_ssl: false
vacuum_map: http://192.###.#.###:4123/image.php
vacuum_pmap_id: 2F8WoQ#######QyOE9UA
vacuum_user_pmapv_id: 200####222327
vacuum_family:  '{"region_id": "1","region_name": "Family Room","region_type": "family_room", "type": "rid"}'
vacuum_dining:  '{"region_id": "9","region_name": "Dining Room","region_type": "dining_room", "type": "rid"}'
vacuum_kitchen: '{"region_id": "7","region_name": "Kitchen","region_type": "kitchen", "type": "rid"}'
vacuum_foyer:   '{"region_id": "12","region_name": "Foyer","region_type": "foyer", "type": "rid"}'
vacuum_hallway: '{"region_id": "15","region_name": "Hallway","region_type": "hallway", "type": "rid"}'
vacuum_living:  '{"region_id": "11","region_name": "Living Room","region_type": "living_room", "type": "rid"}'
vacuum_utility: '{"region_id": "16","region_name": "Utility","region_type": "laundry_room", "type": "rid"}'
vacuum_breakfast: '{"region_id": "17","region_name": "Breakfast Room","region_type": "breakfast_room", "type": "rid"}'

I am running rest980 and getting output that status is being run but I never see the

GET /api/local/info/state 200 100.559 ms - 3420
GET /api/local/info/state 200 100.511 ms - 3420
GET /api/local/info/state 200 100.519 ms - 3420
GET /api/local/info/state 200 100.521 ms - 3420
GET /api/local/info/state 200 100.541 ms - 3420
GET /api/local/info/state 200 100.541 ms - 3420
GET /api/local/info/state 200 100.709 ms - 3420
GET /api/local/info/state 200 100.541 ms - 3420
GET /api/local/info/state 200 100.523 ms - 3420
GET /api/local/info/state 200 100.529 ms - 3420
GET /api/local/info/state 200 100.653 ms - 3420

But I never see the /api/local/action

I have looked through the vacuum.yaml file and changed all of the section in there that refer to the different rooms. I think it comes down to the automation not firing
In looking through the code I cannot find where initiate_vacuum_clean event gets notified. What am I missing?


automation:
  # Initiate Selective Room Clean
  - alias: Vacuum Clean Rooms
    hide_entity: true
    trigger:
    - platform: event
      event_type: initiate_vacuum_clean       
    action:
      - service: rest_command.vacuum_clean
        data_template:
          payload: >

Hi @batlin, thanks :blush:

In the Lovelace.yaml file the button card calls the Automation. Can you please check/verify that is configured correctly?

Hi there!

Very nice write up!

I have a Roomba 960 and running home assistant on a Raspberry pi 3B.
The built in Roomba component works, but I’m missing some features I would like to play with.
If I am correct this addon should work for my 960 as well right? (except room cleaning and other not supported features). I see in the readme that this is for amd64 systems only, but the following is mentioned:

Would be nice if I can get the map to work.

Furthermore, I looked into the code on github, but I cannot find if it is possible to send Raw commands?
I would like to play around with some RAW commands, because of multiple reasons:

  • My base is located under a closet. I would like to get the Roomba to drive from underneath when the bin is full, so it is easier to empy. I tried using the original component with clean, but that doesn’t work as the Roomba doesn’t accept new missions when the bin in full.
  • I would like to create my own “room cleaning” feature like SuperMario wants, but for that to work the Roomba needs to be able to drive said room first

I have found some commands here, I think the are for a iRobot Create 2. But it might give some pointers to additional commands?
With the original Roomba component I seem to be unable to send Raw commands (see my post here, no answers yet though)

Thanks in advance!

If you use HA (formerly HASS) the addon works on RPi :blush: if you use HA Core then you will need to build the rest980 image locally as there isn’t an arm image on docker hub.

I’ll amend the readme when I get a chance!

I don’t think this is possible through rest980, but you might have more luck with the underlying Nodejs package dorita980? however I think know if that ability exists :grimacing:

Anyone had luck getting it to work with roomba 980?

And how to?

What are you trying to get work? I couple of the guys on here @SuperMario @ddppddpp have that model.

AFAIK live mapping working, but selective cleaning does not

hei. i istalled the hassio addon. and i get this when i try to enter blid and pw.

Failed to save addon configuration, not a valid value for dictionary value @ data[‘options’]. Got {‘BLID’: 31742416890, ‘PASSWORD’: ':1:1565096:K6DowgNVQAynokui’, ‘ROBOT_IP’: '******’, ‘FIRMWARE_VERSION’: ‘2’}

BLID: 3175000890"
PASSWORD: :1:
***:K6DowgNVQAynokui
ROBOT_IP: ***********
FIRMWARE_VERSION: ‘2’

[email protected] start /usr/src/app
node ./bin/www
/usr/src/app/node_modules/dorita980/lib/v2/local.js:33
throw e;
^
Error: Connection refused: Not authorized
at MqttClient._handleConnack (/usr/src/app/node_modules/mqtt/lib/client.js:920:15)
at MqttClient._handlePacket (/usr/src/app/node_modules/mqtt/lib/client.js:350:12)
at work (/usr/src/app/node_modules/mqtt/lib/client.js:292:12)
at Writable.writable._write (/usr/src/app/node_modules/mqtt/lib/client.js:302:5)
at doWrite (/usr/src/app/node_modules/readable-stream/lib/_stream_writable.js:428:64)
at writeOrBuffer (/usr/src/app/node_modules/readable-stream/lib/_stream_writable.js:417:5)
at Writable.write (/usr/src/app/node_modules/readable-stream/lib/_stream_writable.js:334:11)
at TLSSocket.ondata (_stream_readable.js:558:20)
at emitOne (events.js:96:13)
at TLSSocket.emit (events.js:188:7)
at readableAddChunk (_stream_readable.js:176:18)
at TLSSocket.Readable.push (_stream_readable.js:134:10)
at TLSWrap.onread (net.js:559:20)
npm ERR! Linux 4.19.93-v7l
npm ERR! argv “/usr/local/bin/node” “/usr/local/bin/npm” “start”
npm ERR! node v6.17.1
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: node ./bin/www
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script ‘node ./bin/www’.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the rest980 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs rest980
npm ERR! Or if that isn’t available, you can get their info via:
npm ERR! npm owner ls rest980
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /usr/src/app/npm-debug.log

I don’t believe this needs quotes on the end?

The fist error is without anything.
The second post is with

I just tested on my dev HA (hass) instance, and it put single quotes around the password.

Can you try with that and see?