From 32e93de62f06ef4f1c5a0f7361b3cdefa0e91858 Mon Sep 17 00:00:00 2001 From: bittles Date: Sat, 31 Dec 2022 10:29:23 -0500 Subject: [PATCH] try to change blank errno to handle life span if type detected catch if no td in result --- custom_components/ecovacs/sucksbumper.py | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/custom_components/ecovacs/sucksbumper.py b/custom_components/ecovacs/sucksbumper.py index 748642e..d61a2ac 100644 --- a/custom_components/ecovacs/sucksbumper.py +++ b/custom_components/ecovacs/sucksbumper.py @@ -980,19 +980,23 @@ class EcoVacsXMPP(ClientXMPP): return result elif 'type' in result: - result['event'] = result.pop('type') - if xml: - result.update(xml[0].attrib) +# result['event'] = result.pop('type') + if 'errno' in result: + if result['errno'] = '': + result['errno'] = 'handle_life_span' + result['event'] = result.pop('errno') + if xml: + result.update(xml[0].attrib) - for key in result: - if not RepresentsInt(result[key]): #Fix to handle negative int values - result[key] = stringcase.snakecase(result[key]) - - _LOGGER.debug("type detected in result and result is:") - _LOGGER.debug(result) - _LOGGER.debug("end of type detect result") - - return result + for key in result: + if not RepresentsInt(result[key]): #Fix to handle negative int values + result[key] = stringcase.snakecase(result[key]) + + _LOGGER.debug("type detected in result and result is:") + _LOGGER.debug(result) + _LOGGER.debug("end of type detect result") + + return result else: # This happens for commands with no response data, such as PlaySound