Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zones 15 and 16 cause Nessclient 0.9.13 to loose connection #28

Closed
ant-car opened this issue Feb 28, 2019 · 1 comment
Closed

Zones 15 and 16 cause Nessclient 0.9.13 to loose connection #28

ant-car opened this issue Feb 28, 2019 · 1 comment

Comments

@ant-car
Copy link

ant-car commented Feb 28, 2019

Hi Nick,

I'm not too sure about the best way to get in touch with you regarding the issue I'm having with the current build of nessclient.
With P199E options 1, 2, 3 and 6 enabled I get the following error when triggering Zones 15 and 16. I only have zones 1-4, 15 and 16 connected to my panel at the moment.

I'm pretty sure the issue is in the decode function of the event class as it's converting decimal 15/16 to hex 21/22 and saving that as the zone.

Unfortunately i'm not yet confident enough in python (or github) to create a pull request to fix this but I think you need to change
zone=data[1], on line 102 of event.py to
zone=int(data[1], 16),

The debug log for outputs 15 and 16 is copied below.

Zone 16:


DEBUG:nessclient.client:Decoding data: '8700036100160019022823032274'
DEBUG:nessclient.packet:Decoding bytes: '8700036100160019022823032274'
<SystemStatusEvent {'address': 0, 'timestamp': datetime.datetime(2019, 2, 28, 23, 3, 22), 'type': <EventType.UNSEALED: 0>, 'zone': 22, 'area': 0}>
ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<Client.keepalive() done, defined at /usr/local/lib/python3.7/site-packages/nessclient/client.py:145> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/nessclient/client.py", line 148, in keepalive
    self._update_loop(),
  File "/usr/local/lib/python3.7/site-packages/nessclient/client.py", line 131, in _recv_loop
    self.alarm.handle_event(event)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 50, in handle_event
    self._handle_system_status_event(event)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 81, in _handle_system_status_event
    return self._update_zone(event.zone, True)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 113, in _update_zone
    zone = self.zones[zone_id - 1]
IndexError: list index out of range

Zone 15


DEBUG:nessclient.client:Decoding data: '8700036100150019022823094849'
DEBUG:nessclient.packet:Decoding bytes: '8700036100150019022823094849'
<SystemStatusEvent {'address': 0, 'timestamp': datetime.datetime(2019, 2, 28, 23, 9, 48), 'type': <EventType.UNSEALED: 0>, 'zone': 21, 'area': 0}>
ERROR:asyncio:Task exception was never retrieved
future: <Task finished coro=<Client.keepalive() done, defined at /usr/local/lib/python3.7/site-packages/nessclient/client.py:145> exception=IndexError('list index out of range')>
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/nessclient/client.py", line 148, in keepalive
    self._update_loop(),
  File "/usr/local/lib/python3.7/site-packages/nessclient/client.py", line 131, in _recv_loop
    self.alarm.handle_event(event)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 50, in handle_event
    self._handle_system_status_event(event)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 81, in _handle_system_status_event
    return self._update_zone(event.zone, True)
  File "/usr/local/lib/python3.7/site-packages/nessclient/alarm.py", line 113, in _update_zone
    zone = self.zones[zone_id - 1]
IndexError: list index out of range

Regards,
Anthony

@nickw444
Copy link
Owner

Hey @ant-car thanks for the detailed report. I have raised a pull request #29 with a potential solution to this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants