MisterWil / abodepy

A thin Python wrapper for the Abode alarm API
MIT License
49 stars 17 forks source link

Listen stack trace error #5

Closed MisterWil closed 6 years ago

MisterWil commented 6 years ago

Occasionally, but not always, on connection to the Abode SocketIO server a packet is received: b'2:401:3'

This packet results in a stack trace from the socketIO_client: ValueError: invalid literal for int() with base 10: '2:401'

This is due to a minor logic bug in socketIO_client/parsers.py where in _read_packet_length() the logic needs to be that packet_length_string starts at the start index and not 0:

def _read_packet_length(content, content_index):
    indx = content_index
    while content.decode()[content_index] != ':':
        content_index += 1
    packet_length_string = content.decode()[indx:content_index]
    return content_index, int(packet_length_string)

However, when the bug is fixed the socketIO_client seems to get stuck in some sort of reconnect loop. Further debugging is required.

MisterWil commented 6 years ago

I believe I resolved this by correctly referencing the socketio_client3 version 0.8.0 -- or, at least, I can't recreate this particular issue any longer.