Code Monkey home page Code Monkey logo

roombapy's Introduction

roombapy

CI PyPI PyPI - Downloads PyPI - License

Unofficial iRobot Roomba python library (SDK).

Fork of NickWaterton/Roomba980-Python

This library was created for the Home Assistant Roomba integration.

Installation

pip install roombapy[cli]

Notes

This library is only for firmware 2.x.x Check your robot version!

Only local connections are supported.

How to discover your robots and obtain credentials

roombapy discover <optional ip address>

This will find your Roomba in local network, and obtain credentials automagically whether possible.

Event stream

To get event stream from iRobot, use:

roombapy connect <ip> -p <password>

Output is suitable for piping into tools like jq.

Development

To improve your development experience, you can install pre-commit hooks via the following command. With every commit it will run a set of checks, making sure it meets the quality standards.

pre-commit install

roombapy's People

Contributors

bachp avatar bdraco avatar cyr-ius avatar dependabot[bot] avatar dilski avatar emontnemery avatar erelen-laiquendi avatar freekode avatar glance- avatar jasperslits avatar joostlek avatar nickwaterton avatar onkelbeh avatar orhideous avatar pschmitt avatar scop avatar shenxn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

roombapy's Issues

Unknown error encounterd: ID=0

Hi, when setting up my Roomba 981, I get this error:

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 10:47:33 AM (1 occurrences)
Last logged: 10:47:33 AM

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

CleanShot 2021-12-19 at 10 52 22@2x

connecting to mqtt server on roomba

I have the irobot integration enabled and added my braava M6 using the obtained blid and password and it shows up in homeassistant. How can I issue commands to the roomba mqtt server from HA/hassio. In the integration setup there is no place to give information regarding the mqtt server.

I am trying to acheive room specific cleaning for the braava as mentioned in the post linked below.

NickWaterton#80

error in Homassistantlog

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 7:11:42 AM (1 occurrences)
Last logged: 7:11:42 AM

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

I think the message came after the update of Homeassistent to 2021.12

Unknown error encounterd: ID=0

Geting this i Home Assistant , running
Operativsystem Home Assistant OS 7.0
supervisor-2021.12.1
core-2021.12.1

2021-12-14 13:37:41 WARNING (Thread-9) [roombapy.remote_client] Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new
2021-12-14 13:37:41 ERROR (Thread-9) [roombapy.roomba] Roomba 192.168.107.11 connection error, code UNKNOWN_ERROR

Add exceptions for mqtt client

Exceptions for invalid auth, connection error, etc

https://pypi.org/project/paho-mqtt/#client

0: Connection successful 1: Connection refused - incorrect protocol version 2: Connection refused - invalid client identifier 3: Connection refused - server unavailable 4: Connection refused - bad username or password 5: Connection refused - not authorised 6-255: Currently unused.

Custom firmware for ESP based roombas

Thanks to Service Port and esp8266 we can connect virtually any roomba to homeassistant. Currently there are few options how to do it like here (mqtt depencency) or with esphome (esphome dependency) but I was thinking how cool it well be to just flash some custom firmware to esp8266 and use the built in roomba addon.

After brief look over the code and I don't think, that it is impossible. The most important thing to implement, as I see it, will be:

  • running MQTT Broker in esp8266
  • emulate roomba discovery service on port 5678
  • somehow deal with tls connection in esp8266, because this library forces tls connection
  • emulate roomba MAC address on esp8266

My questions to you are:

  • Can this library use plain instead of TLS connection?
  • Can the mapping feature be disabled? What if I don't send the values? Do I have to feed it with dummy values?
  • which QoS level is used during sub and pub?
  • is here something what I overlook and could be potential hurdle while creating the custom firmware?

Missing evac key in const.py causes exception

I bought a new Roomba i7+ (standard i7 with Clean base) and after adding the integration with Home Assist I see this when the robot returns home to empty its bin:

