Roomba i7 support

Finally had to go away from this and back to the standard component. The roomba component has enough problems in itself without adding confusion to trouble shooting it by running a custom_component. Hopefully this will get moved in as the standard component.

Hello,

Is this still working for you? I’m on 92.2 and I’m getting the file not found error…HA seem to have restructure the custom component format recently…not sure how to fix…

Still works for me. A couple releases ago custom components needed to be re-organized. Make sure it is now ‘custom_components\roomba\vacuum.py’. So basically rename the vacuum folder to roomba and the roomba.py to vacuum.py.

I messed up the latest HA upgrade and had to redo the setup.

i7 doesn’t seem to respond to HA anymore. It crashes the HA startup with ERROR 104 Connection Refused by host.

When ever I add the roomba in my config file Hassio keeps crashing and wont load.
This issue been open since 2018: https://github.com/home-assistant/home-assistant/issues/16069

I am getting this in my logs:

raceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 126, in _async_setup_platform
    SLOW_SETUP_MAX_WAIT)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 435, in wait_for
    await waiter
concurrent.futures._base.CancelledError
2019-07-20 22:04:04 ERROR (MainThread) [homeassistant.setup] Error during setup of component sensor
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1445, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1438, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1347, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 487, in uvloop.loop.Loop._run
  File "uvloop/loop.pyx", line 404, in uvloop.loop.Loop._on_idle
  File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 84, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 153, in _async_setup_component
    hass, processed_config)
  File "/usr/src/homeassistant/homeassistant/components/sensor/__init__.py", line 42, in async_setup
    await component.async_setup(config)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 112, in async_setup
    await asyncio.wait(tasks)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 389, in wait
    return await _wait(fs, timeout, return_when, loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 482, in _wait
    await waiter
concurrent.futures._base.CancelledError
2019-07-20 22:04:04 ERROR (MainThread) [homeassistant.setup] Error during setup of component zeroconf
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1445, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1438, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1347, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 487, in uvloop.loop.Loop._run
  File "uvloop/loop.pyx", line 404, in uvloop.loop.Loop._on_idle
  File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 84, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
concurrent.futures._base.CancelledError
2019-07-20 22:04:04 ERROR (MainThread) [homeassistant.setup] Error during setup of component automation
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1445, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1438, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1347, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 487, in uvloop.loop.Loop._run
  File "uvloop/loop.pyx", line 404, in uvloop.loop.Loop._on_idle
  File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 84, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 153, in _async_setup_component
    hass, processed_config)
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 115, in async_setup
    await _async_process_config(hass, config, component)
  File "/usr/src/homeassistant/homeassistant/components/automation/__init__.py", line 383, in _async_process_config
    await component.async_add_entities(entities)
  File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 221, in async_add_entities
    await asyncio.wait(tasks)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 389, in wait
    return await _wait(fs, timeout, return_when, loop)
  File "/usr/local/lib/python3.7/asyncio/tasks.py", line 482, in _wait
    await waiter
concurrent.futures._base.CancelledError
2019-07-20 22:04:04 ERROR (MainThread) [homeassistant.components.light] flux_led: Error on device update!
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "uvloop/loop.pyx", line 1445, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1438, in uvloop.loop.Loop.run_until_complete
  File "uvloop/loop.pyx", line 1347, in uvloop.loop.Loop.run_forever
  File "uvloop/loop.pyx", line 487, in uvloop.loop.Loop._run
  File "uvloop/loop.pyx", line 404, in uvloop.loop.Loop._on_idle
  File "uvloop/cbhandles.pyx", line 68, in uvloop.loop.Handle._run
  File "/usr/src/homeassistant/homeassistant/components/roomba/vacuum.py", line 84, in async_setup_platform
    await hass.async_add_job(roomba.connect)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.7/site-packages/roomba/roomba.py", line 283, in connect
    sys.exit(1)
SystemExit: 1

I had the issue of HA failing to boot up with roomba enabled in the config file. It was a problem connecting to the Roomba due to the script using TLS1.0.

I fixed it by editing /usr/local/lib/python3.7/site-packages/roomba/roomba.py and changing two instances of ssl.PROTOCOL_TLSv1 to ssl.PROTOCOL_TLS

How do you modify the roomba.py file and have it persist a restart? I thought the container was stateless, and any changes you make are reverted once it restarts

Changes to containers persist until the container is deleted and/or rebuilt.

This change survives a container restart, but it doesn’t survive a system restart with hass.io because the supervisor rebuilds the container.

sorry but i am new in this, and I am seeing the github, but and maybey this is a stupid question, is in mac terminal where I have to put roomba, all I want is to find my blid and password thanks!!

Just want to mention that the HA roomba components are based on github projects that do not support the latest firmware, and this is likely the cause of most persistent errors. Even with that said, I don’t know of any open source projects that currently support the more interesting advanced features that would make integration with HA amazing like SmartMaps (or w/e they are called).

I have a dog that occasionally visits certain rooms and, if unattended, will pee on the area rugs. I wanted my motion sensors/presence detection to figure this out and send the appropriate roomba into that room to chase him away. Easiest way I found to implement this is with assistant-relay (https://github.com/greghesp/assistant-relay), which is a REST interface for sending text commands to Google Assistant.

So for example, I use curl to send “Tell bjork to vacuum the Guest Bath” to Google Assistant, and everything proceeds flawlessly. (Here, “bjork” is the name of my s9 and “Guest Bath” is a labeled room in bjork’s smart map.)

Note: if you are getting a connection error trying to get the password/blid, you need to change password.py to use

ssl.PROTOCOL_TLSv1_2   

I am thinking of buying i7 so I looked into the home assistant integration. Seams like the native library is a bit buggy and missing features. Does anybody tried running this https://github.com/koalazak/rest980 and controlling the roomba through REST calls ?

Here is how you can fix the issues with the latest Roomba firmware. http://www.brandonclaps.com/?p=193

Trying to get maps working for my Roomba980 on Hassio 0.102.3 using a custom component as suggested by @drjared88 in a post above.
I just modified his vacuum.py so that it imports the newer Roomba980-Python 1.2.6 by NickWaterton.
I’m currently stuck on an error message:

File "/config/custom_components/roomba/vacuum.py", line 111, in async_setup_platform
    iconPath="/www/res"
TypeError: enable_map() got an unexpected keyword argument 'enableMapWithText'

Any idea how to troubleshoot further?

Thanks, I used this fix but now I’m getting error code 4. BLID or Password issue.

I had this working before, could the password have changed?

Anyone got steps for verifying BLID and password in Hassio?

Yep, I use the Rest980 Docker Image for getting info out of my i7+ :slight_smile:

docker environment variables:
BLID=xxxxx
PASSWORD=xxxx
ROBOT_IP=x.x.x.x
FIRMWARE_VERSION=2

secret file: 
vacuum_resource: http://xxxxx:yyyy/api/local/info/state

sensor:
  # Roomba via Rest980 Docker Image
  - platform: rest
    name: Elf
    json_attributes:
      - batPct
      - bin
      - cleanMissionStatus
      - dock
    resource: !secret vacuum_resource
    value_template: 'OK'
    scan_interval: 30
  - platform: template
    sensors:
      elf_battery:
        friendly_name_template: "{{ states.sensor.elf.name}} Battery"
        value_template: '{{ states.sensor.elf.attributes["batPct"] }}'
        unit_of_measurement: '%'
        device_class: battery
      elf_phase:
        friendly_name_template: "{{ states.sensor.elf.name}} Status"
        value_template: >-
          {% if states.sensor.elf.attributes["cleanMissionStatus"]["phase"] == 'charge' and states.sensor.elf.attributes["batPct"] == 100 %}
            Fully Charged
          {% else %}
            {% set mapper =  {
            'charge' : 'Charging',
            'run' : 'Cleaning',
            'evac' : 'Emptying Robot',
            'stop' : 'Stopped/Paused',
            'stuck' : 'Stuck',
            'hmUsrDock' : 'Returning Home',
            'hmMidMsn' : 'Returning Home mid Clean',
            'hmPostMsn' : 'Returning Home' } %}
            {% set state =  states.sensor.elf.attributes["cleanMissionStatus"]["phase"] %}
            {{ mapper[state] if state in mapper else 'Unknown' }}
          {% endif %}
          
        icon_template: mdi:settings
      elf_bin:
        friendly_name_template: "{{ states.sensor.elf.name}} Bin Status"
        value_template: >-
          {% set mapper =  {
            true : 'Full',
            false : 'Not Full' } %}
          {% set state =  states.sensor.elf.attributes["bin"]["full"] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
        icon_template: mdi:delete
      elf_dock:
        friendly_name_template: "{{ states.sensor.elf.name}} Clean Base Status"
        value_template: >-
          {% set mapper =  {
            300 : 'Ready',
            301 : 'Ready',
            302 : 'Emptying Robot',
            350 : 'Bag Missing',
            351 : 'Base Clogged',
            353 : 'Bag Full' } %}
          {% set state =  states.sensor.elf.attributes["dock"]["state"] %}
          {{ mapper[state] if state in mapper else 'Unknown' }}
        icon_template: mdi:home-minus

I think I have a temporary solution to the clean map errors.
For future reference, here’s how I did it:
Hassio 0.102.3
Using NickWaterton’s Roomba980-Python package
Installed Portainer, disabled Protection Mode, unhid Homeassistant container.
Connected as root to the consolse, then:

 apk update
 apk add zlib-dev freetype freetype-dev make automake gcc g++ subversion python3-dev
 pip3 uninstall Pillow
 pip3 install Pillow

The map seems to be working though it won’t survive an upgrade.
I’m thinking how to make this more permanent - custom component, add-on or try to patch the Roomba integration…

Hello,

Can you do a step by step on how to get Rest980 setup and then getting the i7 info?

I have a Synology diskstation which can get Docker up and running but that is as far as I know…

Sure can, I’m just on vacation over Christmas, will write something up when I’m back early Jan :+1:

Hi @chilman4081,

I have posted this under Share Your Projects -

1 Like