From 2070c0b701fd0484b1a4b0dad1b6a658615f4c3a Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Thu, 6 Jul 2017 16:21:44 -0700 Subject: [PATCH] Added a limiter to the automatic sending of '*' when a specific message is displayed to avoid flooding the panel in weird cases. --- alarmdecoder/decoder.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/alarmdecoder/decoder.py b/alarmdecoder/decoder.py index 8415c5d..b69bf4c 100644 --- a/alarmdecoder/decoder.py +++ b/alarmdecoder/decoder.py @@ -122,6 +122,9 @@ class AlarmDecoder(object): self._panic_status = False self._relay_status = {} self._internal_address_mask = 0xFFFFFFFF + + self.last_fault_time = 0 + self.fault_expansion_time_limit = 30 # Seconds self.address = 18 self.configbits = 0xFF00 @@ -693,8 +696,10 @@ class AlarmDecoder(object): # NOTE: This only happens on first boot or after exiting programming mode. if isinstance(message, Message): if not message.ready and ("Hit * for faults" in message.text or "Press * to show faults" in message.text): - self.send('*') - return + if time.time() > self.last_fault_expansion + self.fault_expansion_time_limit: + self.last_fault_expansion = time.time() + self.send('*') + return self._zonetracker.update(message)