update version number, remove logging, update readme

This commit is contained in:
bittles
2023-01-02 17:35:14 -05:00
parent 05818b8c23
commit 414ae81041
3 changed files with 44 additions and 42 deletions
+3 -1
View File
@@ -3,7 +3,9 @@ Replaces built in ecovacs component.
Works with bumper with my N79 and should work with at least other XMPP based ecovacs. Don't know if changes will work with MQTT based ones. Works with bumper with my N79 and should work with at least other XMPP based ecovacs. Don't know if changes will work with MQTT based ones.
Added additional catches to sucks because my N79 sends some weird payloads, but attributes all pull in now for brush life spans. Couple initial queries it also sends weird that I'm in process of catching atm. Added additional catches to sucks because my N79 sends some weird payloads, but attributes all pull in now for brush life spans. Couple initial queries it also sends weird that I'm in process of catching atm. As of version 1.3.0 (in the manifest.json) these initial queries and all attributes are working. Was using an implementation completely mine but saw in the MQTT class there were already catches for child payloads without the main payload having the expected td in its payload. Kept comments in giving credit and adapted them to work with xmpp.
With bumper and my N79 commands would work but some queries had responses that included errno='', which bumper would flag as an error even though the full response was there. If your debug logs are throwing errors and the errno is '' then my small fork of bumper may help https://github.com/bittles/bumper-fork
Should work as regular if bumper isn't used in config but haven't tested yet, goal was to get it all local. Maybe mess around and test it in future. Should work as regular if bumper isn't used in config but haven't tested yet, goal was to get it all local. Maybe mess around and test it in future.
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"domain": "ecovacs", "domain": "ecovacs",
"name": "Ecovacs Bumper", "name": "Ecovacs Bumper",
"version": "1.2.0", "version": "1.3.0",
"documentation": "https://www.home-assistant.io/integrations/ecovacs", "documentation": "https://www.home-assistant.io/integrations/ecovacs",
"requirements": ["sleekxmppfs==1.4.1", "click>=6", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"], "requirements": ["sleekxmppfs==1.4.1", "click>=6", "requests>=2.18", "pycryptodome>=3.4", "pycountry-convert>=0.5", "paho-mqtt>=1.4", "stringcase>=1.2"],
"codeowners": ["@OverloadUT", "@mib1185"], "codeowners": ["@OverloadUT", "@mib1185"],
+40 -40
View File
@@ -946,13 +946,13 @@ class EcoVacsXMPP(ClientXMPP):
self.ctl_subscribers.append(function) self.ctl_subscribers.append(function)
def _handle_ctl(self, message): def _handle_ctl(self, message):
_LOGGER.debug("message in handle_ctl is:") # _LOGGER.debug("message in handle_ctl is:")
_LOGGER.debug(message) # _LOGGER.debug(message)
# the_good_part = str(message.payload.decode("utf-8")) # the_good_part = str(message.payload.decode("utf-8"))
# the_good_part = message.get_payload()[0][0] # the_good_part = message.get_payload()[0][0]
the_good_part = message.get_payload()[0][0] the_good_part = message.get_payload()[0][0]
_LOGGER.debug("the_good_part in handle_ctl is :") # _LOGGER.debug("the_good_part in handle_ctl is :")
_LOGGER.debug(the_good_part) # _LOGGER.debug(the_good_part)
# the_other_part = None # the_other_part = None
# try: # try:
# the_other_part = message.get_payload()[0][0][0] # the_other_part = message.get_payload()[0][0][0]
@@ -961,8 +961,8 @@ class EcoVacsXMPP(ClientXMPP):
# except IndexError: # except IndexError:
# _LOGGER.debug("No extra payload") # _LOGGER.debug("No extra payload")
as_dict = self._ctl_to_dict(the_good_part) as_dict = self._ctl_to_dict(the_good_part)
_LOGGER.debug("handle ctl called with as_dict:") # _LOGGER.debug("handle ctl called with as_dict:")
_LOGGER.debug(as_dict) # _LOGGER.debug(as_dict)
if as_dict is not None: if as_dict is not None:
for s in self.ctl_subscribers: for s in self.ctl_subscribers:
s(as_dict) s(as_dict)
@@ -984,74 +984,74 @@ class EcoVacsXMPP(ClientXMPP):
def _ctl_to_dict(self, xml): def _ctl_to_dict(self, xml):
#Including changes from jasonarends @ 28da7c2 below #Including changes from jasonarends @ 28da7c2 below
result = xml.attrib.copy() result = xml.attrib.copy()
_LOGGER.debug("result is:") # _LOGGER.debug("result is:")
_LOGGER.debug(result) # _LOGGER.debug(result)
# if other_xml is not None: # if other_xml is not None:
# other_result = other_xml.attrib.copy() # other_result = other_xml.attrib.copy()
# _LOGGER.debug("other result:") # _LOGGER.debug("other result:")
# _LOGGER.debug(other_result) # _LOGGER.debug(other_result)
# _LOGGER.debug(xml[0].tag) # _LOGGER.debug(xml[0].tag)
if 'td' not in result: if 'td' not in result:
_LOGGER.debug("td not in result:") # _LOGGER.debug("td not in result:")
_LOGGER.debug(result) # _LOGGER.debug(result)
# This happens for commands with no response data, such as PlaySound # This happens for commands with no response data, such as PlaySound
# Handle response data with no 'td' # Handle response data with no 'td'
if 'type' in result: # single element with type and val if 'type' in result: # single element with type and val
_LOGGER.debug("type detected in result, result before event handling:") # _LOGGER.debug("type detected in result, result before event handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
result['event'] = "LifeSpan" # seems to always be LifeSpan type result['event'] = "LifeSpan" # seems to always be LifeSpan type
# result['event'] = "life_span" # seems to always be LifeSpan type # result['event'] = "life_span" # seems to always be LifeSpan type
_LOGGER.debug("result after event LifeSpan handling:") # _LOGGER.debug("result after event LifeSpan handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
else: else:
if xml[0] is not None: if xml[0] is not None:
# if other_xml is not None: # case where there is child element # if other_xml is not None: # case where there is child element
_LOGGER.debug("child xml detected, [0] tag is") # _LOGGER.debug("child xml detected, [0] tag is")
_LOGGER.debug(xml[0].tag) # _LOGGER.debug(xml[0].tag)
if 'clean' in xml[0].tag: if 'clean' in xml[0].tag:
_LOGGER.debug("clean detected in xml[0].tag, result before event handling:") # _LOGGER.debug("clean detected in xml[0].tag, result before event handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
result['event'] = "CleanReport" result['event'] = "CleanReport"
# result['event'] = "clean_report" # result['event'] = "clean_report"
_LOGGER.debug("result after event clean handling:") # _LOGGER.debug("result after event clean handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
elif 'charge' in xml[0].tag: elif 'charge' in xml[0].tag:
_LOGGER.debug("charge detected in xml[0].tag, result before event handling:") # _LOGGER.debug("charge detected in xml[0].tag, result before event handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
result['event'] = "ChargeState" result['event'] = "ChargeState"
# result['event'] = "charge_state" # result['event'] = "charge_state"
_LOGGER.debug("result after event charge handling:") # _LOGGER.debug("result after event charge handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
elif 'battery' in xml[0].tag: elif 'battery' in xml[0].tag:
_LOGGER.debug("battery detected in xml[0].tag, result before event handling:") # _LOGGER.debug("battery detected in xml[0].tag, result before event handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
result['event'] = "BatteryInfo" result['event'] = "BatteryInfo"
# result['event'] = "battery_info" # result['event'] = "battery_info"
_LOGGER.debug("result after event battery handling:") # _LOGGER.debug("result after event battery handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
else: else:
_LOGGER.warning("other payload detected but didn't catch on any checks, result is: ") # _LOGGER.warning("other payload detected but didn't catch on any checks, result is: ")
_LOGGER.debug(result) # _LOGGER.debug(result)
return return
result.update(xml[0].attrib) result.update(xml[0].attrib)
_LOGGER.debug("result after xml update attrib:") # _LOGGER.debug("result after xml update attrib:")
_LOGGER.debug(result) # _LOGGER.debug(result)
else: # for non-'type' result with no child element, e.g., result of PlaySound else: # for non-'type' result with no child element, e.g., result of PlaySound
_LOGGER.warning("payload didn't catch on any checks, result is: ") # _LOGGER.warning("payload didn't catch on any checks, result is: ")
_LOGGER.debug(result) # _LOGGER.debug(result)
return return
else: # response includes 'td' else: # response includes 'td'
_LOGGER.debug("td detected in result, result before event handling:") # _LOGGER.debug("td detected in result, result before event handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
result['event'] = result.pop('td') result['event'] = result.pop('td')
_LOGGER.debug("result after event td handling:") # _LOGGER.debug("result after event td handling:")
_LOGGER.debug(result) # _LOGGER.debug(result)
if xml: if xml:
result.update(xml[0].attrib) result.update(xml[0].attrib)
_LOGGER.debug("IF XML sub-check result after xml update attrib:") # _LOGGER.debug("IF XML sub-check result after xml update attrib:")
_LOGGER.debug(result) # _LOGGER.debug(result)
for key in result: for key in result:
#Check for RepresentInt to handle negative int values, and ',' for ignoring position updates #Check for RepresentInt to handle negative int values, and ',' for ignoring position updates