iRobot Roomba i7+ Configuration using Rest980

NEW RELEASE

Maintenance Release 0.4

This update includes the following

  • Removed manually defining pmap_id and user_pmap_id fields, these are now dynamically stored
  • Add Pending State after Cleaning when Roomba is saving maps
  • Update Region examples in secrets.yaml as you only need to send the region ID, not the whole string

secrets.yaml examples

vacuum_kitchen: '{"region_id": "21"}'
vacuum_entry: '{"region_id": "13"}'

Hello,

I have a roomba 980 and I can’t get this to work… Any help much appreciated.
Here is a list of errors, I think are related:

/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.114-v8
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
Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:113
Integration: rest (documentation, issues)
First occurred: 2:43:02 AM (5 occurrences)
Last logged: 2:48:08 AM

Error fetching data: http://192.168.1.50:300/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=300): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f76934ad0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error fetching data: http://192.168.1.50:300/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=300): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f752f0f90>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error fetching data: http://192.168.1.50:300/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=300): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f730e68d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error fetching data: http://192.168.1.50:300/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=300): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f75af7a90>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error fetching data: http://192.168.1.50:300/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=300): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f752a55d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
Log Details (WARNING)
Logger: hacs.deprecated
Source: custom_components/hacs/http.py:35
First occurred: 2:44:15 AM (5 occurrences)
Last logged: 2:44:32 AM

The '/community_plugin/*' is deprecated and will be removed in an upcoming version of HACS, it has been replaced by '/hacsfiles/*', if you use the UI to manage your lovelace configuration, you can update this by going to the settings tab in HACS, if you use YAML to manage your lovelace configuration, you manually need to replace the URL in your resources.

This appears to indicate your blid/password is incorrect.

Can you please check these?

How silly of me, you are correct, it was a typo… Now there is no errors in rest980 log. The errors from dev log still persist though and in the lovelace card all sensors are either unknown or unavailable. I see the buttons for pause, stop and dock, first two don’t do anything, when I press dock roomba beeps, so at least the connection seems to work. What should I check next? Sorry for being a noob.

I suspect this should be port 3000 ! Check your secrets.yaml entries :wink:

Thanks, I fixed that, but it still dones’t work :frowning:
edit: where should vacuum.yaml go? into config folder, vacuum folder or should it be integrated into configuration.yaml?

Log Details (ERROR)
Logger: homeassistant.components.rest.sensor
Source: components/rest/sensor.py:113
Integration: rest (documentation, issues)
First occurred: 5:39:52 PM (2 occurrences)
Last logged: 5:40:24 PM

Error fetching data: http://192.168.1.50:3000/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=3000): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fad927590>: Failed to establish a new connection: [Errno 111] Connection refused'))
Error fetching data: http://192.168.1.50:3000/api/local/info/state failed with HTTPConnectionPool(host='192.168.1.50', port=3000): Max retries exceeded with url: /api/local/info/state (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fad79f250>: Failed to establish a new connection: [Errno 111] Connection refused'))
Log Details (ERROR)
Logger: homeassistant.helpers.entity
Source: helpers/template.py:869
First occurred: 5:40:21 PM (8 occurrences)
Last logged: 5:42:30 PM

Update for sensor.vacuum fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 279, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 470, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/template/sensor.py", line 242, in async_update
    attrs[key] = value.async_render()
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 222, in async_render
    return compiled.render(kwargs).strip()
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/local/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/local/lib/python3.7/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/src/homeassistant/homeassistant/helpers/template.py", line 869, in regex_findall_index
    return re.findall(find, value, flags)[index]
IndexError: list index out of range
Log Details (ERROR)
Logger: homeassistant.components.template.sensor
Source: components/template/sensor.py:244
Integration: template (documentation, issues)
First occurred: 6:14:03 PM (4 occurrences)
Last logged: 6:14:03 PM

Error rendering attribute total_area: UndefinedError: 'None' has no attribute 'sqft'
Error rendering attribute job_time: UndefinedError: 'None' has no attribute 'mssnM'
Error rendering attribute job_recharge: UndefinedError: 'None' has no attribute 'rechrgM'
Error rendering attribute job_area: UndefinedError: 'None' has no attribute 'sqft'

In the Packages folder.

I assume you are running the HA Addon for rest980. Please check the config on the and confirm which port is set (should be 3000 by default). Is that IP address the correct one for your HA server? Are you using a custom build with perhaps a firewall enabled?

I am (still) running 64bit home assistant on a rpi 3b+, as I can’t get it to work on rpi4b; nothing special about it I believe and it’s not behing and extra firewall or separate subnet. The IP from the log in post above is correct, vacuum.yaml is in the correct place.
Your HA addon is installed, port is set to 3000, blid, password and ip and firmware of the roomba are set as well. The log is full of this entries and nothing else:

GET /api/local/info/state 200 102.850 ms - 2395

This is expected as sensor.rest980 connects to this to get the vacuum states and make them available to the template sensor.vacuum.

Can you reach this URL in a web browser?
http://192.168.1.50:3000/api/local/info/state

yes

{"netinfo":{"dhcp":true,"addr":*****,"mask":******,"gw":*******,"dns1":****,"dns2":0,"bssid":"******","sec":4},"wifistat":{"wifi":1,"uap":false,"cloud":1},"wlcfg":{"sec":7,"ssid":"*********"},"mac":"*******","country":"SI","cloudEnv":"prod","svcEndpoints":{"svcDeplId":"v007"},"mapUploadAllowed":true,"localtimeoffset":120,"utctime":1588619760,"pose":{"theta":7,"point":{"x":174,"y":-388}},"batPct":100,"dock":{"known":false},"bin":{"present":false,"full":false},"audio":{"active":false},"cleanMissionStatus":{"cycle":"none","phase":"charge","expireM":0,"rechrgM":0,"error":0,"notReady":7,"mssnM":225,"sqft":582,"initiator":"localApp","nMssn":335},"language":0,"noAutoPasses":false,"noPP":false,"ecoCharge":false,"vacHigh":false,"binPause":true,"carpetBoost":true,"openOnly":false,"twoPass":false,"schedHold":false,"lastCommand":{"command":"stop","time":1588436201,"initiator":"localApp"},"langs":[{"en-UK":0},{"fr-FR":1},{"es-ES":2},{"it-IT":3},{"de-DE":4},{"ru-RU":5}],"bbnav":{"aMtrack":74,"nGoodLmrks":27,"aGain":55,"aExpo":10},"bbpanic":{"panics":[8,8,6,8,11]},"bbpause":{"pauses":[17,0,0,3,0,5,4,17,0,17]},"bbmssn":{"nMssn":335,"nMssnOk":144,"nMssnC":125,"nMssnF":60,"aMssnM":145,"aCycleM":80},"bbrstinfo":{"nNavRst":47,"nMobRst":0,"causes":"0000"},"cap":{"pose":1,"ota":2,"multiPass":2,"carpetBoost":1,"pp":1,"binFullDetect":1,"langOta":1,"maps":1,"edge":1,"eco":1,"svcConf":1},"hardwareRev":2,"sku":"R980040","batteryType":"lith","soundVer":"32","uiSwVer":"4582","navSwVer":"01.12.01#1","wifiSwVer":"20992","mobilityVer":"5806","bootloaderVer":"4042","umiVer":"6","softwareVer":"v2.4.6-3","tz":{"events":[{"dt":1583082000,"off":60},{"dt":1585443601,"off":120},{"dt":1603587601,"off":60}],"ver":8},"timezone":"Europe/Ljubljana","name":"Pucika","cleanSchedule":{"cycle":["none","none","none","none","none","none","none"],"h":[0,0,0,0,0,0,0],"m":[0,0,0,0,0,0,0]},"bbchg3":{"avgMin":65105,"hOnDock":23168,"nAvail":1422,"estCap":12311,"nLithChrg":285,"nNimhChrg":0,"nDocks":38},"bbchg":{"nChgOk":280,"nLithF":0,"aborts":[0,0,0]},"bbswitch":{"nBumper":57897,"nClean":985,"nSpot":7,"nDock":38,"nDrops":2503},"bbrun":{"hr":460,"min":5,"sqft":1493,"nStuck":95,"nScrubs":561,"nPicks":1788,"nPanics":1078,"nCliffsF":5990,"nCliffsR":3098,"nMBStll":5,"nWStll":5,"nCBump":0},"bbsys":{"hr":25604,"min":26},"signal":{"rssi":-38,"snr":51},"connected":true}

ok well the addon is working as expected.

are you still seeing errors in the log?

Can you please PM me your code sections and ill have a look.

1 Like

Release Update 0.5

Adding the dynamic pmap fields works great for i7/s9 models - but as it turned out, when using a different model, the sensors break. :frowning:

Ive updated the code on GH to add better error handling to prevent this! :slight_smile:

As suggested by @LordShadowen, the Lovelace Card Repo has also been updated to hide the Buttons during the Pending and Empty stages.

1 Like

Hi @Syrius
thanks for the update, I deployed the changes, i started getting these errors in my log after HA was restarted without running any clean operation.

2020-05-05 23:30:37 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.vacuum fails IndexError: list index out of range

I don’t know if its related to regex_findall_index function to attribute templates
pmap0_id, pmap0_timestamp, I only looked at them because the syntax highlighting caught my attention.

for my roomba i7 this -> {{ state_attr('sensor.rest980', 'pmaps')[0] }}
returns something like this -> {‘qvibGC8-Rs8MQkOpOWyMst’: ‘191207T170344’}`

testing both regex shown below in developer tools template i get
“Unknown error rendering template”

{{ state_attr('sensor.rest980', 'pmaps')[0] | regex_findall_index("{'(\w+)': '\w+\'}") }}
{{ state_attr('sensor.rest980', 'pmaps')[0] | regex_findall_index("{'\w+': '(\w+)\'}") }}

I fixed the regex issue by replacing \w with [\w\-] in the 1st portion only, i changed the \' to ' to balance the single quotes, it did not cause any errors

now I have these 2

{{ state_attr('sensor.rest980', 'pmaps')[0] | regex_findall_index("{'([\w\-]+)': '\w+'}") }}
{{ state_attr('sensor.rest980', 'pmaps')[0] | regex_findall_index("{'[\w\-]+': '(\w+)'}") }}

the output of both lines now is the following 2, the errors so far seemed to have stopped. did a quick dry run performing selective cleaning small room no errors.

qvibGC8-Rs8MQkOpOWyMst
191207T170344

hmm ok… what version of HA are you running?

I’m on 0.109.4 and this works as expected
{{ state_attr('sensor.rest980', 'pmaps')[0] | regex_findall_index("{'(\w+)': '\w+\'}") }}

I upgraded to 0.109.4 just today before I upgraded Roomba.
The issue is my Roomba is returning - in the 1st value
the regular expresion \w i think it matches A-Z a-z 0-9 and _ but not -.
im guessing your roomba pmaps 1st returned value does not have -

aaah true point

thanks and noted, ill update the repo to use your strings :+1:

hey @Syrius!
great work!

did I get it right that the rest-980 plugin excludes the official roomba plugin now?
I don’t get location information with the official roomba plugin, I see it in /api/local/info/state though.

Now how do I get my vacuum.roomba entity back? To even start/pause the robot?
(I just migrated from 108.0 and up until this point still used my old method with automations to generate the map, maybe you can give me a hint on how I can continue using this because I don’t even have the room cleaning feature with my 960 unfortunately , thanks)
Thanks

Anyones i7 on software version 3.6.6? Having issues now and I’m wondering if its to do with this new firmware.

The rest980 plugin is completely separate from the official plugin and they don’t play nice together :slight_smile:

Regarding the missing position info in the official integration - 0.109.6 which has a fix to restore this! #35316

1 Like

Aus Region latest is 3.2.9 :frowning:

What issues you noticing?