diff --git a/alarmdecoder/zonetracking.py b/alarmdecoder/zonetracking.py index 739cee5..13be3c3 100644 --- a/alarmdecoder/zonetracking.py +++ b/alarmdecoder/zonetracking.py @@ -196,6 +196,9 @@ class Zonetracker(object): self._update_zone(zone) self._clear_zones(zone) + # Save our spot for the next message. + self._last_zone_fault = zone + else: status = Zone.FAULT if message.check_zone: @@ -205,8 +208,8 @@ class Zonetracker(object): self._zones_faulted.append(zone) self._zones_faulted.sort() - # Save our spot for the next message. - self._last_zone_fault = zone + # A new zone fault, so it is out of sequence. + self._last_zone_fault = 0 self._clear_expired_zones() @@ -243,6 +246,11 @@ class Zonetracker(object): :param zone: current zone being processed :type zone: int """ + + if self._last_zone_fault == 0: + # We don't know what the last faulted zone was, nothing to do + return + cleared_zones = [] found_last_faulted = found_current = at_end = False