diff --git a/pyad2usb/ad2usb.py b/pyad2usb/ad2usb.py index 617645a..c3af11e 100644 --- a/pyad2usb/ad2usb.py +++ b/pyad2usb/ad2usb.py @@ -484,26 +484,12 @@ class AD2USB(object): else: self.on_disarm() - # Battery status toggle. This is kinda ugly.. may be a better way to do it. - if message.battery_low != self._battery_status[0]: - if time.time() > self._battery_status[1] + AD2USB.BATTERY_TIMEOUT: - self._battery_status, self._previous_battery_status = (message.battery_low, time.time()), self._battery_status - - self.on_low_battery(self._battery_status) - - else: - self._previous_battery_status = self._battery_status - - else: - if self._battery_status[0] == self._previous_battery_status[0]: - self._battery_status = (self._battery_status[0], time.time()) - if message.battery_low == self._battery_status[0]: self._battery_status = (self._battery_status[0], time.time()) else: if message.battery_low == True or time.time() > self._battery_status[1] + AD2USB.BATTERY_TIMEOUT: self._battery_status = (message.battery_low, time.time()) - self.on_fire(self._battery_status) + self.on_low_battery(self._battery_status) if message.fire_alarm == self._fire_status[0]: self._fire_status = (self._fire_status[0], time.time()) diff --git a/pyad2usb/messages.py b/pyad2usb/messages.py index e5f4ca8..21f6f84 100644 --- a/pyad2usb/messages.py +++ b/pyad2usb/messages.py @@ -62,7 +62,7 @@ class Message(object): self.bitfield, self.numeric_code, self.panel_data, alpha = m.group(1, 2, 3, 4) self.mask = int(self.panel_data[3:3+8], 16) - self.data = data + self.raw = data self.ready = not self.bitfield[1:2] == "0" self.armed_away = not self.bitfield[2:3] == "0" self.armed_home = not self.bitfield[3:4] == "0"