Skip to content

Commit

Permalink
Merge pull request #38 from nutechsoftware/dev
Browse files Browse the repository at this point in the history
Improve handling of fire and other alarm state quirks with Ademco panels.
  • Loading branch information
f34rdotcom authored Aug 9, 2019
2 parents 41a3f8c + cf9c940 commit bc9371e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
42 changes: 21 additions & 21 deletions alarmdecoder/decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def _update_armed_ready_status(self, message=None):
if arm_status or stay_status:
exit = False
messageUp = message.text.upper()

if self.mode == ADEMCO:
# skip these messages
if not messageUp.startswith("SYSTEM") and not messageUp.startswith("CHECK"):
Expand All @@ -791,7 +791,7 @@ def _update_armed_ready_status(self, message=None):
else:
# preserve last state
exit = self._exit

if self.mode == DSC:
if any(s in messageUp for s in ("QUICK EXIT", "EXIT DELAY")):
exit = True
Expand Down Expand Up @@ -921,31 +921,31 @@ def _update_fire_status(self, message=None, status=None):
# Quirk in Ademco panels. Fire bit goes on/off if other alarms are on or a system fault
if isinstance(message, Message):
if self.mode == ADEMCO:
# ignore sticky bit on these messages :(
if not message.text.startswith("SYSTEM") and not message.text.startswith("CHECK"):

# if we had an alarm and the sticky bit was cleared then clear the alarm
# if we did not have an alarm and we do now send event
if message.fire_alarm and message.fire_alarm != self._fire_status:
fire_status = message.fire_alarm

# if we had an alarm and the sticky bit was cleared then clear the alarm
## ignore sticky bit on these messages :(
if (not message.text.startswith("SYSTEM") and
not message.text.startswith("CHECK")):
if self._fire_status and not message.alarm_event_occurred:
# fire restore
fire_status = False

# if we had a fire event and it went away and we still have a sticky alarm bit
# then it is not gone yet just restore it
if not message.fire_alarm and self._fire_status:
if message.alarm_event_occurred:
fire_status = self._fire_status
# if we had a fire event and it went away and we still have a sticky alarm bit
# then it is not gone yet just restore it
if not message.fire_alarm and self._fire_status:
if message.alarm_event_occurred:
fire_status = self._fire_status

# if we did not have an alarm and we do now send event
if message.fire_alarm and message.fire_alarm != self._fire_status:
fire_status = message.fire_alarm
# if we had an alarm already and we get it again extend the timeout
if message.fire_alarm and message.fire_alarm == self._fire_status:
self._fire_status = message.fire_alarm
self._fire_status_timeout = time.time()

# if we had an alarm already send and we get it again extend the timeout
if message.fire_alarm and message.fire_alarm == self._fire_status:
self._fire_status = message.fire_alarm
self._fire_status_timeout = time.time()

else:
# if we timeout with an alarm set restore it
# if we timeout with an alarm set restore it
if self._fire_status:
if time.time() > last_update + self._fire_timeout:
fire_status = False

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def readme():
extra_requirements.append('future==0.14.3')

setup(name='alarmdecoder',
version='1.13.7',
version='1.13.8',
description='Python interface for the AlarmDecoder (AD2) family '
'of alarm devices which includes the AD2USB, AD2SERIAL and AD2PI.',
long_description=readme(),
Expand Down

0 comments on commit bc9371e

Please sign in to comment.