diff --git a/alarmdecoder/decoder.py b/alarmdecoder/decoder.py index f377e57..9398c1f 100644 --- a/alarmdecoder/decoder.py +++ b/alarmdecoder/decoder.py @@ -502,7 +502,7 @@ class AlarmDecoder(object): self._alarm_status, old_status = message.alarm_sounding, self._alarm_status if old_status is not None: - self.on_alarm(status=self._alarm_status) + self.on_alarm(status=self._alarm_status, zone=message.numeric_code) return self._alarm_status diff --git a/examples/alarm_email.py b/examples/alarm_email.py index 40ff91d..573d174 100644 --- a/examples/alarm_email.py +++ b/examples/alarm_email.py @@ -31,11 +31,13 @@ def main(): except Exception, ex: print 'Exception:', ex -def handle_alarm(sender, status): +def handle_alarm(sender, **kwargs): """ Handles alarm events from the AlarmDecoder. """ - text = "Alarm status: {0}".format(status) + status = kwargs.pop('status', None) + zone = kwargs.pop('zone', None) + text = "Alarm status: {0} - Zone {1}".format(status, zone) # Build the email message msg = MIMEText(text)