2020-11-23 15:48:09 ERROR (Thread-9) [root] Uncaught thread exception
Traceback (most recent call last):
File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
self.run()
File "/usr/local/lib/python3.8/threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
self.loop_forever(retry_first_connection=True)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
rc = self.loop(timeout, max_packets)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
rc = self.loop_read(max_packets)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1572, in loop_read
rc = self._packet_read()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2310, in _packet_read
rc = self._packet_handle()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle
return self._handle_publish()
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish
self._handle_on_message(message)
File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
self.on_message(self, self._userdata, message)
File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 219, in on_message
self.decode_topics(json_data)
File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 370, in decode_topics
self.update_state_machine()
File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 480, in update_state_machine
self.current_state = ROOMBA_STATES[self.cleanMissionStatus_phase]
KeyError: 'evac'

in const.py 'evac' is missing from ROOMBA_STATUS. For the error to go away, adding the key is needed.
Proposal is use "Emptying Bin":

"evac": "Emptying Bin",

This is related to: home-assistant/core#43446

I hope it's not a duplicate but I think it's cleaner to have a dedicated issue for the missing config and have it separate from the unresponsive problem

New feature, cleanRoom, implemented in dorita980 and rest980

Dorita980 and rest980 have both picked up an additional command: cleanRoom which accepts a json payload that tells an i7/s9 a list of rooms to clean. This list can be dynamically assembled.

Presently, people are hacking a google home process in order to target rooms for cleaning. This new process is so much tidier and allows for more than one room.

I've run the new dorita980 code from my laptop and it's wonderful. I'd love to see this implemented in Home Assistant and I understand roombapy is how to get it there.

The pull request on dorita980.

My python skills are rusty so I can't pretend I'd be a lot of help here, but I'm hoping someone can jump in. Depending on my free time, I may make a few attempts. If I have any luck, I'll be back to propose changes.

Thanks and happy holidays.

Unknown error encountered: ID=0

Problem:
Using 2021.12 beta, the following appears in the log upon start.
2021-12-04 14:12:53 WARNING (Thread-5) [roombapy.remote_client] Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new
2021-12-04 14:12:53 ERROR (Thread-5) [roombapy.roomba] Roomba 192.168.178.152 connection error, code UNKNOWN_ERROR

With previous versions (2021.11.5) this error was not present.

roombapy_cleaned.py

Could you please tell purpose of newly created file roombapy_cleaned.py?
In which I should continue development?

Connection problem

Vacuum :

R980040
iRobot
Firmware: v2.4.16-126

Log :

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:129
First occurred: 14:21:37 (1 occurrences)
Last logged: 14:21:37

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:166
First occurred: 14:21:37 (1 occurrences)
Last logged: 14:21:37

Unexpectedly disconnected from Roomba 192.168.1.102, code UNKNOWN_ERROR

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:152
First occurred: 14:18:40 (3 occurrences)
Last logged: 14:23:45

Roomba 192.168.1.102 connection error, code UNKNOWN_ERROR

UNSAFE_LEGACY_RENEGOTIATION_DISABLED error in newer versions of Python

Some roombas (such as my 600 series) do not support "RFC 5746 secure renegotiation".
Newer versions of Python use OpenSSL 3, which enforces this standard by default - which means that this library does not work on newer versions of python.

There's some discussion on this on the home assistant core github:
home-assistant/core#82775

From my understanding of the issue, I think where this library sets up the mqtt client
https://github.com/pschmitt/roombapy/blob/master/roombapy/remote_client.py#L84
the ssl context would need modifying as described here:

python/cpython#27776 (comment)

I'm happy to implement this fix, just give me the thumbs up if you'd be happy with the change

RFC - Roomba config flow improvements

Opening this here instead of the HA github for getting some comments here before starting.

I am planning to rewrite the Roomba HA config flow so it uses a multi-step process similar to Hue integration. This should eliminate the manual process to obtain BLID and password.
Ideally it follows these steps:

  1. Enter IP of the bot
  2. Step that shows an image of the Roomba bot with the buttons to be pressed
  3. Automatically read the BLID and password using the existing code
  4. Confirm mode & interval

In a second rewrite I could look into using the discovery to skip nr. 1 but that's not the part that annoys me for now.

I am not sure if this has been attempted in the past.

Refactor module for usage mostly in home-assistant

