iRobot Roomba i7+ Configuration using Rest980

The strangest thing that, when I reboot the roomba, it immediatly want to communicate with the cloud and after the https connection is established it got tcp packets from 8883 from the internet.

it’s strange because I have uninstalled my application and I unlinked the irobot account in google home.

OFC, yes i can. I dont undestand this behaviour. :confused:

Maybe if i turn off my firewall. (but there isn’t any setup for this type of blocking…)

If no success, i will fire my roomba from my home :smiley:

try to make separate network (maybe hostspot from your phone) to make connection between your roomba and host machine, you would need to connect roomba to that network for credectials recovery process and then setup roomba back to your home network, but from the log it seems something on your network blocking roomba to communicate with your host machine

that part about cloud connection is strange and might be the reason around connection timeout

Thanks I missed that. This may be another basic question but I am not seeing what needs to be placed into: lovelace.yaml and vacuum.yaml as called out in the instructions. I see in the faq the format of the rooms in secrets.yaml.

if you have Roomba i7 just copy and paste this config into yours, if you dont use some kind of packaging, just paste things from vacuum.yaml into configuration.yaml, based on its domain (sensor, automation, …)

about the frontend, things from lovelace.yaml paste into your lovelace in your intended view

Hi Peter,

Give this a shot…

NOTE! I havent tested this - just put it together this morning so it might have a couple of mistakes :wink:

Let me know how you go :+1:

If its all good, ill add it to the FAQ as a guide for adding a second level.

Cheers :beers:

Changes

secrets.yaml

#replace existing map with map0
vacuum_map_0: http://<ip or fqdn of docker host>:<nginxphpport>/image0.php
vacuum_map_1: http://<ip or fqdn of docker host>:<nginxphpport>/image1.php

vacuum.yaml

###################################
# Sensor
###################################

