From fea12a148ba9c6ee892ec1cde0fbd0a4c104adac Mon Sep 17 00:00:00 2001 From: Scott Petersen Date: Tue, 13 Jun 2017 15:35:25 -0700 Subject: [PATCH] Including human-readable event description in LRR messages. --- alarmdecoder/messages/lrr/message.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/alarmdecoder/messages/lrr/message.py b/alarmdecoder/messages/lrr/message.py index c6c786e..495d06e 100644 --- a/alarmdecoder/messages/lrr/message.py +++ b/alarmdecoder/messages/lrr/message.py @@ -12,7 +12,7 @@ devices. from .. import BaseMessage from ...util import InvalidMessageError -from .events import LRR_EVENT_TYPE +from .events import LRR_EVENT_TYPE, get_event_description class LRRMessage(BaseMessage): @@ -39,6 +39,8 @@ class LRRMessage(BaseMessage): """Event status flag that represents triggered or restored events.""" event_code = 0 """Event code for the LRR message.""" + event_description = '' + """Human-readable description of LRR event.""" def __init__(self, data=None): """ @@ -78,6 +80,7 @@ class LRRMessage(BaseMessage): self.event_source = _get_event_source(self.event_prefix) self.event_status = int(event_type_data[1][0]) self.event_code = int(event_type_data[1][1:], 16) + self.event_description = get_event_description(self.event_source, self.event_code) except ValueError: raise InvalidMessageError('Received invalid message: {0}'.format(data)) @@ -97,6 +100,7 @@ class LRRMessage(BaseMessage): event_source = self.event_source, event_status = self.event_status, event_code = hex(self.event_code), + event_description = self.event_description, **kwargs )