Hi,
Current code version of the library, quite hard to read, it has a lot of functions which probably useless now.
I would like to completely refactor the module, remove features like: reading from config file, opencv usage, make it lighter. And for now taking care only about features which requires in home-assistant.
What do you think about it?

Also concentrate on compatibility with iRobot

unknown Roomba error

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 12:56:06 PM (1 occurrences)
Last logged: 12:56:06 PM

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:152
First occurred: 12:56:06 PM (1 occurrences)
Last logged: 12:56:06 PM

Roomba 192.168.86.33 connection error, code UNKNOWN_ERROR

Missing state for disconnected base (charging error)

Hi! I've noticed that my Roomba stopped getting updated in my HomeAssistant. In HA logs I saw, that most likely it's caused by unsupported state value of chargingerror which causes the library to throw and exception. I have reported this issue also in HomeAssistant repository if you want to see the stacktrace and Roomba state in my iRobot mobile app.

I have checked the original repo from which this one was forked from, and it seems they have added the missing state:

https://github.com/NickWaterton/Roomba980-Python/blob/02321f31d7a23216ac36a7aa5b10289fd3093a44/roomba/roomba.py#L276

Would it be possible to include it here too? Thank you!

Roomba connection error, code UNKNOWN_ERROR

The problem

Error shown while starting Roomba integration. Seems to have no impact because no other problems has been observed:

2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.remote_client] Connected to Roomba roomba_local_ip, response code = 0
2021-12-24 06:50:03 WARNING (Thread-3) [roombapy.remote_client] Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new
2021-12-24 06:50:03 INFO (Thread-3) [roombapy.roomba] Connecting to Roomba roomba_local_ip
2021-12-24 06:50:03 ERROR (Thread-3) [roombapy.roomba] Roomba roomba_local_ip connection error, code UNKNOWN_ERROR

(see full log below)

Home Assistant versions:

  • core-2021.12.5
  • Python Version: 3.9.7
  • Operating System Version: 5.10.63-v7l
  • Home Assistant OS 7.0
  • supervisor-2021.12.2

In previous version of HA Roomba stopped working

Home Assistant log

Debug logging is set for the following components:

  • roombapy.remote_client
  • roombapy.roomba
2021-12-24 06:49:59 DEBUG (MainThread) [roombapy.remote_client] Setting TLS certificate
2021-12-24 06:50:00 DEBUG (MainThread) [roombapy.roomba] CONTINUOUS connection
2021-12-24 06:50:00 INFO (SyncWorker_9) [roombapy.remote_client] Connecting to roomba_local_ip, attempt 1 of 3
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.remote_client] Connected to Roomba roomba_local_ip, response code = 0
2021-12-24 06:50:03 WARNING (Thread-3) [roombapy.remote_client] Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new
2021-12-24 06:50:03 INFO (Thread-3) [roombapy.roomba] Connecting to Roomba roomba_local_ip
2021-12-24 06:50:03 ERROR (Thread-3) [roombapy.roomba] Roomba roomba_local_ip connection error, code UNKNOWN_ERROR
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"netinfo":{"dhcp":true,"addr":address,"mask":4294967040,"gw":gw,"dns1":gw,"dns2":0,"bssid":"bssid","sec":4}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"wifistat":{"wifi":1,"uap":false,"cloud":1}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"netinfo":{"dhcp":true,"addr":address,"mask":4294967040,"gw":gw,"dns1":gw,"dns2":0,"bssid":"bssid","sec":4}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"wlcfg":{"sec":7,"ssid":"ssid"}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"mac":"mac"}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"country": "ES"}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"cloudEnv": "prod"}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"svcEndpoints":{"svcDeplId": "v011"}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"wifiAnt":1}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"mapUploadAllowed":true}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"localtimeoffset":60,"utctime":1640325005,"pose":{"theta":-102,"point":{"x":-5,"y":-32}}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"batPct":100,"dock":{"known":false},"bin":{"present":true,"full":false},"cleanMissionStatus":{"cycle":"none","phase":"charge","expireM":0,"rechrgM":0,"error":0,"notReady":0,"mssnM":0,"mssnStrtTm":0,"expireTm":0,"rechrgTm":0,"sqft":0,"initiator":"manual","nMssn":1940},"language":0,"noAutoPasses":false,"noPP":false,"ecoCharge":false,"vacHigh":false,"binPause":false,"carpetBoost":true,"openOnly":false,"twoPass":false,"schedHold":false}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"lastCommand":{"command":"quick","time":1640265083,"initiator":"manual"},"langs":[{"en-UK":0},{"fr-FR":1},{"es-ES":2},{"it-IT":3},{"de-DE":4},{"ru-RU":5}],"bbnav":{"aMtrack":3,"nGoodLmrks":3,"aGain":57,"aExpo":148},"bbpanic":{"panics":[8,8,8,8,6]},"bbpause":{"pauses":[0,0,0,0,0,17,17,0,0,0]},"bbmssn":{"nMssn":1940,"nMssnOk":1576,"nMssnC":219,"nMssnF":145,"aMssnM":26,"aCycleM":25},"bbrstinfo":{"nNavRst":375,"nMobRst":1,"causes":"0000"}}}}'
2021-12-24 06:50:03 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"cap":{"pose":1,"ota":2,"multiPass":2,"carpetBoost":1,"pp":1,"binFullDetect":1,"langOta":1,"maps":1,"edge":1,"eco":1,"svcConf":1},"hardwareRev":3,"sku":"R981040","batteryType":"lith","soundVer":"32","uiSwVer":"4582","navSwVer":"01.12.01#1","wifiSwVer":"21045","mobilityVer":"5938","bootloaderVer":"4042","umiVer":"6","softwareVer":"v2.4.16-126","tz":{"events":[{"dt":1633089600,"off":120},{"dt":1635642001,"off":60},{"dt":1648342801,"off":120}],"ver":12},"timezone":"Europe/Madrid"}}}'
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"name":"KT-18","cleanSchedule":{"cycle":["none","none","none","none","none","none","none"],"h":[7,7,7,7,7,7,16],"m":[30,30,30,30,30,30,30]},"bbchg3":{"avgMin":85,"hOnDock":15352,"nAvail":10647,"estCap":12311,"nLithChrg":987,"nNimhChrg":0,"nDocks":234},"bbchg":{"nChgOk":985,"nLithF":0,"aborts":[4,4,4]},"bbswitch":{"nBumper":31854,"nClean":2928,"nSpot":136,"nDock":234,"nDrops":2680}}}}'
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: $aws/things/3193C60410522630/shadow/update, b'{"state":{"reported":{"bbrun":{"hr":938,"min":54,"sqft":3459,"nStuck":174,"nScrubs":558,"nPicks":8936,"nPanics":215,"nCliffsF":13970,"nCliffsR":14595,"nMBStll":0,"nWStll":1,"nCBump":0},"bbsys":{"hr":16627,"min":9}}}}'
2021-12-24 06:50:04 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging
2021-12-24 06:50:06 DEBUG (Thread-3) [roombapy.roomba] Received Roomba Data roomba_local_ip: wifistat, b'{"state":{"reported":{"signal":{"rssi":-57,"snr":32}}}}'
2021-12-24 06:50:06 DEBUG (Thread-3) [roombapy.roomba] State updated to: Charging

Note that some information has been modified to keep it private.

Unknown Error With Upgrade to Home Assistant 2021.12.0

Hi, I am getting the following errors in my log relating to the roomba integration since I upgraded to Home Assistant 2021.12.0:

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 9:05:22 AM (1 occurrences)
Last logged: 9:05:22 AM

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:152
First occurred: 9:05:22 AM (1 occurrences)
Last logged: 9:05:22 AM

Roomba XXX.XXX.XX.XX connection error, code UNKNOWN_ERROR

The roomba seems to be working fine, so these aren't breaking errors.

Unknown error

Might just be a temporary connection issue but saw the "please report" message and pasting it here :)

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 9:46:24 PM (2 occurrences)
Last logged: 9:46:24 PM

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Can't find state refill in predefined Roomba states