sensor:
        #... EXISTING...
  - platform: template
    sensors:
      vacuum:
        #... EXISTING...
        attribute_templates:
        #... EXISTING...
        
          # pmap1_id I7/S9 Models - Level 1 (represented by the second pmap list entry)
          pmap1_id: >-
            {% if state_attr('sensor.rest980', 'pmaps')[1] is defined %}
              {{ state_attr('sensor.rest980', 'pmaps')[1] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
            {% else %}
              n-a
            {% endif %}
          # pmap1_timestamp I7/S9 Models
          pmap1_timestamp: >-
            {% if state_attr('sensor.rest980', 'pmaps')[1] is defined %}
              {{ state_attr('sensor.rest980', 'pmaps')[1] | regex_findall_index("{'[\w\-]+': '(\w+)'}") }}
            {% else %}
              n-a
            {% endif %}

###################################
# Input Boolean
###################################

input_boolean:
 # existing room entries, add "_0_" between clean and name
  vacuum_clean_0_kitchen:
    name: Kitchen
    icon: mdi:silverware-fork-knife
 # new map entries, add "_1_" before between clean and name
  vacuum_clean_1_bedroom:
    name: Second Floor Bedroom
    icon: mdi:bed-empty

###################################
# Input Text
###################################

input_text:
 # existing room entries, add "_0_" between clean and name
  vacuum_clean_0_kitchen:
    name: Kitchen
    initial: !secret vacuum_kitchen   
 # new map entries, add "_1_" before between clean and name
  vacuum_clean_1_bedroom:
    name: Second Floor Bedroom
    initial: !secret vacuum_second_floor_bedroom    
    
###################################
# Group
###################################

group:
  vacuum_rooms_0:  #renamed from existing group
  # existing room entries, add "_0_" between clean and name
    
  vacuum_rooms_1:
 # new map entries, add "_1_" before between clean and name
    
###################################
# Input Select
###################################

input_select:
  vacuum_map_selection:
    name: Vacuum Map Selection
    options:
      - 'Ground'
      - 'Level 1'
    
###################################
# Automation
###################################

automation:
  # Initiate Selective Room Clean Map 0
  - alias: Vacuum Clean Rooms 0 #renamed from existing, adds extra action for level selection (camera)
    trigger:
    - platform: event
      event_type: initiate_vacuum_clean_0
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.vacuum_map_selection
          option: "Ground"
      - service: rest_command.vacuum_clean
        data_template:
          payload: >
            {
              "ordered": 0,
              "pmap_id": "{{ state_attr('sensor.vacuum', 'pmap0_id') | string }}",
              "regions": [{% for boolean in states.input_boolean if 'vacuum_clean_0_' in boolean.entity_id and is_state(boolean.entity_id, 'on') %}
                {% set room = 'input_text.' + boolean.entity_id.split('.')[1] %} {{ states(room) | string }} {%- if not loop.last %},{%- endif %}
                {%- endfor %}
              ],
              "user_pmapv_id": "{{ state_attr('sensor.vacuum', 'pmap0_timestamp') | string }}"
            }
      - service: input_boolean.turn_off
        data:
          entity_id: group.vacuum_rooms_0
          
  # Initiate Selective Room Clean Map 1
  - alias: Vacuum Clean Rooms 1
    trigger:
    - platform: event
      event_type: initiate_vacuum_clean_1
    action:
      - service: input_select.select_option
        data:
          entity_id: input_select.vacuum_map_selection
          option: "Level 1"
      - service: rest_command.vacuum_clean
        data_template:
          payload: >
            {
              "ordered": 0,
              "pmap_id": "{{ state_attr('sensor.vacuum', 'pmap1_id') | string }}",
              "regions": [{% for boolean in states.input_boolean if 'vacuum_clean_1_' in boolean.entity_id and is_state(boolean.entity_id, 'on') %}
                {% set room = 'input_text.' + boolean.entity_id.split('.')[1] %} {{ states(room) | string }} {%- if not loop.last %},{%- endif %}
                {%- endfor %}
              ],
              "user_pmapv_id": "{{ state_attr('sensor.vacuum', 'pmap1_timestamp') | string }}"
            }
      - service: input_boolean.turn_off
        data:
          entity_id: group.vacuum_rooms_1
         
         
###################################
# Camera
###################################

camera:
  - platform: generic
    still_image_url: !secret vacuum_map_0
    content_type: image/png
    name: Roomba_Ground
camera:
  - platform: generic
    still_image_url: !secret vacuum_map_1
    content_type: image/png
    name: Roomba_Level_1

lovelace.yaml

### VERTICAL STACK CARD ###
cards:
  - entity: sensor.vacuum
    type: 'custom:roomba-vacuum-card'
  - entities:
      # existing room entries, add "_0_" between clean and name
      - input_boolean.vacuum_clean_0_kitchen
      - entity: automation.vacuum_clean_rooms_0
        lock:
          enabled: |
            [[[
              if ((states['group.vacuum_rooms_0'].state == "on") && (states['sensor.vacuum'].state == "Ready"))
                return false;
              return true;
            ]]]
          exemptions: []
        name: Clean Rooms
        styles:
          card:
            - height: 50px
        tap_action:
          action: call-service
          service: automation.trigger
          service_data:
            entity_id: automation.vacuum_clean_rooms_0
        type: 'custom:button-card'
    head:
      label: Ground Floor Cleaning
      type: section
    type: 'custom:fold-entity-row'
  - entities:
      # new map entries, add "_1_" before between clean and name
      - input_boolean.vacuum_clean_1_bedroom
      - entity: automation.vacuum_clean_rooms_1
        lock:
          enabled: |
            [[[
              if ((states['group.vacuum_rooms_1'].state == "on") && (states['sensor.vacuum'].state == "Ready"))
                return false;
              return true;
            ]]]
          exemptions: []
        name: Clean Rooms
        styles:
          card:
            - height: 50px
        tap_action:
          action: call-service
          service: automation.trigger
          service_data:
            entity_id: automation.vacuum_clean_rooms_1
        type: 'custom:button-card'
    head:
      label: Level 1 Floor Cleaning
      type: section
    type: 'custom:fold-entity-row'
   

### PICTURE GLANCE CARD >> INSIDE STATE-SWITCH ###   


type: custom:state-switch
entity: input_select.coffee_time
states:
  Ground:
    aspect_ratio: 0%
    camera_image: camera.roomba_0
    entities: []
    type: picture-glance
  Level 1:
    aspect_ratio: 0%
    camera_image: camera.roomba_1
    entities: []
    type: picture-glance

image.php -> rename to image0.php

create second copy as image1.php and update to reflect your second level

This is covered in Step 6. I use packages so you should be able to copy in vacuum.yaml into your packages directory (and/or create one in your config section and refer here to configure packages in HA

With lovelace.yaml, you can create a manual card and copy the content from this file in (note there is two cards a vertical stack, and picture glace which will need to be created seperately)

The relevent input_booleans/input_texts/secrets room details will need to be updated to reflect you home

Ill update the FAQ, you dont need to include the room details, only the room ID

Thanks I didn’t realize you were pointing to the vacuum.yaml in your git repository.

Thanks for your help!

1 Like

Thanks, I’ve moved these to links in the README :beers:

Oh my god… I did exactly what you told. And it was 1 sec, and I got my password… Thanks man… :slight_smile:

Glad to hear that :slight_smile:

Jeremy / Tomáš, Thanks for all your help.

The last issue I ran into was that the IP address in the secrets file can not contain a local domain name and must include an actual IP address. Just wanted to list it out for anybody who runs across this in the future.

I use a domain name in my secrets file? perhaps you need to make sure your HA instance is capable of DNS resolution for your particular endpoint

I had no luck for the rest of the setups… I cannot add the integration to HA… Time out… Because i didn’t find any firewall rule which can cause the issue, I have installed wireshark to HA… I have attached a screenshot. You can see there is communitaction.

Client Hello, Server Hello, Certificate etc. I have tried to analyse this dump but I didn’t find anything. Is there anyone here who sees what could be the problem?

@Jeremy. After quite some struggling (me not reading documentation with understanding :man_facepalming:) I managed to install and configure this integration. I must say great work, given the complexity of entire solution :clap:! I love it!
Now, I still have to finetune entire configuration to my setup, but I found one item that bothers me, that I found no solution. When the robot starts vacuuming specific room and the map starts to be drawn, the starting point is not where the clean base is installed, but some point far away, where robot does not reach even… Below are 2 screenshots from my setup for 2 individual cleaning cycles. Clean station position is clearly marked with roomba icon and I’d expect this to be starting and ending point:


Is there any way to move starting point to exact location where the base is located?
BTW, another small item… is there a way to make summary text single line, so it spread across top of the map? With my maps it becomes partially unreadable , overlapping map itself…

Thanks! Glad you have found value in it :partying_face:

That is interesting! Might be the robot reporting a sporadic value for the first log report.
Open your vacuum.log and see what the first coordinates refer to and if it’s the same in a couple of cleans?
We might have to potentially tweak the image.php file to skip the first entry in the coordinates list. I’ll suss it out tomorrow morning and report back :+1:

Edit image.php

  • line 216: delete \n
  • line 239: delete “\n”.

@Jeremy, thanks for swift reply!
So, here are the few first lines from my vacuum.log:

Home Assistant notifications (Log started: 2020-05-20T09:30:18.113909+00:00)
--------------------------------------------------------------------------------
(-56, 0, -172)
(140, -171, 86)
(154, -156, -84)
(168, -132, 89)
(176, -174, -89)
(189, -152, 89)
(190, -3, 90)
(191, 90, 19)
(205, -15, -90)
(216, -91, 43)
(216, 39, 89)
(223, 109, -23)
(231, -20, -89)

If this help somehow, here is the transformation data from my image.php:

$map_width = 1351; # Ensure overlay and wall images match this size
$map_height = 1266; # Ensure overlay and wall images match this size
$x_offset = -740;
$y_offset = -560;
$flip_vertical = false;
$flip_horizontal = false;
$rotate_angle = 180; # Allows rotating of the roomba lines
$scale=0.62; # Allows scaling of roomba lines

And how the entire map picture looks like (I made screenshots of only part of it, whole map covers 4 levels), so it is easier to understand mapping:


Obviously it is as such after last cleaning… I’ll try to make few more and see how it looks after subsequent runs…
I also updated image.php according to your suggestion, but it does not seem to work… I guess sort of caching problem? In a while I’ll re-run cleaning, this should refresh the image, I’ll check then.

I’ve published some changes to the image.php file :slight_smile:

Try updating these new variables -

  • $set_first_coordinate - try setting this to 1 for your scenario, will skip the first (or what ever number is set) datapoints in the log
  • $ha_text_delimiter - update this to " |" or something similar to change how the text is broken up. the default is " \n" which moves it to a new line

Let me know how you go !

if those are all different levels, then you might want to attempt the multi floor implementation i vaguely proposed here

so when you add the blid/password in rest980 ha addon, what do you see in the logs for the addon?

I’ve added a new feature to the GH Repo to automate the deletion of image files older than 30 days! :broom: (mine was getting out of hand!)

Changes needed to your secrets and vacuum yaml files :slight_smile:

:beers: