I think I got some new progress.
The upgrade of the new startup/keepalive message was good, but only for getting info about the alarm state. This afternoon I thought: what if we find a packet which gives us info about sensor states, but with the same high rate frequency as the recently discovered packet?
So I analyzed things over again and applied a different keepalive packet:
echo -ne "\x80\x01\x02" > /dev/hidraw0
The system responds with 2 relevant types of packets. And for what I see, they only appear when you trigger sensors. So I extended the _read function with additional conditions:
elif packet[:2] == b'\x55\x09' or (packet[:2] == b'\xd8\x08' and packet[10:12] == b'\x55\x09'): # sensor?
# offset is different when packet starts with d8 08
if packet[:2] == b'\x55\x09':
sensordata = packet[0:6]
else:
sensordata = packet[10:16]
# get info
_devtyp = sensordata[2:3]
_state = sensordata[3:4]
_device = sensordata[4:6]
# not sure what the 3rd byte is yet, let's try this
if _devtyp == b'\x00':
devtyp = 'magnetic or PIR'
elif _devtyp == b'\x01':
devtyp = 'PIR with photo'
else:
devtyp = 'unknown'
if _state == b'\x88' or _state == b'\x80':
sensor_state = 'opened'
elif _state == b'\x8a' or _state == b'\x82':
sensor_state = 'closed'
elif _state == b'\x75' or _state == b'\x79' or _state == b'\x7d':
sensor_state = 'triggered'
else:
sensor_state = 'unknown'
# most probably user specific
if _device == b'\x00\x02':
device = 'backdoor'
elif _device == b'\x80\x01':
device = 'frontdoor'
elif _device == b'\x40\x01':
device = 'studio'
elif _device == b'\xc0\x00':
device = 'hall'
elif _device == b'\x00\x01':
device = 'garage'
else:
device = 'unknown'
_LOGGER.info("Sensor changed: packet info: %s %s %s", _devtyp, _state, _device)
_LOGGER.info("Sensor changed: resolves to: %s %s %s", devtyp, sensor_state, device)
pass
Is someone able to test this by using the new startup message and applying the above code as extended condition in the _read function? I’ll change my github repo later on when I’ve done some more tests.