I have the iRobot Roomba Combo j9+ connected to Home Assistant and get this error about the refill state missing. Here is the data from that report as well:

{
  "state": {
    "reported": {
      "cleanMissionStatus": {
        "cycle": "clean",
        "phase": "refill",
        "expireM": 0,
        "rechrgM": 0,
        "error": 0,
        "notReady": 0,
        "condNotReady": [],
        "mssnM": 0,
        "expireTm": 0,
        "rechrgTm": 0,
        "mssnStrtTm": 1702319069,
        "operatingMode": 2,
        "initiator": "rmtApp",
        "nMssn": 10,
        "missionId": "..."
      }
    }
  }
}

set_preference from HA

Is there any way to call set_preference from Home Assistant?
Or any other way to change "Two pass" preference?

Thanks!

Roomba i-Series Error lookups

I'm get errors in the HA logs when roomba attempts to lookup the error reason code. Unfortunately I don't have these right now (just restarted), but I will update this when I do get them. It looks like the upstream repo for this has accounted for the newer errors that come with the i-Series robots. Not sure if it makes sense to merge down some of those changes to this fork?

I am running the following robots:

  • Roomba 690

  • Roomba i7+

No password for roomba-password

Hello,
I try to add Roomba i7 to a Home Assistant. It send me here to get connection info, so I used roomba-password:

roomba-password 192.168.49.217
Roomba have to be on Home Base powered on.
Press and hold HOME button until you hear series of tones.
Release button, Wi-Fi LED should be flashing
Press Enter to continue...
hostname=iRobot-XXXXXXX, firmware=lewis+3.12.8+lewis-release-420+10, ip=192.168.49.217, mac=XXXX, robot_name=Roomba, sku=i755840, capabilities={'binFullDetect': 2, 'dockComm': 1, 'wDevLoc': 2, 'bleDevLoc': 0, 'edge': 0, 'maps': 3, 'pmaps': 5, 'tLine': 2, 'area': 1, 'eco': 1, 'multiPass': 2, 'pose': 1, 'team': 1, 'pp': 0, 'lang': 2, '5ghz': 1, 'prov': 3, 'sched': 1, 'svcConf': 1, 'ota': 2, 'log': 2, 'langOta': 0, 'tileScan': 1}, blid=XXXXXXXX, password=

Password is empty.

What does it mean?

Compatibility with Python 3.7

I would like to run this on a Raspberry Pi with smarthomeNG, which unfortunately only supports Python up to version 3.7.
Replacing "cache" in remote_client.py with "lru_cache" would to the trick.
According to the Python Doc "@cache" returns the same as "@lru_cache(maxsize=None)" but would work in Python3.7
See https://docs.python.org/3/library/functools.html

roomba unknow error

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:115
First occurred: 08:46:59 (1 occurrences)
Last logged: 08:46:59

Unknown error encounterd: ID=0.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Logger: roombapy.roomba
Source: /usr/local/lib/python3.9/site-packages/roombapy/roomba.py:152
First occurred: 08:46:59 (1 occurrences)
Last logged: 08:46:59

Roomba 192.168.1.4 connection error, code UNKNOWN_ERROR

Unknown error encountered: ID=7

When I start HomeAssistant I have the error ID = 0 and when Roomba 980 has finished and it comes back to its base
we have the error ID = 7

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.9/site-packages/roombapy/remote_client.py:129
First occurred: 17:16:32 (2 occurrences)
Last logged: 17:56:57

Unknown error encounterd: ID=7.Please report this to: https://github.com/pschmitt/roombapy/issues/new

Roomba i7 in HA crashes

Hello
I have roomba i7 and trying to add it to homeassistant. However I get in the error log

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_protocol.py", line 435, in _handle_request
    resp = await request_handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_app.py", line 504, in _handle
    resp = await handler(request)
  File "/usr/local/lib/python3.10/site-packages/aiohttp/web_middlewares.py", line 117, in impl
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 60, in security_filter_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 100, in forwarded_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 28, in request_context_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 81, in ban_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 236, in auth_middleware
    return await handler(request)
  File "/usr/src/homeassistant/homeassistant/components/http/view.py", line 136, in handle
    result = await result
  File "/usr/src/homeassistant/homeassistant/components/config/config_entries.py", line 148, in post
    return await super().post(request)
  File "/usr/src/homeassistant/homeassistant/components/http/data_validator.py", line 73, in wrapper
    result = await method(view, request, data, *args, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/data_entry_flow.py", line 71, in post
    result = await self._flow_mgr.async_init(
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 226, in async_init
    flow, result = await task
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 253, in _async_init
    result = await self._async_handle_step(flow, flow.init_step, data, init_done)
  File "/usr/src/homeassistant/homeassistant/data_entry_flow.py", line 368, in _async_handle_step
    result: FlowResult = await getattr(flow, method)(user_input)
  File "/usr/src/homeassistant/homeassistant/components/roomba/config_flow.py", line 140, in async_step_user
    devices = await _async_discover_roombas(self.hass, self.host)
  File "/usr/src/homeassistant/homeassistant/components/roomba/config_flow.py", line 331, in _async_discover_roombas
    discovered = await hass.async_add_executor_job(discovery.get_all)
  File "/usr/local/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.10/site-packages/roombapy/discovery.py", line 32, in get_all
    response = self._get_response()
  File "/usr/local/lib/python3.10/site-packages/roombapy/discovery.py", line 53, in _get_response
    data = raw_response.decode()
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 1: invalid start byte

WHat I see in tcpdump (redacted personal stuff):

{"ver":"3","hostname":"iRobot-xxx","robotname":"xxx","robotid":"zzz","ip":"192.168.xxx","mac":"50:14:xx","sw":"lewis+22.29.3+2022-08-23-eb90240ea48+Firmware-Build+1832","sku":"i715840","nc":0,"proto":"mqtt","cap":{"binFullDetect":2,"oMode":2,"dockComm":1,"wDevLoc":2,"bleDevLoc":1,"edge":0,"maps":3,"pmaps":10,"mc":2,"tLine":2,"area":1,"eco":1,"multiPass":2,"team":1,"pp":0,"pose":2,"lang":2,"5ghz":1,"prov":3,"sched":2,"svcConf":1,"ota":2,"log":2,"langOta":0,"ns":1,"tileScan":1}}

Any ideas?

roombapy does not work with hostnames

When trying to use roombapy, with hostnames (e.g. Roomba-BLID.domain or iRobot-BLID.domain) instead of IP address the commands have different results:

  • roomba-password returns Exception: cannot find roomba
  • roomba-discovery returns None
  • roomba-connect returns Exception: cannot find roomba

The same commands and same roomba device are working when using an IP address, tested on two different devices.
Name resolution works and can ping via hostname (I've tested everything on the same machine, which is a Win10 with Python 3.9).

I assume this is intended or a limitation in the code, would it be possible to:

  1. Implement queries by hostname (preferred), or
  2. Ensure with a regex to accept only IP formats

No such file or directory initializing TLS on Python 3.7

When connecting using roomba.py, negotiating TLS with a Roomba 980 or i7+running current firmware dies with a "No such file" error under Python 3.7:

[I 2019-12-25 07:42:04,310] Seting TLS
[E 2019-12-25 07:42:04,312] Error: [Errno 2] No such file or directory

Apparently, with Python 3.7, TLS initialization now returns a FileNotFoundError when the initial attempt fails.

Changing the following around line 375 of roomba.py from:

            except ValueError:   #try V1.3 version

to:

            except (ValueError, FileNotFoundError):   #try V1.3 version

addresses this issue and allows the connection.

I can now connect to my 980. Unfortunately, the i7+ still has issues.

In current version HA couldn't connect to roomba.

In logs i get error:

 File "/usr/local/lib/python3.12/site-packages/roombapy/getpassword.py", line 81, in _get_socket
    ssl_socket = ssl.wrap_socket(
                 ^^^^^^^^^^^^^^^
AttributeError: module 'ssl' has no attribute 'wrap_socket'

Description:
From What's new:
Remove the ssl.wrap_socket() function, deprecated in Python 3.7: instead, create a ssl.SSLContext object and call its ssl.SSLContext.wrap_socket method. Any package that still uses ssl.wrap_socket() is broken and insecure. The function neither sends a SNI TLS extension nor validates server hostname. Code is subject to CWE-295: Improper Certificate Validation. (Contributed by Victor Stinner in python/cpython#94199.)

Roomba j7

unable to retrieve password despite different cipher configurations

Home Assistant 2023.5.2, unable to connect

Unable to connect starting with HA Version 2023.5.2. Right after the most recent update, I've noticed that the Roomba entities are no longer available, and the integration isn't running. "Retrying setup" There are several errors in the logs, related to this.

Roomba i7+
Product Software: 22.52.5
Product Software Updated: March 31 2023

----------------------------------------ERROR---------------------------------------------
Logger: roombapy.remote_client
Source: /usr/local/lib/python3.10/site-packages/roombapy/remote_client.py:77
First occurred: May 8, 2023 at 2:06:40 PM (1172 occurrences)
Last logged: 4:04:07 PM

Unable to connect to 10.xx.xx.xx7

---------------------------------------ERROR---------------------------------------------------
Logger: roombapy.remote_client
Source: /usr/local/lib/python3.10/site-packages/roombapy/remote_client.py:72
First occurred: May 8, 2023 at 2:06:28 PM (3518 occurrences)
Last logged: 4:04:07 PM

Can't connect to 10.xx.xx.xx7, error: timed out
Can't connect to 10.xx.xx.xx7, error: [Errno 111] Connection refused
Can't connect to 10.xx.xx.xx7, error: [Errno 113] Host is unreachable

--------------------------------------WARNING----------------------------------------------------
Logger: roombapy.roomba
Source: /usr/local/lib/python3.10/site-packages/roombapy/roomba.py:166
First occurred: May 8, 2023 at 2:26:44 PM (2 occurrences)
Last logged: May 8, 2023 at 2:26:44 PM

Unexpectedly disconnected from Roomba 10.0.0.207, code UNKNOWN_ERROR

------------------------------------------WARNING-----------------------------------------------
Logger: roombapy.remote_client
Source: /usr/local/lib/python3.10/site-packages/roombapy/remote_client.py:135
First occurred: May 8, 2023 at 2:26:44 PM (2 occurrences)
Last logged: May 8, 2023 at 2:26:44 PM

Unknown disconnection error: ID=16.Kindly use https://github.com/pschmitt/roombapy/issues/new

Any help appreciated.

Home Assistant 2023.5.2
Supervisor 2023.04.1
Operating System 10.1
Frontend 20230503.2 - latest

Roomba i7+ issues with paho-mqtt 1.5.1

The problem

With the Roomba I7+, and I would assume any Roomba with a Clean Base, there appears to be an issue with the bump to paho-mqtt 1.5.1 causing some KeyErrors. This causes the Roomba Integration to get stuck in a state when it goes to do the Bin Empty (evac) mode. I've also noticed that the i7 will become un-responsive after a number of hours. Example each morning the Roomba controls no longer function with no error messages or logs but a re-load of the integration resolves it. The latter issue is very hard to reproduce. It appears that paho-mqtt is a requirement for the iRobot Roomba Integration that took me a bit to track down. I have validated that downgrading the version of paho-mqtt resolves the issue.

Might be similar to home-assistant/core#41423 but I couldn't figure out the exact details of what caused that issue and might be erroneous in relation to this issue.

Environment

  • Home Assistant Core release with the issue: 0.118.X
  • Last working Home Assistant Core release (if known): 0.117.X
  • Operating environment (OS/Container/Supervised/Core): Container
  • Integration causing this issue: iRobot Roomba
  • Link to integration documentation on our website:
    https://www.home-assistant.io/integrations/roomba/

Problem-relevant configuration.yaml

NA

Traceback/Error logs

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3452, in _thread_main
    self.loop_forever(retry_first_connection=True)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1779, in loop_forever
    rc = self.loop(timeout, max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1181, in loop
    rc = self.loop_read(max_packets)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 1572, in loop_read
    rc = self._packet_read()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2310, in _packet_read
    rc = self._packet_handle()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 2936, in _packet_handle
    return self._handle_publish()
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3216, in _handle_publish
    self._handle_on_message(message)
  File "/usr/local/lib/python3.8/site-packages/paho/mqtt/client.py", line 3444, in _handle_on_message
    self.on_message(self, self._userdata, message)
  File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 219, in on_message
    self.decode_topics(json_data)
  File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 370, in decode_topics
    self.update_state_machine()
  File "/usr/local/lib/python3.8/site-packages/roomba/roomba.py", line 480, in update_state_machine
    self.current_state = ROOMBA_STATES[self.cleanMissionStatus_phase]
KeyError: 'evac'

Additional information

There was a previous pull request that was put in to add the Evac state (Bin Empty) into Home Assistant but was closed. home-assistant/core#39913

This change alone won't solve the issue. It also requires and upstream change to roombapy

Adding an Evac state to const.py will solve the KeyError:

ROOMBA_STATES = {                        
    "charge": "Charging",
    "new": "New Mission",         
    "run": "Running",                    
    "resume": "Running",         
    "hmMidMsn": "Recharging",       
    "recharge": "Recharging",           
    "stuck": "Stuck",                  
    "hmUsrDock": "User Docking",         
    "dock": "Docking",      
    "dockend": "Docking - End Mission",
    "cancelled": "Cancelled",    
    "stop": "Stopped",             
    "pause": "Paused",
    "hmPostMsn": "End Mission",
    "evac": "Emptying Bin",
    "": None,          

However I am not sure that will resolve the Roomba becoming un-responsive after a time, hence opening an issue instead of a pull request. I think ideally the Roomba Integration should be updated to work with paho-mqtt 1.5.1 but I'm not sure that I've caught all the necessary changes required. Currently this is a breaking bug that will stop any Roomba with a clean base from not getting stuck when it runs the empty bin procedure.

Package seems to ask different IPs than it should

I noted strange behaviour in HomeAssistant.

My Roomba has IP xxx.xxx.xxx.YYY, but for some reason I logs I see that it asks for xxx.xxx.xxx.ZZZ and I get following errors:

Logger: roombapy.remote_client
Source: /usr/local/lib/python3.10/site-packages/roombapy/remote_client.py:63
First occurred: 23:14:59 (10 occurrences)
Last logged: 23:25:19

Unable to connect to 192.168.0.104
Logger: roombapy.remote_client
Source: /usr/local/lib/python3.10/site-packages/roombapy/remote_client.py:58
First occurred: 23:14:53 (30 occurrences)
Last logged: 23:25:19

Can't connect to 192.168.0.104, error: [Errno 113] Host is unreachable

I have no idea what is the source of this behaviour.

Issue during password receiving

I checked forums, people have problems when they try to get password for Roomba

(homeassistant) [user@localhost]/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy% roomba-password <ROOMBA IP>
Roomba have to be on Home Base powered on.
Press and hold HOME button until you hear series of tones.
Release button, Wi-Fi LED should be flashing
Press Enter to continue...
Traceback (most recent call last):
  File "/home/homeassistant/srv/homeassistant/bin/roomba-password", line 8, in <module>
    sys.exit(password())
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/entry_points.py", line 30, in password
    roomba_password = RoombaPassword(roomba_ip)
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 17, in __init__
    self.server_socket = _get_socket()
  File "/home/homeassistant/srv/homeassistant/lib/python3.8/site-packages/roombapy/getpassword.py", line 76, in _get_socket
    ssl_socket = ssl.wrap_socket(
  File "/usr/local/lib/python3.8/ssl.py", line 1404, in wrap_socket
    context.set_ciphers(ciphers)
ssl.SSLError: ('No cipher can be selected.',)

Any idea what it means?

Better error handling/logging

First off thanks for your hard work.

I'm currently attempting to troubleshoot an issue with the HA integration that relies on this library. I think logging the exception message would've been beneficial in my case. The lines concerned are here. Perhaps it's worth checking if there's a message on the exception and try to log that as well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.