Merge pull request #15 from bittles/dev

fix longstanding error handling i hope
This commit is contained in:
bittles
2023-01-19 16:54:47 -05:00
committed by GitHub
3 changed files with 34 additions and 6 deletions
+1
View File
@@ -1,4 +1,5 @@
# Home Assistant Ecovacs Custom Component with Bumper Support # Home Assistant Ecovacs Custom Component with Bumper Support
# CURRENTLY NOT WORKING AS OF 1/18/23 with latest version until I can get time to look through code
Based off the regular home assistant ecovacs components and bmartin's fork of sucks, https://github.com/bmartin5692/sucks. Replaces built in ecovacs component, with some upgrades and fixes. Allows SSL verification to be set to false to work with a self-hosted bumper server, https://github.com/bmartin5692/bumper, a replacement for Ecovacs servers to truly get local control. Based off the regular home assistant ecovacs components and bmartin's fork of sucks, https://github.com/bmartin5692/sucks. Replaces built in ecovacs component, with some upgrades and fixes. Allows SSL verification to be set to false to work with a self-hosted bumper server, https://github.com/bmartin5692/bumper, a replacement for Ecovacs servers to truly get local control.
Works with bumper with my N79 and should work with other XMPP based ecovacs. Catches some XMPP messages now that the default HASS one misses (at least with my Ecovacs), including some initial queries and also life span for filters and brushes. Includes MQTT robot support from bmartin's fork that's basically unchanged in this since I don't have one of those robots. Works with bumper with my N79 and should work with other XMPP based ecovacs. Catches some XMPP messages now that the default HASS one misses (at least with my Ecovacs), including some initial queries and also life span for filters and brushes. Includes MQTT robot support from bmartin's fork that's basically unchanged in this since I don't have one of those robots.
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"domain": "ecovacs", "domain": "ecovacs",
"name": "Ecovacs Bumper", "name": "Ecovacs Bumper",
"version": "1.5.1", "version": "1.5.2",
"documentation": "https://github.com/bittles/ha_ecovacs_bumper", "documentation": "https://github.com/bittles/ha_ecovacs_bumper",
"issue_tracker": "https://github.com/bittles/ha_ecovacs_bumper/issues", "issue_tracker": "https://github.com/bittles/ha_ecovacs_bumper/issues",
"requirements": ["sleekxmppfs==1.4.1", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"], "requirements": ["sleekxmppfs==1.4.1", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"],
+32 -5
View File
@@ -7,6 +7,7 @@ import os
from sleekxmppfs.xmlstream import ET from sleekxmppfs.xmlstream import ET
from sleekxmppfs.exceptions import XMPPError from sleekxmppfs.exceptions import XMPPError
#from . import sucks_api
from .sucks_mqtt import EcoVacsIOTMQ from .sucks_mqtt import EcoVacsIOTMQ
from .sucks_xmpp import EcoVacsXMPP from .sucks_xmpp import EcoVacsXMPP
@@ -105,14 +106,40 @@ class VacBot():
getattr(self, method)(ctl) getattr(self, method)(ctl)
def _handle_error(self, event): def _handle_error(self, event):
if 'error' in event: if 'error' in event or 'errs' in event:
error = event['error'] error = '' # init error var so it's available outside of first if loop
elif 'errs' in event: if 'error' in event:
error = event['errs'] error = event['error']
if not error == '': elif 'errs' in event:
error = event['errs']
self.errorEvents.notify(error) self.errorEvents.notify(error)
LOGGER.error("*** error = " + error) LOGGER.error("*** error = " + error)
# if not error == '':
"""
Errors
The bot broadcasts error codes for a number of cases.
<ctl td="error" error="BatteryLow" errno="101"></ctl>
The latest error can be requested like so:
Request <ctl td="GetError" />
Response <ctl ret="ok" errs="100"/>
However in some cases the robot sends to code 100 shortly after an error has occurred, meaning that we cannot trust the GetError request to contain the last relevant error. For example, if the robot gets stuck it broadcasts 102 HostHang, then proceeds to stop and broadcasts 100 NoError.
Known error codes
100 NoError: Robot is operational
101 BatteryLow: Low battery
102 HostHang: Robot is stuck
103 WheelAbnormal: Wheels are not moving as expected
104 DownSensorAbnormal: Down sensor is getting abnormal values
110 NoDustBox: Dust Bin Not installed
These codes are taken from model M81 Pro. Error codes may differ between models.
"""
def _handle_life_span(self, event): def _handle_life_span(self, event):
type = event['type'] type = event['type']
try: try: