iRobot Roomba i7+ Configuration using Rest980

Thanks - gald its useful for you! :beers:

At this stage there is no option to hide these attributes, but you could replace the contents with other items (override the Label and Attributes for those particular ones)

If you raise a issue on GH I’ll plan to address this in future.

I’ve had to work on some other stuff lately, but my intent (soon) is to roll the sensor-based approach here into a template vacuum, which can be used with the regular vacuum card as well. If I get it figured out, I’ll post it :grin:

Getting closer. A couple of questions.

  1. My cleanRoom is throwing a pmap_id error. If I compare the one in the error to my Rest980 sensor, it looks identical. Well, the key part (up to the colon part). I assume something parses the pmap keys for the pmap_id. Am I miss reading the error? Thoughts on what to check? I created a schedule to get the regions ID, I would think they would be the same, correct?
pmaps:
  - xxxxxxxxxxxxxxxxxx: 201209T195235
Logger: homeassistant.components.rest_command
Source: components/rest_command/__init__.py:136
Integration: RESTful Command (documentation, issues)
First occurred: 1:01:00 PM (4 occurrences)
Last logged: 2:01:14 PM

Error. Url: http://192.168.1.160:3000/api/local/action/cleanRoom. Status code 400. Payload: b'{\n "ordered": 1,\n "pmap_id": "xxxxxxxxxxxxxxxxxx",\n "regions": [\n unknown\n ]\n}'

2.I don’t have the map generating part down. Can the xxx.xxx.xxx.xxx:/images.php only generate the “latest.png” only after a clean? I was under the impression that I can delete latest.png and then call the images.php. Once I delete the latest.png I get PHP errors till another clean cycle is run. What am I missing?

EDIT:
I did a state query to compare to my secrets entry. I am doing the “Hallway Master Bedroom” because it is small and quick. The region does match my secrets entry.

CN":21},{"zh-HK":22},{"zh-TW":23}],"language":4,"lastCommand":{"command":"start","initiator":"rmtApp","time":1607545883,"ordered":1,"pmap_id":"xxxxxxxxxxxxx","regions":[{"region_id":"18","type":"rid"}],"user_pmapv_id":"201207T194520","event":null,"robot_id":null,"select_all":null},"lastDisconnect":2,"mapUploadAllowed":true,"missionTelemetry":{

VS

vacuum_hall_master_bedroom: '{"region_id":"18","type":"rid"}'

I did start down this path, but it looks as though the vacuum template is limited in its fields and the options available in the field, soo… i deemed it low priority.

Example -

Defines a template to get the state of the vacuum. Valid value: docked / cleaning / idle / paused / returning / error

looks like your regions arent being correctly added to the clean command.

The ordered list is build in input_text.vacuum_rooms when you enable/disable the input booleans.
note: the actual text added to this field is the final part of the inout_boolean

e.g. input_boolean.vacuum_clean_kitchen → kitchen
this is to make sure we dont hit the char limit on the field when working out the room order.

the add/remove of this input_text is controlled by these automations

alias: Vacuum Add Rooms for Cleaning
alias: Vacuum Remove Rooms for Cleaning

make sure your entity id’s are included in the triggers of each of these.

you can also try triggering one of the example cleaning schedules

alias: Vacuum Cleaning Schedule 1

this for example will manually populate the input_text.vacuum_rooms with kitchen.

this should be image.php

it only generates the latest.png when the path is appended with ?last=true which calls a specific function in the PHP file to create the latest.png

The idea of this is that the php file continually renders the map live dyring the clean (as camera.roomba points to this image.php file). once the clean is done, there is an automation to call the ?last=true which create the png file.

also in the php file is a function that checks if a latest.png file exists and if so → only putput that file and not continue to render the map when a clean is not in progress.

when a clean first start, it invokes the php file with ?clear=true which deletes the latest.php file so the map is rendered each refresh.

hope this helps!

I think I am now following, this part, how it glued together.
With this, I went back and looked at the automation and the one area I was testing with, I had left it out.
Also, for debugging I put the input_text.vacuum_rooms on a card. I did not use the ‘vacuum_clean’ prefix in the automation, so a ‘config check’ was good, but it did work. Really help speed up the debug process.

Sometimes you just have to have something to break your false logic. You might double-check something, but as you are looking at it, in your mind you are just saying check, check, and check. :slight_smile: This now seems to work, so on to configuring the image.

it is, I just type-o the question.

There were a lot of moving parts to this issue. What was confusing me, is if I ran the robot from the app, then a picture would paint. If I deleted the last image I would get PHP errors. Since after running a clean job the errors would go away, that was where I thought my issue was. As with the input buttons, with a new focus, I found the issues. In hindsight, I do not know how it was rendered after a clean job. My first mistake was I called the overlay image “Floor.png”. I had my windows hat on and missed the case. Then, I connected the dots, $ha_rest980 is referencing the HA API. It was embarrassing, but in my defense when I saw the “rest980”, I thought it was the rest980 container. Then I changed the port from 3000 to 8123 and now I am rendering images as expected.

Now I am trying to figure out how to scale the overlay and the lines to fit.

My ultimate goal is an automation that will do a room after x number of days and when the last person leaves the house. I have never messed with the check-button-card. Actually, I don’t have the maintenance ones working yet, but that is a different bunny trail. I wonder if we can store the last time the area was cleaned. Not sure how to update it? As long as everything will run from the HA environment, there may be enough hooks, but the cool thing would be to update them even if not.
I wonder what hooks exist for that?

I have HA installed as container and trying to set this up.
Followed along with steps now at step 6, where should I reference the vaccum.yaml file?
for step 8, is it just create a manual card and paste that lovelace.yaml?

Henry, I am just learning as you are so take what I say with a grain of salt. Are you using the “packages” directory to separated out your configurations? If yes, then just put the vacuum.yaml there. If not and all your configurations are in the configurations.yaml, then you will have to merge it into there. I believed best practices today are one configuration.yaml and doing everything through the UI. But I started back when everything was ymal and the package directory was the way to go then.

That is what I did. Paying attention to correcting the rooms to match yours.

Hope this helps till someone with more experience comes along. :slight_smile:

1 Like

Thnaks for this! It’s amazing! I spent way too much time customizing my floor plan. My wife even laughed at my first attempt, which was nice.

I’m having an issue with selective room cleaning, when I select a room, Roomba will come off of the dock, turn around and re-dock and then tell me it’s stuck. This behaviour does not happen if I select the room from the iRobot app or using Alexa. I have recreated my map from scratch today, labeled all rooms and then run a full clean and then and updated the secrets.yaml with the new room ID’s yet the issue persists. Any ideas?

Thank you. I’ve added two rooms in the config and modified secrets and vacuum files as needed. I used the package way to include it (never used this before).

After step 8, I tried to kick off one of the clean job but didn’t work. Then I tried to run it from the irobot app. I did see the location file updated. After the completion I received a notification from my phone! However the map is empty.

I checked HA logfile and saw below, it seems that some value is NoneType which supposed to be float. I didn’t see it pointed out to the line or location or location. What could be the issue? (I didn’t know yaml automation, I do automation on node-red only). I guess the failure of kick off the job from lovelace might be the same issue

Thanks!

2020-12-11 18:45:00 INFO (MainThread) [homeassistant.components.automation.vacuum_maintenance_check] Vacuum Maintenance Check: Running automation actions
2020-12-11 18:45:00 INFO (MainThread) [homeassistant.components.automation.vacuum_maintenance_check] Vacuum Maintenance Check: Executing step call service
2020-12-11 18:45:00 ERROR (MainThread) [homeassistant.components.automation.vacuum_maintenance_check] Vacuum Maintenance Check: Error executing script. Unexpected error for call_service at pos 1: Error rendering service name template: TypeError: '<' not supported between instances of 'NoneType' and 'float'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 353, in async_render
    render_result = compiled.render(kwargs)
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.8/site-packages/jinja2/runtime.py", line 545, in __next__
    rv = next(self._iterator)
  File "<template>", line 1, in template
TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 125, in async_prepare_call_from_config
    domain_service = domain_service.async_render(variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 355, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
    await getattr(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 432, in _async_call_service_step
    domain, service, service_data = async_prepare_call_from_config(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 128, in async_prepare_call_from_config
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error rendering service name template: TypeError: '<' not supported between instances of 'NoneType' and 'float'
2020-12-11 18:45:00 ERROR (MainThread) [homeassistant.components.automation.vacuum_maintenance_check] While executing automation automation.vacuum_maintenance_check
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 353, in async_render
    render_result = compiled.render(kwargs)
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 1, in top-level template code
  File "/usr/local/lib/python3.8/site-packages/jinja2/runtime.py", line 545, in __next__
    rv = next(self._iterator)
  File "<template>", line 1, in template
TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 125, in async_prepare_call_from_config
    domain_service = domain_service.async_render(variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 355, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: '<' not supported between instances of 'NoneType' and 'float'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 433, in async_trigger
    await self.action_script.async_run(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1010, in async_run
    await asyncio.shield(run.async_run())
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 245, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 253, in _async_step
    await getattr(
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 432, in _async_call_service_step
    domain, service, service_data = async_prepare_call_from_config(
  File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 128, in async_prepare_call_from_config
    raise HomeAssistantError(
homeassistant.exceptions.HomeAssistantError: Error rendering service name template: TypeError: '<' not supported between instances of 'NoneType' and 'float'

I didn’t figure out why the above error, it seems that a float value is expected but missing. Don’t know how to fix it. So I commented out the vacuum_maintenance_check automation in vacuum.yaml and also remove the maintenance section in the lovelace card. The error is gone! It is ok that this doesn’t work since I think it may better track the maintenance using calendar setup (for me).

I let the vacuum cleaned two rooms and find the room id, put them in the secrets files. This is the selective room cleaning looks like, tried to toggle first entry on but the vacuum doesn’t move. The ‘Full Clean’ button on the vacuum card itself works ok. What should I check for this?

Another question, are we able to start/stop room clean from node-red? Is it just service all with room parameters? Where can I check any sample service calls? I’ve used node-red for some time, but never used yaml for automation.

Thanks!

Depends how you run the cleans, if you use the input booleans, then you could base it on when it its last state change

do you get any errors outputted in the log?

When you run a clean from the ios app, check the map id from the rest980 api page and verify if it matches what you are seeing in the sensor.vacuum attribute.

When you toggle on the first entry, do you mean you click clean rooms and nothing happens ?

have a read of this post whcih describes how the input_booleans control the input_text.vacuum to determine the room cleaning order - might be missing some values for the espective automations.

Have got my 2 floors working perfect now, thank you!

Just wanted to ask / clarify re the camera entities for the maps and their display in lovelace.

Based on your vacuum.yaml and lovelace.yaml, the map will not show up as the camera entities have different names.
camera.roomba_ground in vacuum.yaml and camera.roomba_0 in lovelace.yaml.

They should have the same name in order to dispay on lovelace. Once I figured this out, displayed no problem.

Also, had to add the following to vacuum.yaml re the input_select

input_select:
  coffee_time:
    #name: Floor
    options:
      - Ground
      - Leval 1
    initial: Ground
    icon: mdi:map

Hope the above helps others

One question, I’m not clear how the map will change using the sate switch without having a manual selector on Lovelace or some additional code?

Hi there… after loads of trial an error with the map I went for a re-install. Unfortunately I am now stuck at the point where I want to read the bid / pw. I get the following error message when executing roombapw. It did work before, so not sure what goes wrong here…
Regards
Patrick


> [email protected] getpassword
> node ./bin/getpassword.js

Make sure your robot is on the Home Base and powered on (green lights on). Then press and hold the HOME button on your robot until it plays a series of tones (about 2 seconds). Release the button and your robot will flash WIFI light.
This step will continue in 10 seconds...
(node:18) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
node:events:353
      throw er; // Unhandled 'error' event
      ^

Error: getaddrinfo ENOTFOUND robot_ip
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (node:dns:67:26)
Emitted 'error' event on TLSSocket instance at:
    at emitErrorNT (node:internal/streams/destroy:188:8)
    at emitErrorCloseNT (node:internal/streams/destroy:153:3)
    at processTicksAndRejections (node:internal/process/task_queues:80:21) {
  errno: -3008,
  code: 'ENOTFOUND',
  syscall: 'getaddrinfo',
  hostname: 'robot_ip'
}
npm ERR! code 1
npm ERR! path /usr/src/app
npm ERR! command failed
npm ERR! command sh -c node ./bin/getpassword.js

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-12-19T10_05_49_346Z-debug.log

SOLVED: Figured it out. A full restart of the server helped to clear things out and it worked.

1 Like

Just have some time again working on this project.
I’m still having issues only with the map being created.
When opening the Nginx page i receive this error.
image

When looking into the docker logs i see the messages below so it’s a permission issue.

My Nginx is created with HA addons with the default config
image

Config from the docker container
image

I am trying to set up a flow in NodRed to clean specfic rooms when I press a zigbee button. I can initiate a full clean just fine but am struggling to find that correct url to call to clean a specfic room using the room ID’s.

Hi all
I am down to one last issue - since the rest works now. I am getting the following error with my installation. Seems down to either a mapping or permisssion issue. I am having a hass.io installation.

2020-12-21 14:09:16 ERROR (MainThread) [homeassistant.components.automation.vacuum_log_position] Vacuum Log Position: Error executing script. Unexpected error for call_service at pos 1: [Errno 2] No such file or directory: '/homeassistant/vacuum/vacuum.log'

Both exist file and directory. Any ideas? Homassistant has access to the files for other integrations, so not sure where i would like to change anything. I have changed the path in ‘image.php’ and ‘secrets.yaml’

Regards
Patrick

SOLVED: I guess I should have known better in the first instance. Should have been thinking much more simply. secrets.yaml asks to specify the directory and file WITHIN the docker image (i.e. /config/vacuum) which is in my case mapped to the host system in the homeassistant docker image (i.e. /Hass.io/hass.io/homeassistant). So, in a nutshell should have not done any change in the secrets.yaml in the first place.

1 Like

Can you share how do you initiate a full clean from node-red?

I can not get the maintenance card to work right. It will not create the entities. My understanding by default MQTT discovery is on. I may have missed it somewhere, near as I can tell I do not have any configurations that turn it (MQTT discovery) off. Any other stupid things to check?

entities:
  - style: |-
      .text-divider {
        padding: 0em;
        margin: 0em;
      } h2 {
        font-size: 1em;
        margin-block-start: 0em;
        margin-block-end: 0em;
      }
    text: Clean
    type: 'custom:text-divider-row'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_clean_brushes
    severity:
      - color: '#bfb540'
        value: 0 days
      - color: '#bf4060'
        value: '-1 days'
    timeout: 10 days
    title: Brushes
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_clean_contacts
    severity:
      - color: '#bfb540'
        value: 0 days
      - color: '#bf4060'
        value: '-3 days'
    timeout: 18 days
    title: Contacts
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_clean_filter
    severity:
      - color: '#bfb540'
        value: 0 days
      - color: '#bf4060'
        value: '-10 days'
    timeout: 10 days
    title: Filter
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_clean_wheel
    severity:
      - color: '#bfb540'
        value: 0 days
      - color: '#bf4060'
        value: '-3 days'
    timeout: 18 days
    title: Wheel
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_clean_bin
    severity:
      - color: '#bfb540'
        value: 0 days
      - color: '#bf4060'
        value: '-3 days'
    timeout: 18 days
    title: Bin
    type: 'custom:check-button-card'
  - style: |-
      .text-divider {
        padding: 0em;
        margin: 0em;
      } h2 {
        font-size: 1em;
        margin-block-start: 0em;
        margin-block-end: 0em;
      }
    text: Replace
    type: 'custom:text-divider-row'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_replace_brushes
    severity:
      - color: '#bfb540'
        value: 0 months
      - color: '#bf4060'
        value: '-4 months'
    timeout: 8 months
    title: Brushes
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_replace_filter
    severity:
      - color: '#bfb540'
        value: 0 months
      - color: '#bf4060'
        value: '-1 months'
    timeout: 3 months
    title: Filter
    type: 'custom:check-button-card'
  - color: '#40bf6a'
    due: true
    entity: sensor.vacuum_maint_replace_wheel
    severity:
      - color: '#bfb540'
        value: 0 months
      - color: '#bf4060'
        value: '-4 months'
    timeout: 2 years
    title: Wheel
    type: 'custom:check-button-card'
head:
  label: Maintenance
  type: section
type: 'custom:fold-entity-row'

Great that worked out for you. I can’t figure out the maintenance automation either and had to comment those out. I think it is not that critical for me, I am not on the UI everyday, a calendar reminder works fine.

How do I get the floor.png do reflect my actual floor? I don’t know how to adjusted the image it generated. I used the app to do a clean on the master bedroom and got the map like below.

Do I need to do a full clean? The last time I did a full clean which took 7.5 hours due to two charges in between, though the total clean area is only about 1000 sq ft.

I started with screenshots from the iRobot app. Then I imported them into fusion360 and used the calibrate to get them the right size, then outlined those for my floor. Then it took a lot of trial and error to get the size right and offsets.
Then as I ran it for different rooms, I would save the vacuum.log to that room. Then once you have a sample, then you can rename it back and let it build a new image. You do have to delete the last.png for it to build a new one. Still not there.

Here is the run for the master bedroom, bath, and closet.

Here is the living room, kitchen, behind the couch, and bar area.

This is what we call the grandkids room because that is where they stay when visiting.

Then last here is the kids, just like grandkids, really a guest room so the kids stay there when visiting.

All those screenshots above were made from saved runs. You can see I need to tweak some lines in the floor.png but also it close enough to get a good feeling for what happening.

1 Like