Skip to content

Commit

Permalink
Fixed parseHandler bug causing the data port to be truncated when it …
Browse files Browse the repository at this point in the history
…contained multiple commas.
  • Loading branch information
ufodone committed Jan 14, 2023
1 parent cbc63da commit be8f9fd
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions custom_components/envisalink_new/pyenvisalink/honeywell_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,20 @@ def parseHandler(self, rawInput):

# keep first sentinel char to tell difference between tpi and
# Envisalink command responses. Drop the trailing $ sentinel.
inputList = rawInput[start_idx:end_idx].split(",")
code = inputList[0]
cmd['code'] = code
cmd['data'] = inputList[1]
inputList = rawInput[start_idx:end_idx]
cmd_sep_idx = inputList.find(',')
if cmd_sep_idx == -1:
code = inputList
cmd['code'] = code
cmd['data'] = ''
else:
code = inputList[0:cmd_sep_idx]
cmd['code'] = code
cmd['data'] = inputList[cmd_sep_idx+1:]

rawInput = rawInput[end_idx+1:]

_LOGGER.debug(str.format("Code:{0} Data:{1}", cmd['code'], cmd['data']))
_LOGGER.debug(str.format("Code:{0} Data:'{1}'", cmd['code'], cmd['data']))

try:
cmd['handler'] = "handle_%s" % evl_ResponseTypes[code]['handler']
Expand All @@ -126,7 +133,7 @@ def handle_login(self, code, data):
self.create_internal_task(self.queue_login_response(), name="queue_login_response")

async def queue_login_response(self):
await self.send_data(self._alarmPanel.password)
await self.send_data(self._alarmPanel.password)

def handle_command_response(self, code, data):
"""Handle the envisalink's initial response to our commands."""
Expand Down

0 comments on commit be8f9fd

Please sign in to comment.