|
|
@@ -597,8 +597,6 @@ class AlarmDecoder(object): |
|
|
|
except ValueError: |
|
|
|
alarm_zone = int(message.numeric_code, 16) |
|
|
|
|
|
|
|
print("_update_alarm_status: status={} zone={} user={}".format(alarm_status, alarm_zone, user)) |
|
|
|
|
|
|
|
if alarm_status != self._alarm_status: |
|
|
|
self._alarm_status, old_status = alarm_status, self._alarm_status |
|
|
|
|
|
|
@@ -655,8 +653,6 @@ class AlarmDecoder(object): |
|
|
|
arm_status = message.armed_away |
|
|
|
stay_status = message.armed_home |
|
|
|
|
|
|
|
print("_update_armed_status: status={} status_stay={} - arm_status={} stay_status={}".format(status, status_stay, arm_status, stay_status)) |
|
|
|
|
|
|
|
if arm_status is None or stay_status is None: |
|
|
|
return |
|
|
|
|
|
|
@@ -712,13 +708,10 @@ class AlarmDecoder(object): |
|
|
|
fire_status = message.fire_alarm |
|
|
|
|
|
|
|
last_status, last_update = self._fire_status |
|
|
|
#print("_update_fire_status: fire_status={fire_status} last_status={last_status} last_update={last_update}".format(fire_status=fire_status, last_status=last_status, last_update=last_update)) |
|
|
|
|
|
|
|
|
|
|
|
if self._fire_state == FireState.NONE: |
|
|
|
# Always move to a FIRE state if detected |
|
|
|
if fire_status == True: |
|
|
|
print("FIRE STATE: NONE -> ALARM") |
|
|
|
self._fire_state = FireState.ALARM |
|
|
|
self._fire_status = (fire_status, time.time()) |
|
|
|
|
|
|
@@ -727,7 +720,6 @@ class AlarmDecoder(object): |
|
|
|
elif self._fire_state == FireState.ALARM: |
|
|
|
# If we've received an LRR CANCEL message, move to ACKNOWLEDGED |
|
|
|
if is_lrr and fire_status == False: |
|
|
|
print("FIRE STATE: ALARM -> ACKNOWLEDGED") |
|
|
|
self._fire_state = FireState.ACKNOWLEDGED |
|
|
|
self._fire_status = (fire_status, time.time()) |
|
|
|
self.on_fire(status=FireState.ACKNOWLEDGED) |
|
|
@@ -737,14 +729,12 @@ class AlarmDecoder(object): |
|
|
|
self._fire_status = (fire_status, time.time()) |
|
|
|
|
|
|
|
if fire_status == False and time.time() > last_update + self._fire_timeout: |
|
|
|
print("FIRE STATE: ALARM -> NONE") |
|
|
|
self._fire_state = FireState.NONE |
|
|
|
self.on_fire(status=FireState.NONE) |
|
|
|
|
|
|
|
elif self._fire_state == FireState.ACKNOWLEDGED: |
|
|
|
# If we've received a second LRR FIRE message after a CANCEL, revert back to FIRE and trigger another event. |
|
|
|
if is_lrr and fire_status == True: |
|
|
|
print("FIRE STATE: ACKNOWLEDGED -> ALARM") |
|
|
|
self._fire_state = FireState.ALARM |
|
|
|
self._fire_status = (fire_status, time.time()) |
|
|
|
|
|
|
@@ -754,16 +744,10 @@ class AlarmDecoder(object): |
|
|
|
if last_status != fire_status or fire_status == True: |
|
|
|
self._fire_status = (fire_status, time.time()) |
|
|
|
|
|
|
|
# Handle timeout to revert back to NONE. |
|
|
|
if fire_status != True and time.time() > last_update + self._fire_timeout: |
|
|
|
print("FIRE STATE: ACKNOWLEDGED -> NONE") |
|
|
|
self._fire_state = FireState.NONE |
|
|
|
self.on_fire(status=FireState.NONE) |
|
|
|
|
|
|
|
else: |
|
|
|
print("INVALID FIRE STATE={}".format(self._fire_state)) |
|
|
|
|
|
|
|
|
|
|
|
return self._fire_state == FireState.ALARM |
|
|
|
|
|
|
|
|
|
|
|