catch messages without td in event
This commit is contained in:
@@ -940,10 +940,7 @@ class EcoVacsXMPP(ClientXMPP):
|
|||||||
_LOGGER.debug("result from xml is :")
|
_LOGGER.debug("result from xml is :")
|
||||||
_LOGGER.debug(result)
|
_LOGGER.debug(result)
|
||||||
_LOGGER.debug("end of result")
|
_LOGGER.debug("end of result")
|
||||||
if 'td' not in result:
|
if 'td' in result:
|
||||||
# This happens for commands with no response data, such as PlaySound
|
|
||||||
return
|
|
||||||
|
|
||||||
result['event'] = result.pop('td')
|
result['event'] = result.pop('td')
|
||||||
if xml:
|
if xml:
|
||||||
result.update(xml[0].attrib)
|
result.update(xml[0].attrib)
|
||||||
@@ -954,6 +951,21 @@ class EcoVacsXMPP(ClientXMPP):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
elif 'type' in result:
|
||||||
|
result['event'] = result.pop('type')
|
||||||
|
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])
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
else
|
||||||
|
# This happens for commands with no response data, such as PlaySound
|
||||||
|
return
|
||||||
|
|
||||||
def register_callback(self, userdata, message):
|
def register_callback(self, userdata, message):
|
||||||
|
|
||||||
self.register_handler(Callback(kind,
|
self.register_handler(Callback(kind,
|
||||||
|
|||||||
Reference in New Issue
Block a user