Update packet_id
@@ -27,7 +27,9 @@ def parse_xiaogui(self, data, source_mac, rssi):
}
xvalue = data[3:11]
- (packet_id, weight, impedance, control, stablilized_byte) = unpack(">BHHHB", xvalue)
+ (frame_cnt, weight, impedance, control, stablilized_byte) = unpack(">BHHHB", xvalue)
+ packet_id = frame_cnt << 8 | stablilized_byte
+
result.update({"packet": packet_id})
if stablilized_byte == 0x20:
@@ -57,8 +59,7 @@ def parse_xiaogui(self, data, source_mac, rssi):
)
return None
- # Check for duplicate messages (only when stabilized)
- if stablilized_byte == 0x21:
+ # Check for duplicate messages
try:
prev_packet = self.lpacket_ids[xiaogui_mac]
except KeyError:
