diff --git a/README.rst b/README.rst index 44a7230..6640ce9 100644 --- a/README.rst +++ b/README.rst @@ -33,11 +33,14 @@ or from source: ------------ Requirements ------------ +Required: * An `AlarmDecoder`_ device * Python 2.7 +* `pyserial`_ >= 2.7 + +Optional: * `pyftdi`_ >= 0.9.0 * `pyusb`_ >= 1.0.0b1 -* `pyserial`_ >= 2.7 * `pyopenssl`_ ------------- @@ -52,7 +55,7 @@ A basic example is included below. Please see the `examples`_ directory for mor import time from alarmdecoder import AlarmDecoder - from alarmdecoder.devices import USBDevice + from alarmdecoder.devices import SerialDevice def main(): """ @@ -60,11 +63,11 @@ A basic example is included below. Please see the `examples`_ directory for mor """ try: # Retrieve the first USB device - device = AlarmDecoder(USBDevice.find()) + device = AlarmDecoder(SerialDevice(interface='/dev/ttyUSB0')) # Set up an event handler and open the device device.on_message += handle_message - with device.open(): + with device.open(baudrate=115200): while True: time.sleep(1) diff --git a/docs/build/doctrees/alarmdecoder.doctree b/docs/build/doctrees/alarmdecoder.doctree index ef6e7b2..24872c4 100644 Binary files a/docs/build/doctrees/alarmdecoder.doctree and b/docs/build/doctrees/alarmdecoder.doctree differ diff --git a/docs/build/doctrees/environment.pickle b/docs/build/doctrees/environment.pickle index 1e9c526..ef4d879 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index 4722afe..24d779d 100644 --- a/docs/build/html/.buildinfo +++ b/docs/build/html/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d1da78485e879674427d47d917d46635 -tags: a205e9ed8462ae86fdd2f73488852ba9 +config: 8fd355ab18ea10d4d654aef01edd4d38 +tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/build/html/_modules/alarmdecoder/decoder.html b/docs/build/html/_modules/alarmdecoder/decoder.html index 3b80d11..358fe9b 100644 --- a/docs/build/html/_modules/alarmdecoder/decoder.html +++ b/docs/build/html/_modules/alarmdecoder/decoder.html @@ -74,7 +74,8 @@ on_arm = event.Event("This event is called when the panel is armed.\n\n**Callback definition:** *def callback(device)*") on_disarm = event.Event("This event is called when the panel is disarmed.\n\n**Callback definition:** *def callback(device)*") on_power_changed = event.Event("This event is called when panel power switches between AC and DC.\n\n**Callback definition:** *def callback(device, status)*") - on_alarm = event.Event("This event is called when the alarm is triggered.\n\n**Callback definition:** *def callback(device, status)*") + on_alarm = event.Event("This event is called when the alarm is triggered.\n\n**Callback definition:** *def callback(device, zone)*") + on_alarm_restored = event.Event("This event is called when the alarm stops sounding.\n\n**Callback definition:** *def callback(device, zone)*") on_fire = event.Event("This event is called when a fire is detected.\n\n**Callback definition:** *def callback(device, status)*") on_bypass = event.Event("This event is called when a zone is bypassed. \n\n\n\n**Callback definition:** *def callback(device, status)*") on_boot = event.Event("This event is called when the device finishes booting.\n\n**Callback definition:** *def callback(device)*") @@ -142,7 +143,7 @@ :type device: Device """ self._device = device - self._zonetracker = Zonetracker() + self._zonetracker = Zonetracker(self) self._battery_timeout = AlarmDecoder.BATTERY_TIMEOUT self._fire_timeout = AlarmDecoder.FIRE_TIMEOUT @@ -154,6 +155,7 @@ self._battery_status = (False, 0) self._panic_status = None self._relay_status = {} + self._internal_address_mask = 0xFFFFFFFF self.address = 18 self.configbits = 0xFF00 @@ -224,6 +226,25 @@ :type value: int """ self._fire_timeout = value + + @property + def internal_address_mask(self): + """ + Retrieves the address mask used for updating internal status. + + :returns: address mask + """ + return self._internal_address_mask + + @internal_address_mask.setter +