diff --git a/README.md b/README.md index bdb1196..5a88236 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,28 @@ Alarm Decoder -================================================================== -#### Interface for the Alarm Decoder (AD2) device family #### +============= +#### Interface for the [Alarm Decoder](http://www.alarmdecoder.com) (AD2) device family #### -This Python library aims to provide a consistent interface for the entire Alarm -Decoder product line, including the AD2USB, AD2SERIAL and AD2PI devices. +This Python library aims to provide a consistent interface for the entire [Alarm +Decoder](http://www.alarmdecoder.com) product line, including the AD2USB, AD2SERIAL and AD2PI devices. This also includes devices that have been exposed via [ser2sock](http://github.com/nutechsoftware/ser2sock), which supports encryption via SSL/TLS. Installation ------------ -alarmdecoder can be installed through pip: +AlarmDecoder can be installed through pip: ```pip install alarmdecoder``` or from source: - ```python setup.py install``` + ``` + git clone http://github.com/nutechsoftware/alarmdecoder + python setup.py install + ``` Requirements ------------ +* An [Alarm Decoder](http://www.alarmdecoder.com) device: AD2USB, AD2SERIAL or AD2PI. +* Python 2.7 * [pyftdi](https://github.com/eblot/pyftdi) >= 0.9.0 * [pyusb](http://sourceforge.net/apps/trac/pyusb/) >= 1.0.0b1 * [pyserial](http://pyserial.sourceforge.net/) >= 2.7 diff --git a/alarmdecoder/decoder.py b/alarmdecoder/decoder.py index 89dfc9d..78612a9 100644 --- a/alarmdecoder/decoder.py +++ b/alarmdecoder/decoder.py @@ -1,5 +1,7 @@ """ -Provides the full AlarmDecoder class. +Provides the main AlarmDecoder class. + +.. _Alarm Decoder: http://www.alarmdecoder.com .. moduleauthor:: Scott Petersen """ @@ -14,34 +16,34 @@ from .zonetracking import Zonetracker class AlarmDecoder(object): """ - High-level wrapper around Alarm Decoder (AD2) devices. + High-level wrapper around `Alarm Decoder`_ (AD2) devices. """ # High-level Events - on_arm = event.Event('Called when the panel is armed.') - on_disarm = event.Event('Called when the panel is disarmed.') - on_power_changed = event.Event('Called when panel power switches between AC and DC.') - on_alarm = event.Event('Called when the alarm is triggered.') - on_fire = event.Event('Called when a fire is detected.') - on_bypass = event.Event('Called when a zone is bypassed.') - on_boot = event.Event('Called when the device finishes bootings.') - on_config_received = event.Event('Called when the device receives its configuration.') - on_zone_fault = event.Event('Called when the device detects a zone fault.') - on_zone_restore = event.Event('Called when the device detects that a fault is restored.') - on_low_battery = event.Event('Called when the device detects a low battery.') - on_panic = event.Event('Called when the device detects a panic.') - on_relay_changed = event.Event('Called when a relay is opened or closed on an expander board.') + on_arm = event.Event('This event is called when the panel is armed.') + on_disarm = event.Event('This event is called when the panel is disarmed.') + on_power_changed = event.Event('This event is called when panel power switches between AC and DC.') + on_alarm = event.Event('This event is called when the alarm is triggered.') + on_fire = event.Event('This event is called when a fire is detected.') + on_bypass = event.Event('This event is called when a zone is bypassed.') + on_boot = event.Event('This event is called when the device finishes booting.') + on_config_received = event.Event('This event is called when the device receives its configuration.') + on_zone_fault = event.Event('This event is called when :py:class:`alarmdecoder.zonetracking.Zonetracker` detects a zone fault.') + on_zone_restore = event.Event('This event is called when :py:class:`alarmdecoder.zonetracking.Zonetracker` detects that a fault is restored.') + on_low_battery = event.Event('This event is called when the device detects a low battery.') + on_panic = event.Event('This event is called when the device detects a panic.') + on_relay_changed = event.Event('This event is called when a relay is opened or closed on an expander board.') # Mid-level Events - on_message = event.Event('Called when a message has been received from the device.') - on_lrr_message = event.Event('Called when an LRR message is received.') - on_rfx_message = event.Event('Called when an RFX message is received.') + on_message = event.Event('This event is called when any message is received.') + on_lrr_message = event.Event('This event is called when an :py:class:`alarmdecoder.messages.LRRMessage` is received.') + on_rfx_message = event.Event('This event is called when an :py:class:`alarmdecoder.messages.RFMessage` is received.') # Low-level Events - on_open = event.Event('Called when the device has been opened.') - on_close = event.Event('Called when the device has been closed.') - on_read = event.Event('Called when a line has been read from the device.') - on_write = event.Event('Called when data has been written to the device.') + on_open = event.Event('This event is called when the device has been opened.') + on_close = event.Event('This event is called when the device has been closed.') + on_read = event.Event('This event is called when a line has been read from the device.') + on_write = event.Event('This event is called when data has been written to the device.') # Constants KEY_F1 = unichr(1) + unichr(1) + unichr(1) @@ -54,15 +56,31 @@ class AlarmDecoder(object): """Represents panel function key #4""" BATTERY_TIMEOUT = 30 - """Timeout before the battery status reverts.""" + """Default timeout (in seconds) before the battery status reverts.""" FIRE_TIMEOUT = 30 - """Timeout before the fire status reverts.""" + """Default tTimeout (in seconds) before the fire status reverts.""" + + # Attributes + address = 18 + """The keypad address in use by the device.""" + configbits = 0xFF00 + """The configuration bits set on the device.""" + address_mask = 0x00000000 + """The address mask configured on the device.""" + emulate_zone = [False for _ in range(5)] + """List containing the devices zone emulation status.""" + emulate_relay = [False for _ in range(4)] + """List containing the devices relay emulation status.""" + emulate_lrr = False + """The status of the devices LRR emulation.""" + deduplicate = False + """The status of message deduplication as configured on the device.""" def __init__(self, device): """ Constructor - :param device: The low-level device used for this Alarm Decoder + :param device: The low-level device used for this `Alarm Decoder`_ interface. :type device: Device """ @@ -105,9 +123,9 @@ class AlarmDecoder(object): @property def id(self): """ - The ID of the Alarm Decoder device. + The ID of the `Alarm Decoder`_ device. - :returns: The identification string for the device. + :returns: identification string for the device """ return self._device.id @@ -116,7 +134,7 @@ class AlarmDecoder(object): """ Retrieves the timeout for restoring the battery status, in seconds. - :returns: The battery status timeout + :returns: battery status timeout """ return self._battery_timeout @@ -125,7 +143,7 @@ class AlarmDecoder(object): """ Sets the timeout for restoring the battery status, in seconds. - :param value: The timeout in seconds. + :param value: timeout in seconds :type value: int """ self._battery_timeout = value @@ -135,7 +153,7 @@ class AlarmDecoder(object): """ Retrieves the timeout for restoring the fire status, in seconds. - :returns: The fire status timeout + :returns: fire status timeout """ return self._fire_timeout @@ -144,7 +162,7 @@ class AlarmDecoder(object): """ Sets the timeout for restoring the fire status, in seconds. - :param value: The timeout in seconds. + :param value: timeout in seconds :type value: int """ self._fire_timeout = value @@ -153,10 +171,10 @@ class AlarmDecoder(object): """ Opens the device. - :param baudrate: The baudrate used for the device. + :param baudrate: baudrate used for the device. Defaults to the lower-level device default. :type baudrate: int :param no_reader_thread: Specifies whether or not the automatic reader - thread should be started or not + thread should be started. :type no_reader_thread: bool """ self._wire_events() @@ -176,17 +194,17 @@ class AlarmDecoder(object): def send(self, data): """ - Sends data to the Alarm Decoder device. + Sends data to the `Alarm Decoder`_ device. - :param data: The data to send. - :type data: str + :param data: data to send + :type data: string """ if self._device: self._device.write(data) def get_config(self): """ - Retrieves the configuration from the device. + Retrieves the configuration from the device. Called automatically by :py:meth:`_on_open`. """ self.send("C\r") @@ -227,9 +245,9 @@ class AlarmDecoder(object): """ Faults a zone if we are emulating a zone expander. - :param zone: The zone to fault. + :param zone: zone to fault :type zone: int - :param simulate_wire_problem: Whether or not to simulate a wire fault. + :param simulate_wire_problem: Whether or not to simulate a wire fault :type simulate_wire_problem: bool """ @@ -250,7 +268,7 @@ class AlarmDecoder(object): """ Clears a zone if we are emulating a zone expander. - :param zone: The zone to clear. + :param zone: zone to clear :type zone: int """ self.send("L{0:02}0\r".format(zone)) @@ -270,10 +288,10 @@ class AlarmDecoder(object): """ Parses messages from the panel. - :param data: Panel data to parse. - :type data: str + :param data: panel data to parse + :type data: string - :returns: An object representing the message. + :returns: :py:class:`alarmdecoder.messages.Message` """ if data is None: raise InvalidMessageError() @@ -310,10 +328,10 @@ class AlarmDecoder(object): """ Handle RF messages. - :param data: RF message to parse. - :type data: str + :param data: RF message to parse + :type data: string - :returns: An object representing the RF message. + :returns: :py:class:`alarmdecoder.messages.RFMessage` """ msg = RFMessage(data) @@ -325,10 +343,10 @@ class AlarmDecoder(object): """ Handle Long Range Radio messages. - :param data: LRR message to parse. - :type data: str + :param data: LRR message to parse + :type data: string - :returns: An object representing the LRR message. + :returns: :py:class:`alarmdecoder.messages.LRRMessage` """ msg = LRRMessage(data) @@ -349,8 +367,8 @@ class AlarmDecoder(object): """ Handles received configuration data. - :param data: Configuration string to parse. - :type data: str + :param data: Configuration string to parse + :type data: string """ _, config_string = data.split('>') for setting in config_string.split('&'): @@ -377,8 +395,8 @@ class AlarmDecoder(object): """ Updates internal device states. - :param message: Message to update internal states with. - :type message: Message, ExpanderMessage, LRRMessage, or RFMessage + :param message: :py:class:`alarmdecoder.messages.Message` to update internal states with + :type message: :py:class:`alarmdecoder.messages.Message`, :py:class:`alarmdecoder.messages.ExpanderMessage`, :py:class:`alarmdecoder.messages.LRRMessage`, or :py:class:`alarmdecoder.messages.RFMessage` """ if isinstance(message, Message): self._update_power_status(message) @@ -397,10 +415,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the AC power state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: bool indicating the new status """ if message.ac_power != self._power_status: self._power_status, old_status = message.ac_power, self._power_status @@ -414,10 +432,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the alarm state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: bool indicating the new status """ if message.alarm_sounding != self._alarm_status: @@ -432,10 +450,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the zone bypass state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: bool indicating the new status """ if message.zone_bypassed != self._bypass_status: @@ -450,10 +468,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the armed state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: bool indicating the new status """ message_status = message.armed_away | message.armed_home @@ -472,10 +490,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the battery state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: boolean indicating the new status """ last_status, last_update = self._battery_status @@ -492,10 +510,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the fire alarm state. - :param message: The message to use to update. - :type message: Message + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.Message` - :returns: Boolean indicating the new status + :returns: boolean indicating the new status """ last_status, last_update = self._fire_status @@ -512,10 +530,10 @@ class AlarmDecoder(object): """ Uses the provided message to update the expander states. - :param message: The message to use to update. - :type message: ExpanderMessage + :param message: message to use to update + :type message: :py:class:`alarmdecoder.messages.ExpanderMessage` - :returns: Boolean indicating the new status + :returns: boolean indicating the new status """ if message.type == ExpanderMessage.RELAY: @@ -527,10 +545,10 @@ class AlarmDecoder(object): def _update_zone_tracker(self, message): """ - Trigger an update of the zonetracker. + Trigger an update of the :py:class:`alarmdecoder.messages.Zonetracker`. - :param message: The message to update the zonetracker with. - :type message: Message, ExpanderMessage, LRRMessage, or RFMessage + :param message: message to update the zonetracker with + :type message: :py:class:`alarmdecoder.messages.Message`, :py:class:`alarmdecoder.messages.ExpanderMessage`, :py:class:`alarmdecoder.messages.LRRMessage`, or :py:class:`alarmdecoder.messages.RFMessage` """ # Retrieve a list of faults. diff --git a/alarmdecoder/devices.py b/alarmdecoder/devices.py index 76d5896..50c73e1 100644 --- a/alarmdecoder/devices.py +++ b/alarmdecoder/devices.py @@ -1,5 +1,16 @@ """ -Contains different types of devices belonging to the Alarm Decoder (AD2) family. +This module contains different types of devices belonging to the `Alarm Decoder`_ (AD2) family. + +* :py:class:`USBDevice`: Interfaces with the `AD2USB`_ device. +* :py:class:`SerialDevice`: Interfaces with the `AD2USB`_, `AD2SERIAL`_ or `AD2PI`_. +* :py:class:`SocketDevice`: Interfaces with devices exposed through `ser2sock`_ or another IP to Serial solution. + Also supports SSL if using `ser2sock`_. + +.. _ser2sock: http://github.com/nutechsoftware/ser2sock +.. _Alarm Decoder: http://www.alarmdecoder.com +.. _AD2USB: http://www.alarmdecoder.com +.. _AD2SERIAL: http://www.alarmdecoder.com +.. _AD2PI: http://www.alarmdecoder.com .. moduleauthor:: Scott Petersen """ @@ -20,14 +31,14 @@ from .event import event class Device(object): """ - Generic parent device to all Alarm Decoder (AD2) products. + Base class for all `Alarm Decoder`_ (AD2) device types. """ # Generic device events - on_open = event.Event('Called when the device has been opened') - on_close = event.Event('Called when the device has been closed') - on_read = event.Event('Called when a line has been read from the device') - on_write = event.Event('Called when data has been written to the device') + on_open = event.Event('This event is called when the device has been opened.') + on_close = event.Event('This event is called when the device has been closed.') + on_read = event.Event('This event is called when a line has been read from the device.') + on_write = event.Event('This event is called when data has been written to the device.') def __init__(self): """ @@ -58,7 +69,7 @@ class Device(object): """ Retrieve the device ID. - :returns: The identification string for the device. + :returns: identification string for the device """ return self._id @@ -67,8 +78,8 @@ class Device(object): """ Sets the device ID. - :param value: The device identification. - :type value: str + :param value: device identification string + :type value: string """ self._id = value @@ -76,7 +87,7 @@ class Device(object): """ Indicates whether or not the reader thread is alive. - :returns: Whether or not the reader thread is alive. + :returns: whether or not the reader thread is alive """ return self._read_thread.is_alive() @@ -112,8 +123,8 @@ class Device(object): """ Constructor - :param device: The device used by the reader thread. - :type device: devices.Device + :param device: device used by the reader thread + :type device: :py:class:`alarmdecoder.devices.Device` """ threading.Thread.__init__(self) self._device = device @@ -146,16 +157,16 @@ class Device(object): class USBDevice(Device): """ - AD2USB device exposed with PyFTDI's interface. + `AD2USB`_ device utilizing PyFTDI's interface. """ # Constants FTDI_VENDOR_ID = 0x0403 - """Vendor ID used to recognize AD2USB devices.""" + """Vendor ID used to recognize `AD2USB`_ devices.""" FTDI_PRODUCT_ID = 0x6001 - """Product ID used to recognize AD2USB devices.""" + """Product ID used to recognize `AD2USB`_ devices.""" BAUDRATE = 115200 - """Default baudrate for AD2USB devices.""" + """Default baudrate for `AD2USB`_ devices.""" __devices = [] __detect_thread = None @@ -166,7 +177,7 @@ class USBDevice(Device): Returns all FTDI devices matching our vendor and product IDs. :returns: list of devices - :raises: CommError + :raises: :py:class:`alarmdecoder.util.CommError` """ cls.__devices = [] @@ -181,24 +192,24 @@ class USBDevice(Device): @classmethod def devices(cls): """ - Returns a cached list of AD2USB devices located on the system. + Returns a cached list of `AD2USB`_ devices located on the system. - :returns: cached list of devices found. + :returns: cached list of devices found """ return cls.__devices @classmethod def find(cls, device=None): """ - Factory method that returns the requested USBDevice device, or the + Factory method that returns the requested :py:class:`USBDevice` device, or the first device. :param device: Tuple describing the USB device to open, as returned by find_all(). :type device: tuple - :returns: USBDevice object utilizing the specified device. - :raises: NoDeviceError + :returns: :py:class:`USBDevice` object utilizing the specified device + :raises: :py:class:`alarmdecoder.util.NoDeviceError` """ cls.find_all() @@ -217,9 +228,9 @@ class USBDevice(Device): """ Starts the device detection thread. - :param on_attached: function to be called when a device is attached. + :param on_attached: function to be called when a device is attached :type on_attached: function - :param on_detached: function to be called when a device is detached. + :param on_detached: function to be called when a device is detached :type on_detached: function """ cls.__detect_thread = USBDevice.DetectThread(on_attached, on_detached) @@ -244,7 +255,7 @@ class USBDevice(Device): """ Retrieves the interface used to connect to the device. - :returns: the interface used to connect to the device. + :returns: the interface used to connect to the device """ return self._interface @@ -253,8 +264,8 @@ class USBDevice(Device): """ Sets the interface used to connect to the device. - :param value: May specify either the serial number or the device index. - :type value: str or int + :param value: may specify either the serial number or the device index + :type value: string or int """ self._interface = value if isinstance(value, int): @@ -267,7 +278,7 @@ class USBDevice(Device): """ Retrieves the serial number of the device. - :returns: The serial number of the device. + :returns: serial number of the device """ return self._serial_number @@ -277,7 +288,7 @@ class USBDevice(Device): """ Sets the serial number of the device. - :param value: The serial number of the device. + :param value: serial number of the device :type value: string """ self._serial_number = value @@ -287,7 +298,7 @@ class USBDevice(Device): """ Retrieves the description of the device. - :returns: The description of the device. + :returns: description of the device """ return self._description @@ -296,7 +307,7 @@ class USBDevice(Device): """ Sets the description of the device. - :param value: The description of the device. + :param value: description of the device :type value: string """ self._description = value @@ -307,7 +318,7 @@ class USBDevice(Device): :param interface: May specify either the serial number or the device index. - :type interface: str or int + :type interface: string or int """ Device.__init__(self) @@ -327,13 +338,13 @@ class USBDevice(Device): """ Opens the device. - :param baudrate: The baudrate to use. + :param baudrate: baudrate to use :type baudrate: int - :param no_reader_thread: Whether or not to automatically start the + :param no_reader_thread: whether or not to automatically start the reader thread. :type no_reader_thread: bool - :raises: NoDeviceError + :raises: :py:class:`alarmdecoder.util.NoDeviceError` """ # Set up defaults if baudrate is None: @@ -384,10 +395,10 @@ class USBDevice(Device): """ Writes data to the device. - :param data: Data to write - :type data: str + :param data: data to write + :type data: string - :raises: CommError + :raises: :py:class:`alarmdecoder.util.CommError` """ try: self._device.write_data(data) @@ -401,8 +412,8 @@ class USBDevice(Device): """ Reads a single character from the device. - :returns: The character read from the device. - :raises: CommError + :returns: character read from the device + :raises: :py:class:`alarmdecoder.util.CommError` """ ret = None @@ -418,14 +429,14 @@ class USBDevice(Device): """ Reads a line from the device. - :param timeout: The read timeout. + :param timeout: read timeout :type timeout: float :param purge_buffer: Indicates whether to purge the buffer prior to reading. :type purge_buffer: bool - :returns: The line that was read. - :raises: CommError, TimeoutError + :returns: line that was read + :raises: :py:class:`alarmdecoder.util.CommError`, :py:class:`alarmdecoder.util.TimeoutError` """ def timeout_event(): @@ -477,7 +488,7 @@ class USBDevice(Device): """ Retrieves the FTDI device serial number. - :returns: string containing the device serial number. + :returns: string containing the device serial number """ return usb.util.get_string(self._device.usb_dev, 64, self._device.usb_dev.iSerialNumber) @@ -485,16 +496,16 @@ class USBDevice(Device): """ Thread that handles detection of added/removed devices. """ - on_attached = event.Event('Called when an AD2USB device has been detected.') - on_detached = event.Event('Called when an AD2USB device has been removed.') + on_attached = event.Event('This event is called when an `AD2USB`_ device has been detected.') + on_detached = event.Event('This event is called when an `AD2USB`_ device has been removed.') def __init__(self, on_attached=None, on_detached=None): """ Constructor - :param on_attached: Function to call when a device is attached. + :param on_attached: Function to call when a device is attached :type on_attached: function - :param on_detached: Function to call when a device is detached. + :param on_detached: Function to call when a device is detached :type on_detached: function """ threading.Thread.__init__(self) @@ -541,7 +552,7 @@ class USBDevice(Device): class SerialDevice(Device): """ - AD2USB or AD2SERIAL device exposed with the pyserial interface. + `AD2USB`_, `AD2SERIAL`_ or `AD2PI`_ device utilizing the PySerial interface. """ # Constants @@ -553,11 +564,11 @@ class SerialDevice(Device): """ Returns all serial ports present. - :param pattern: Pattern to search for when retrieving serial ports. - :type pattern: str + :param pattern: pattern to search for when retrieving serial ports + :type pattern: string :returns: list of devices - :raises: CommError + :raises: :py:class:`alarmdecoder.util.CommError` """ devices = [] @@ -577,7 +588,7 @@ class SerialDevice(Device): """ Retrieves the interface used to connect to the device. - :returns: the interface used to connect to the device. + :returns: interface used to connect to the device """ return self._port @@ -586,7 +597,7 @@ class SerialDevice(Device): """ Sets the interface used to connect to the device. - :param value: The name of the serial device. + :param value: name of the serial device :type value: string """ self._port = value @@ -595,8 +606,8 @@ class SerialDevice(Device): """ Constructor - :param interface: The device to open. - :type interface: str + :param interface: device to open + :type interface: string """ Device.__init__(self) @@ -609,13 +620,13 @@ class SerialDevice(Device): """ Opens the device. - :param baudrate: The baudrate to use with the device. + :param baudrate: baudrate to use with the device :type baudrate: int - :param no_reader_thread: Whether or not to automatically start the + :param no_reader_thread: whether or not to automatically start the reader thread. :type no_reader_thread: bool - :raises: NoDeviceError + :raises: :py:class:`alarmdecoder.util.NoDeviceError` """ # Set up the defaults if baudrate is None: @@ -662,10 +673,10 @@ class SerialDevice(Device): """ Writes data to the device. - :param data: The data to write. - :type data: str + :param data: data to write + :type data: string - :raises: CommError + :raises: py:class:`alarmdecoder.util.CommError` """ try: self._device.write(data) @@ -683,8 +694,8 @@ class SerialDevice(Device): """ Reads a single character from the device. - :returns: The character read from the device. - :raises: CommError + :returns: character read from the device + :raises: :py:class:`alarmdecoder.util.CommError` """ ret = None @@ -700,14 +711,14 @@ class SerialDevice(Device): """ Reads a line from the device. - :param timeout: The read timeout. + :param timeout: read timeout :type timeout: float :param purge_buffer: Indicates whether to purge the buffer prior to reading. :type purge_buffer: bool - :returns: The line that was read. - :raises: CommError, TimeoutError + :returns: line that was read + :raises: :py:class:`alarmdecoder.util.CommError`, :py:class:`alarmdecoder.util.TimeoutError` """ def timeout_event(): @@ -759,8 +770,8 @@ class SerialDevice(Device): class SocketDevice(Device): """ - Device that supports communication with an Alarm Decoder (AD2) that is - exposed via ser2sock or another Serial to IP interface. + Device that supports communication with an `Alarm Decoder`_ (AD2) that is + exposed via `ser2sock`_ or another Serial to IP interface. """ @property @@ -768,7 +779,7 @@ class SocketDevice(Device): """ Retrieves the interface used to connect to the device. - :returns: the interface used to connect to the device. + :returns: interface used to connect to the device """ return (self._host, self._port) @@ -777,7 +788,7 @@ class SocketDevice(Device): """ Sets the interface used to connect to the device. - :param value: Tuple containing the host and port to use. + :param value: Tuple containing the host and port to use :type value: tuple """ self._host, self._port = value @@ -787,7 +798,7 @@ class SocketDevice(Device): """ Retrieves whether or not the device is using SSL. - :returns: Whether or not the device is using SSL. + :returns: whether or not the device is using SSL """ return self._use_ssl @@ -796,7 +807,7 @@ class SocketDevice(Device): """ Sets whether or not SSL communication is in use. - :param value: Whether or not SSL communication is in use. + :param value: Whether or not SSL communication is in use :type value: bool """ self._use_ssl = value @@ -806,7 +817,7 @@ class SocketDevice(Device): """ Retrieves the SSL client certificate path used for authentication. - :returns: The certificate path + :returns: path to the certificate path or :py:class:`OpenSSL.crypto.X509` """ return self._ssl_certificate @@ -815,8 +826,8 @@ class SocketDevice(Device): """ Sets the SSL client certificate to use for authentication. - :param value: The path to the SSL certificate. - :type value: str + :param value: path to the SSL certificate or :py:class:`OpenSSL.crypto.X509` + :type value: string or :py:class:`OpenSSL.crypto.X509` """ self._ssl_certificate = value @@ -825,7 +836,7 @@ class SocketDevice(Device): """ Retrieves the SSL client certificate key used for authentication. - :returns: The key path + :returns: jpath to the SSL key or :py:class:`OpenSSL.crypto.PKey` """ return self._ssl_key @@ -834,8 +845,8 @@ class SocketDevice(Device): """ Sets the SSL client certificate key to use for authentication. - :param value: The path to the SSL key. - :type value: str + :param value: path to the SSL key or :py:class:`OpenSSL.crypto.PKey` + :type value: string or :py:class:`OpenSSL.crypto.PKey` """ self._ssl_key = value @@ -845,7 +856,7 @@ class SocketDevice(Device): Retrieves the SSL Certificate Authority certificate used for authentication. - :returns: The CA path + :returns: path to the CA certificate or :py:class:`OpenSSL.crypto.X509` """ return self._ssl_ca @@ -854,8 +865,8 @@ class SocketDevice(Device): """ Sets the SSL Certificate Authority certificate used for authentication. - :param value: The path to the SSL CA certificate. - :type value: str + :param value: path to the SSL CA certificate or :py:class:`OpenSSL.crypto.X509` + :type value: string or :py:class:`OpenSSL.crypto.X509` """ self._ssl_ca = value @@ -863,7 +874,7 @@ class SocketDevice(Device): """ Constructor - :param interface: Tuple containing the hostname and port of our target. + :param interface: Tuple containing the hostname and port of our target :type interface: tuple """ Device.__init__(self) @@ -878,13 +889,13 @@ class SocketDevice(Device): """ Opens the device. - :param baudrate: The baudrate to use + :param baudrate: baudrate to use :type baudrate: int - :param no_reader_thread: Whether or not to automatically open the reader + :param no_reader_thread: whether or not to automatically open the reader thread. :type no_reader_thread: bool - :raises: NoDeviceError, CommError + :raises: :py:class:`alarmdecoder.util.NoDeviceError`, :py:class:`alarmdecoder.util.CommError` """ try: @@ -934,11 +945,11 @@ class SocketDevice(Device): """ Writes data to the device. - :param data: The data to write. - :type data: str + :param data: data to write + :type data: string - :returns: The number of bytes sent. - :raises: CommError + :returns: number of bytes sent + :raises: :py:class:`alarmdecoder.util.CommError` """ data_sent = None @@ -959,8 +970,8 @@ class SocketDevice(Device): """ Reads a single character from the device. - :returns: The character read from the device. - :raises: CommError + :returns: character read from the device + :raises: :py:class:`alarmdecoder.util.CommError` """ data = None @@ -976,14 +987,14 @@ class SocketDevice(Device): """ Reads a line from the device. - :param timeout: The read timeout. + :param timeout: read timeout :type timeout: float :param purge_buffer: Indicates whether to purge the buffer prior to reading. :type purge_buffer: bool - :returns: The line that was read.: - :raises: CommError, TimeoutError + :returns: line that was read + :raises: :py:class:`alarmdecoder.util.CommError`, :py:class:`alarmdecoder.util.TimeoutError` """ def timeout_event(): @@ -1034,6 +1045,8 @@ class SocketDevice(Device): def _init_ssl(self): """ Initializes our device as an SSL connection. + + :raises: :py:class:`alarmdecoder.util.CommError` """ try: diff --git a/alarmdecoder/messages.py b/alarmdecoder/messages.py index bac1c30..5a349c5 100644 --- a/alarmdecoder/messages.py +++ b/alarmdecoder/messages.py @@ -1,7 +1,14 @@ """ -Message representations received from the panel through the Alarm Decoder (AD2) +Message representations received from the panel through the `Alarm Decoder`_ (AD2) devices. +* :py:class:`Message`: The standard and most common message received from a panel. +* :py:class:`ExpanderMessage`: Messages received from Relay or Zone expander modules. +* :py:class:`RFMessage`: Message received from an RF receiver module. +* :py:class:`LRRMessage`: Message received from a long-range radio module. + +.. _Alarm Decoder: http://www.alarmdecoder.com + .. moduleauthor:: Scott Petersen """ @@ -37,56 +44,56 @@ class Message(BaseMessage): """ ready = False - """Indicates whether or not the panel is in a ready state""" + """Indicates whether or not the panel is in a ready state.""" armed_away = False - """Indicates whether or not the panel is armed away""" + """Indicates whether or not the panel is armed away.""" armed_home = False - """Indicates whether or not the panel is armed home""" + """Indicates whether or not the panel is armed home.""" backlight_on = False - """Indicates whether or not the keypad backlight is on""" + """Indicates whether or not the keypad backlight is on.""" programming_mode = False - """Indicates whether or not we're in programming mode""" + """Indicates whether or not we're in programming mode.""" beeps = -1 - """Number of beeps associated with a message""" + """Number of beeps associated with a message.""" zone_bypassed = False - """Indicates whether or not a zone is bypassed""" + """Indicates whether or not a zone is bypassed.""" ac_power = False - """Indicates whether or not the panel is on AC power""" + """Indicates whether or not the panel is on AC power.""" chime_on = False - """Indicates whether or not the chime is enabled""" + """Indicates whether or not the chime is enabled.""" alarm_event_occurred = False - """Indicates whether or not an alarm event has occurred""" + """Indicates whether or not an alarm event has occurred.""" alarm_sounding = False - """Indicates whether or not an alarm is sounding""" + """Indicates whether or not an alarm is sounding.""" battery_low = False - """Indicates whether or not there is a low battery""" + """Indicates whether or not there is a low battery.""" entry_delay_off = False - """Indicates whether or not the entry delay is enabled""" + """Indicates whether or not the entry delay is enabled.""" fire_alarm = False - """Indicates whether or not a fire alarm is sounding""" + """Indicates whether or not a fire alarm is sounding.""" check_zone = False """Indicates whether or not there are zones that require attention.""" perimeter_only = False - """Indicates whether or not the perimeter is armed""" + """Indicates whether or not the perimeter is armed.""" numeric_code = None - """The numeric code associated with the message""" + """The numeric code associated with the message.""" text = None - """The human-readable text to be displayed on the panel LCD""" + """The human-readable text to be displayed on the panel LCD.""" cursor_location = -1 - """Current cursor location on the keypad""" + """Current cursor location on the keypad.""" mask = None - """Address mask this message is intended for""" + """Address mask this message is intended for.""" bitfield = None - """The bitfield associated with this message""" + """The bitfield associated with this message.""" panel_data = None - """The panel data field associated with this message""" + """The panel data field associated with this message.""" def __init__(self, data=None): """ Constructor - :param data: Message data to parse. - :type data: str + :param data: message data to parse + :type data: string """ BaseMessage.__init__(self) @@ -105,10 +112,10 @@ class Message(BaseMessage): """ Parse the message from the device. - :param data: The message data. - :type data: str + :param data: message data + :type data: string - :raises: InvalidMessageError + :raises: :py:class:`alarmdecoder.util.InvalidMessageError` """ match = self._regex.match(data) @@ -168,8 +175,8 @@ class ExpanderMessage(BaseMessage): """ Constructor - :param data: The message data to parse. - :type data: str + :param data: message data to parse + :type data: string """ BaseMessage.__init__(self) @@ -186,8 +193,10 @@ class ExpanderMessage(BaseMessage): """ Parse the raw message from the device. - :param data: The message data - :type data: str + :param data: message data + :type data: string + + :raises: :py:class:`alarmdecoder.util.InvalidMessageError` """ try: header, values = data.split(':') @@ -215,22 +224,22 @@ class RFMessage(BaseMessage): """ serial_number = None - """Serial number of the RF device""" + """Serial number of the RF device.""" value = -1 - """Value associated with this message""" + """Value associated with this message.""" battery = False - """Battery low indication""" + """Low battery indication""" supervision = False """Supervision required indication""" - loop = [False for x in range(4)] + loop = [False for _ in range(4)] """Loop indicators""" def __init__(self, data=None): """ Constructor - :param data: The message data to parse - :type data: str + :param data: message data to parse + :type data: string """ BaseMessage.__init__(self) @@ -247,8 +256,10 @@ class RFMessage(BaseMessage): """ Parses the raw message from the device. - :param data: The message data. - :type data: str + :param data: message data + :type data: string + + :raises: :py:class:`alarmdecoder.util.InvalidMessageError` """ try: self.raw = data @@ -280,16 +291,16 @@ class LRRMessage(BaseMessage): event_data = None """Data associated with the LRR message. Usually user ID or zone.""" partition = -1 - """The partition that this message applies to""" + """The partition that this message applies to.""" event_type = None - """The type of the event that occurred""" + """The type of the event that occurred.""" def __init__(self, data=None): """ Constructor - :param data: The message data to parse. - :type data: str + :param data: message data to parse + :type data: string """ BaseMessage.__init__(self) @@ -306,8 +317,10 @@ class LRRMessage(BaseMessage): """ Parses the raw message from the device. - :param data: The message data. - :type data: str + :param data: message data to parse + :type data: string + + :raises: :py:class:`alarmdecoder.util.InvalidMessageError` """ try: self.raw = data diff --git a/alarmdecoder/util.py b/alarmdecoder/util.py index 4a48e70..d7cf2ea 100644 --- a/alarmdecoder/util.py +++ b/alarmdecoder/util.py @@ -1,5 +1,7 @@ """ -Provides utility classes for the Alarm Decoder (AD2) devices. +Provides utility classes for the `Alarm Decoder`_ (AD2) devices. + +.. _Alarm Decoder: http://www.alarmdecoder.com .. moduleauthor:: Scott Petersen """ @@ -53,14 +55,14 @@ class Firmware(object): @staticmethod def upload(dev, filename, progress_callback=None): """ - Uploads firmware to an Alarm Decoder device. + Uploads firmware to an `Alarm Decoder`_ device. - :param filename: The firmware filename - :type filename: str - :param progress_callback: Callback function used to report progress. + :param filename: firmware filename + :type filename: string + :param progress_callback: callback function used to report progress :type progress_callback: function - :raises: NoDeviceError, TimeoutError + :raises: :py:class:`alarmdecoder.util.NoDeviceError`, :py:class:`alarmdecoder.util.TimeoutError` """ def do_upload(): diff --git a/alarmdecoder/zonetracking.py b/alarmdecoder/zonetracking.py index c9bfbc0..3bf6f8b 100644 --- a/alarmdecoder/zonetracking.py +++ b/alarmdecoder/zonetracking.py @@ -1,5 +1,7 @@ """ -Provides zone tracking functionality for the Alarm Decoder (AD2) device family. +Provides zone tracking functionality for the `Alarm Decoder`_ (AD2) device family. + +.. _Alarm Decoder: http://www.alarmdecoder.com .. moduleauthor:: Scott Petersen """ @@ -16,6 +18,7 @@ class Zone(object): Representation of a panel zone. """ + # Constants CLEAR = 0 """Status indicating that the zone is cleared.""" FAULT = 1 @@ -25,15 +28,25 @@ class Zone(object): STATUS = {CLEAR: 'CLEAR', FAULT: 'FAULT', CHECK: 'CHECK'} + # Attributes + zone = 0 + """Zone ID""" + name = '' + """Zone name""" + status = CLEAR + """Zone status""" + timestamp = None + """Timestamp of last update""" + def __init__(self, zone=0, name='', status=CLEAR): """ Constructor - :param zone: The zone number. + :param zone: zone number :type zone: int - :param name: Human readable zone name. - :type name: str - :param status: Initial zone state. + :param name: Human readable zone name + :type name: string + :param status: Initial zone state :type status: int """ self.zone = zone @@ -56,15 +69,53 @@ class Zone(object): class Zonetracker(object): """ - Handles tracking of zone and their statuses. + Handles tracking of zones and their statuses. """ - on_fault = event.Event('Called when the device detects a zone fault.') - on_restore = event.Event('Called when the device detects that a fault is restored.') + on_fault = event.Event('This event is called when the device detects a zone fault.') + on_restore = event.Event('This event is called when the device detects that a fault is restored.') EXPIRE = 30 """Zone expiration timeout.""" + @property + def zones(self): + """ + Returns the current list of zones being tracked. + + :returns: dictionary of :py:class:`Zone` being tracked + """ + return self._zones + + @zones.setter + def zones(self, value): + """ + Sets the current list of zones being tracked. + + :param value: new list of zones being tracked + :type value: dictionary of :py:class:`Zone` being tracked + """ + self._zones = value + + @property + def faulted(self): + """ + Retrieves the current list of faulted zones. + + :returns: list of faulted zones + """ + return self._zones_faulted + + @faulted.setter + def faulted(self, value): + """ + Sets the current list of faulted zones. + + :param value: new list of faulted zones + :type value: list of integers + """ + self._zones_faulted = value + def __init__(self): """ Constructor @@ -77,8 +128,8 @@ class Zonetracker(object): """ Update zone statuses based on the current message. - :param message: Message to use to update the zone tracking. - :type message: Message or ExpanderMessage + :param message: message to use to update the zone tracking + :type message: :py:class:`alarmdecoder.messages.Message` or :py:class:`alarmdecoder.messages.ExpanderMessage` """ if isinstance(message, ExpanderMessage): if message.type == ExpanderMessage.ZONE: @@ -159,12 +210,12 @@ class Zonetracker(object): """ Convert an address and channel into a zone number. - :param address: The expander address + :param address: expander address :type address: int - :param channel: The channel + :param channel: channel :type channel: int - :returns: The zone number associated with an address and channel. + :returns: zone number associated with an address and channel """ # TODO: This is going to need to be reworked to support the larger @@ -178,7 +229,7 @@ class Zonetracker(object): """ Clear all expired zones from our status list. - :param zone: current zone being processed. + :param zone: current zone being processed :type zone: int """ cleared_zones = [] @@ -251,11 +302,11 @@ class Zonetracker(object): """ Adds a zone to the internal zone list. - :param zone: The zone number. + :param zone: zone number :type zone: int - :param name: Human readable zone name. - :type name: str - :param status: The zone status. + :param name: human readable zone name + :type name: string + :param status: zone status :type status: int """ if not zone in self._zones: @@ -268,9 +319,9 @@ class Zonetracker(object): """ Updates a zones status. - :param zone: The zone number. + :param zone: zone number :type zone: int - :param status: The zone status. + :param status: zone status :type status: int :raises: IndexError @@ -293,9 +344,9 @@ class Zonetracker(object): """ Determine if a zone is expired or not. - :param zone: The zone number. + :param zone: zone number :type zone: int - :returns: Whether or not the zone is expired. + :returns: whether or not the zone is expired """ return time.time() > self._zones[zone].timestamp + Zonetracker.EXPIRE diff --git a/docs/alarmdecoder.rst b/docs/alarmdecoder.rst index 36fe308..f243a7e 100644 --- a/docs/alarmdecoder.rst +++ b/docs/alarmdecoder.rst @@ -1,10 +1,10 @@ alarmdecoder Package -================ +==================== :mod:`alarmdecoder` Module --------------------- +-------------------------- -.. automodule:: alarmdecoder.alarmdecoder +.. automodule:: alarmdecoder.decoder :members: :undoc-members: :show-inheritance: @@ -17,10 +17,10 @@ alarmdecoder Package :undoc-members: :show-inheritance: -:mod:`util` Module ------------------- +:mod:`messages` Module +---------------------- -.. automodule:: alarmdecoder.util +.. automodule:: alarmdecoder.messages :members: :undoc-members: :show-inheritance: @@ -33,26 +33,27 @@ alarmdecoder Package :undoc-members: :show-inheritance: -:mod:`panels` Module --------------------- +:mod:`util` Module +------------------ -.. automodule:: alarmdecoder.panels +.. automodule:: alarmdecoder.util :members: :undoc-members: :show-inheritance: -:mod:`messages` Module ----------------------- +:mod:`panels` Module +-------------------- -.. automodule:: alarmdecoder.messages +.. automodule:: alarmdecoder.panels :members: :undoc-members: :show-inheritance: -Subpackages ------------ +.. + Subpackages + ----------- -.. toctree:: + .. toctree:: - alarmdecoder.event + alarmdecoder.event diff --git a/docs/build/doctrees/alarmdecoder.doctree b/docs/build/doctrees/alarmdecoder.doctree index 74acdcf..337e269 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 3a0b59a..6e0c43c 100644 Binary files a/docs/build/doctrees/environment.pickle and b/docs/build/doctrees/environment.pickle differ diff --git a/docs/build/doctrees/index.doctree b/docs/build/doctrees/index.doctree index 5009232..044d182 100644 Binary files a/docs/build/doctrees/index.doctree and b/docs/build/doctrees/index.doctree differ diff --git a/docs/build/html/.buildinfo b/docs/build/html/.buildinfo index a32ac9b..4722afe 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: 7e4354096f7282bd97dc9d3ef3f60c52 +config: d1da78485e879674427d47d917d46635 tags: a205e9ed8462ae86fdd2f73488852ba9 diff --git a/docs/build/html/_modules/alarmdecoder/decoder.html b/docs/build/html/_modules/alarmdecoder/decoder.html new file mode 100644 index 0000000..619cd87 --- /dev/null +++ b/docs/build/html/_modules/alarmdecoder/decoder.html @@ -0,0 +1,677 @@ + + + + + + + + alarmdecoder.decoder — alarmdecoder documentation + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for alarmdecoder.decoder

+"""
+Provides the full AlarmDecoder class.
+
+.. moduleauthor:: Scott Petersen <scott@nutech.com>
+"""
+
+import time
+
+from .event import event
+from .util import InvalidMessageError
+from .messages import Message, ExpanderMessage, RFMessage, LRRMessage
+from .zonetracking import Zonetracker
+
+
+
[docs]class AlarmDecoder(object): + """ + High-level wrapper around Alarm Decoder (AD2) devices. + """ + + # High-level Events + on_arm = event.Event('Called when the panel is armed.') + on_disarm = event.Event('Called when the panel is disarmed.') + on_power_changed = event.Event('Called when panel power switches between AC and DC.') + on_alarm = event.Event('Called when the alarm is triggered.') + on_fire = event.Event('Called when a fire is detected.') + on_bypass = event.Event('Called when a zone is bypassed.') + on_boot = event.Event('Called when the device finishes bootings.') + on_config_received = event.Event('Called when the device receives its configuration.') + on_zone_fault = event.Event('Called when the device detects a zone fault.') + on_zone_restore = event.Event('Called when the device detects that a fault is restored.') + on_low_battery = event.Event('Called when the device detects a low battery.') + on_panic = event.Event('Called when the device detects a panic.') + on_relay_changed = event.Event('Called when a relay is opened or closed on an expander board.') + + # Mid-level Events + on_message = event.Event('Called when a message has been received from the device.') + on_lrr_message = event.Event('Called when an LRR message is received.') + on_rfx_message = event.Event('Called when an RFX message is received.') + + # Low-level Events + on_open = event.Event('Called when the device has been opened.') + on_close = event.Event('Called when the device has been closed.') + on_read = event.Event('Called when a line has been read from the device.') + on_write = event.Event('Called when data has been written to the device.') + + # Constants + KEY_F1 = unichr(1) + unichr(1) + unichr(1) + """Represents panel function key #1""" + KEY_F2 = unichr(2) + unichr(2) + unichr(2) + """Represents panel function key #2""" + KEY_F3 = unichr(3) + unichr(3) + unichr(3) + """Represents panel function key #3""" + KEY_F4 = unichr(4) + unichr(4) + unichr(4) + """Represents panel function key #4""" + + BATTERY_TIMEOUT = 30 + """Timeout before the battery status reverts.""" + FIRE_TIMEOUT = 30 + """Timeout before the fire status reverts.""" + + def __init__(self, device): + """ + Constructor + + :param device: The low-level device used for this Alarm Decoder + interface. + :type device: Device + """ + self._device = device + self._zonetracker = Zonetracker() + + self._battery_timeout = AlarmDecoder.BATTERY_TIMEOUT + self._fire_timeout = AlarmDecoder.FIRE_TIMEOUT + self._power_status = None + self._alarm_status = None + self._bypass_status = None + self._armed_status = None + self._fire_status = (False, 0) + self._battery_status = (False, 0) + self._panic_status = None + self._relay_status = {} + + self.address = 18 + self.configbits = 0xFF00 + self.address_mask = 0x00000000 + self.emulate_zone = [False for x in range(5)] + self.emulate_relay = [False for x in range(4)] + self.emulate_lrr = False + self.deduplicate = False + + def __enter__(self): + """ + Support for context manager __enter__. + """ + return self + + def __exit__(self, exc_type, exc_value, traceback): + """ + Support for context manager __exit__. + """ + self.close() + + return False + + @property +
[docs] def id(self): + """ + The ID of the Alarm Decoder device. + + :returns: The identification string for the device. + """ + return self._device.id +
+ @property + def battery_timeout(self): + """ + Retrieves the timeout for restoring the battery status, in seconds. + + :returns: The battery status timeout + """ + return self._battery_timeout + + @battery_timeout.setter +
[docs] def battery_timeout(self, value): + """ + Sets the timeout for restoring the battery status, in seconds. + + :param value: The timeout in seconds. + :type value: int + """ + self._battery_timeout = value +
+ @property + def fire_timeout(self): + """ + Retrieves the timeout for restoring the fire status, in seconds. + + :returns: The fire status timeout + """ + return self._fire_timeout + + @fire_timeout.setter +
[docs] def fire_timeout(self, value): + """ + Sets the timeout for restoring the fire status, in seconds. + + :param value: The timeout in seconds. + :type value: int + """ + self._fire_timeout = value +
+
[docs] def open(self, baudrate=None, no_reader_thread=False): + """ + Opens the device. + + :param baudrate: The baudrate used for the device. + :type baudrate: int + :param no_reader_thread: Specifies whether or not the automatic reader + thread should be started or not + :type no_reader_thread: bool + """ + self._wire_events() + self._device.open(baudrate=baudrate, no_reader_thread=no_reader_thread) + + return self +
+
[docs] def close(self): + """ + Closes the device. + """ + if self._device: + self._device.close() + + del self._device + self._device = None +
+
[docs] def send(self, data): + """ + Sends data to the Alarm Decoder device. + + :param data: The data to send. + :type data: str + """ + if self._device: + self._device.write(data) +
+
[docs] def get_config(self): + """ + Retrieves the configuration from the device. + """ + self.send("C\r") +
+
[docs] def save_config(self): + """ + Sets configuration entries on the device. + """ + config_string = '' + config_entries = [] + + # HACK: This is ugly.. but I can't think of an elegant way of doing it. + config_entries.append(('ADDRESS', + '{0}'.format(self.address))) + config_entries.append(('CONFIGBITS', + '{0:x}'.format(self.configbits))) + config_entries.append(('MASK', + '{0:x}'.format(self.address_mask))) + config_entries.append(('EXP', + ''.join(['Y' if z else 'N' for z in self.emulate_zone]))) + config_entries.append(('REL', + ''.join(['Y' if r else 'N' for r in self.emulate_relay]))) + config_entries.append(('LRR', + 'Y' if self.emulate_lrr else 'N')) + config_entries.append(('DEDUPLICATE', + 'Y' if self.deduplicate else 'N')) + + config_string = '&'.join(['='.join(t) for t in config_entries]) + + self.send("C{0}\r".format(config_string)) +
+
[docs] def reboot(self): + """ + Reboots the device. + """ + self.send('=') +
+
[docs] def fault_zone(self, zone, simulate_wire_problem=False): + """ + Faults a zone if we are emulating a zone expander. + + :param zone: The zone to fault. + :type zone: int + :param simulate_wire_problem: Whether or not to simulate a wire fault. + :type simulate_wire_problem: bool + """ + + # Allow ourselves to also be passed an address/channel combination + # for zone expanders. + # + # Format (expander index, channel) + if isinstance(zone, tuple): + expander_idx, channel = zone + + zone = self._zonetracker.expander_to_zone(expander_idx, channel) + + status = 2 if simulate_wire_problem else 1 + + self.send("L{0:02}{1}\r".format(zone, status)) +
+
[docs] def clear_zone(self, zone): + """ + Clears a zone if we are emulating a zone expander. + + :param zone: The zone to clear. + :type zone: int + """ + self.send("L{0:02}0\r".format(zone)) +
+ def _wire_events(self): + """ + Wires up the internal device events. + """ + self._device.on_open += self._on_open + self._device.on_close += self._on_close + self._device.on_read += self._on_read + self._device.on_write += self._on_write + self._zonetracker.on_fault += self._on_zone_fault + self._zonetracker.on_restore += self._on_zone_restore + + def _handle_message(self, data): + """ + Parses messages from the panel. + + :param data: Panel data to parse. + :type data: str + + :returns: An object representing the message. + """ + if data is None: + raise InvalidMessageError() + + msg = None + header = data[0:4] + + if header[0] != '!' or header == '!KPE': + msg = Message(data) + + if self.address_mask & msg.mask > 0: + self._update_internal_states(msg) + + elif header == '!EXP' or header == '!REL': + msg = ExpanderMessage(data) + + self._update_internal_states(msg) + + elif header == '!RFX': + msg = self._handle_rfx(data) + + elif header == '!LRR': + msg = self._handle_lrr(data) + + elif data.startswith('!Ready'): + self.on_boot() + + elif data.startswith('!CONFIG'): + self._handle_config(data) + + return msg + + def _handle_rfx(self, data): + """ + Handle RF messages. + + :param data: RF message to parse. + :type data: str + + :returns: An object representing the RF message. + """ + msg = RFMessage(data) + + self.on_rfx_message(message=msg) + + return msg + + def _handle_lrr(self, data): + """ + Handle Long Range Radio messages. + + :param data: LRR message to parse. + :type data: str + + :returns: An object representing the LRR message. + """ + msg = LRRMessage(data) + + if msg.event_type == 'ALARM_PANIC': + self._panic_status = True + self.on_panic(status=True) + + elif msg.event_type == 'CANCEL': + if self._panic_status is True: + self._panic_status = False + self.on_panic(status=False) + + self.on_lrr_message(message=msg) + + return msg + + def _handle_config(self, data): + """ + Handles received configuration data. + + :param data: Configuration string to parse. + :type data: str + """ + _, config_string = data.split('>') + for setting in config_string.split('&'): + key, val = setting.split('=') + + if key == 'ADDRESS': + self.address = int(val) + elif key == 'CONFIGBITS': + self.configbits = int(val, 16) + elif key == 'MASK': + self.address_mask = int(val, 16) + elif key == 'EXP': + self.emulate_zone = [val[z] == 'Y' for z in range(5)] + elif key == 'REL': + self.emulate_relay = [val[r] == 'Y' for r in range(4)] + elif key == 'LRR': + self.emulate_lrr = (val == 'Y') + elif key == 'DEDUPLICATE': + self.deduplicate = (val == 'Y') + + self.on_config_received() + + def _update_internal_states(self, message): + """ + Updates internal device states. + + :param message: Message to update internal states with. + :type message: Message, ExpanderMessage, LRRMessage, or RFMessage + """ + if isinstance(message, Message): + self._update_power_status(message) + self._update_alarm_status(message) + self._update_zone_bypass_status(message) + self._update_armed_status(message) + self._update_battery_status(message) + self._update_fire_status(message) + + elif isinstance(message, ExpanderMessage): + self._update_expander_status(message) + + self._update_zone_tracker(message) + + def _update_power_status(self, message): + """ + Uses the provided message to update the AC power state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + if message.ac_power != self._power_status: + self._power_status, old_status = message.ac_power, self._power_status + + if old_status is not None: + self.on_power_changed(status=self._power_status) + + return self._power_status + + def _update_alarm_status(self, message): + """ + Uses the provided message to update the alarm state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + + if message.alarm_sounding != self._alarm_status: + self._alarm_status, old_status = message.alarm_sounding, self._alarm_status + + if old_status is not None: + self.on_alarm(status=self._alarm_status) + + return self._alarm_status + + def _update_zone_bypass_status(self, message): + """ + Uses the provided message to update the zone bypass state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + + if message.zone_bypassed != self._bypass_status: + self._bypass_status, old_status = message.zone_bypassed, self._bypass_status + + if old_status is not None: + self.on_bypass(status=self._bypass_status) + + return self._bypass_status + + def _update_armed_status(self, message): + """ + Uses the provided message to update the armed state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + + message_status = message.armed_away | message.armed_home + if message_status != self._armed_status: + self._armed_status, old_status = message_status, self._armed_status + + if old_status is not None: + if self._armed_status: + self.on_arm() + else: + self.on_disarm() + + return self._armed_status + + def _update_battery_status(self, message): + """ + Uses the provided message to update the battery state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + + last_status, last_update = self._battery_status + if message.battery_low == last_status: + self._battery_status = (last_status, time.time()) + else: + if message.battery_low is True or time.time() > last_update + self._battery_timeout: + self._battery_status = (message.battery_low, time.time()) + self.on_low_battery(status=message.battery_low) + + return self._battery_status[0] + + def _update_fire_status(self, message): + """ + Uses the provided message to update the fire alarm state. + + :param message: The message to use to update. + :type message: Message + + :returns: Boolean indicating the new status + """ + + last_status, last_update = self._fire_status + if message.fire_alarm == last_status: + self._fire_status = (last_status, time.time()) + else: + if message.fire_alarm is True or time.time() > last_update + self._fire_timeout: + self._fire_status = (message.fire_alarm, time.time()) + self.on_fire(status=message.fire_alarm) + + return self._fire_status[0] + + def _update_expander_status(self, message): + """ + Uses the provided message to update the expander states. + + :param message: The message to use to update. + :type message: ExpanderMessage + + :returns: Boolean indicating the new status + """ + + if message.type == ExpanderMessage.RELAY: + self._relay_status[(message.address, message.channel)] = message.value + + self.on_relay_changed(message=message) + + return self._relay_status[(message.address, message.channel)] + + def _update_zone_tracker(self, message): + """ + Trigger an update of the zonetracker. + + :param message: The message to update the zonetracker with. + :type message: Message, ExpanderMessage, LRRMessage, or RFMessage + """ + + # Retrieve a list of faults. + # NOTE: This only happens on first boot or after exiting programming mode. + if isinstance(message, Message): + if not message.ready and "Hit * for faults" in message.text: + self.send('*') + return + + self._zonetracker.update(message) + + def _on_open(self, sender, *args, **kwargs): + """ + Internal handler for opening the device. + """ + self.get_config() + + self.on_open(args, kwargs) + + def _on_close(self, sender, *args, **kwargs): + """ + Internal handler for closing the device. + """ + self.on_close(args, kwargs) + + def _on_read(self, sender, *args, **kwargs): + """ + Internal handler for reading from the device. + """ + self.on_read(args, kwargs) + + msg = self._handle_message(kwargs.get('data', None)) + if msg: + self.on_message(message=msg) + + def _on_write(self, sender, *args, **kwargs): + """ + Internal handler for writing to the device. + """ + self.on_write(args, kwargs) + + def _on_zone_fault(self, sender, *args, **kwargs): + """ + Internal handler for zone faults. + """ + self.on_zone_fault(*args, **kwargs) + + def _on_zone_restore(self, sender, *args, **kwargs): + """ + Internal handler for zone restoration. + """ + self.on_zone_restore(*args, **kwargs)
+
+ +
+
+
+
+
+ + +
+
+
+
+ + + + \ No newline at end of file diff --git a/docs/build/html/_modules/index.html b/docs/build/html/_modules/index.html index 040c13c..c29ff73 100644 --- a/docs/build/html/_modules/index.html +++ b/docs/build/html/_modules/index.html @@ -45,7 +45,8 @@

All modules for which code is available

-
  • alarmdecoder.devices
  • +
    • alarmdecoder.decoder
    • +
    • alarmdecoder.devices
    • alarmdecoder.event.event
    • alarmdecoder.messages
    • alarmdecoder.util
    • diff --git a/docs/build/html/_sources/alarmdecoder.txt b/docs/build/html/_sources/alarmdecoder.txt index 36fe308..f243a7e 100644 --- a/docs/build/html/_sources/alarmdecoder.txt +++ b/docs/build/html/_sources/alarmdecoder.txt @@ -1,10 +1,10 @@ alarmdecoder Package -================ +==================== :mod:`alarmdecoder` Module --------------------- +-------------------------- -.. automodule:: alarmdecoder.alarmdecoder +.. automodule:: alarmdecoder.decoder :members: :undoc-members: :show-inheritance: @@ -17,10 +17,10 @@ alarmdecoder Package :undoc-members: :show-inheritance: -:mod:`util` Module ------------------- +:mod:`messages` Module +---------------------- -.. automodule:: alarmdecoder.util +.. automodule:: alarmdecoder.messages :members: :undoc-members: :show-inheritance: @@ -33,26 +33,27 @@ alarmdecoder Package :undoc-members: :show-inheritance: -:mod:`panels` Module --------------------- +:mod:`util` Module +------------------ -.. automodule:: alarmdecoder.panels +.. automodule:: alarmdecoder.util :members: :undoc-members: :show-inheritance: -:mod:`messages` Module ----------------------- +:mod:`panels` Module +-------------------- -.. automodule:: alarmdecoder.messages +.. automodule:: alarmdecoder.panels :members: :undoc-members: :show-inheritance: -Subpackages ------------ +.. + Subpackages + ----------- -.. toctree:: + .. toctree:: - alarmdecoder.event + alarmdecoder.event diff --git a/docs/build/html/_sources/index.txt b/docs/build/html/_sources/index.txt index 41929e0..1cc583f 100644 --- a/docs/build/html/_sources/index.txt +++ b/docs/build/html/_sources/index.txt @@ -4,9 +4,18 @@ contain the root `toctree` directive. Welcome to alarmdecoder's documentation! -==================================== +======================================== -Contents: +This is the API documentation for the `Alarm Decoder`_ Python library. It provides support for interacting with the `Alarm Decoder`_ (AD2) family of security alarm devices, including the `AD2USB`_, `AD2SERIAL`_ and `AD2PI`_. + +The source code, requirements and examples for this project may be found `here `_. + +.. _Alarm Decoder: http://www.alarmdecoder.com +.. _AD2USB: http://www.alarmdecoder.com +.. _AD2SERIAL: http://www.alarmdecoder.com +.. _AD2PI: http://www.alarmdecoder.com + +Table of Contents: .. toctree:: :maxdepth: 4 diff --git a/docs/build/html/alarmdecoder.html b/docs/build/html/alarmdecoder.html index 2ac6071..5cc160a 100644 --- a/docs/build/html/alarmdecoder.html +++ b/docs/build/html/alarmdecoder.html @@ -24,7 +24,6 @@ - @@ -37,9 +36,6 @@
    • modules |
    • -
    • - next |
    • previous |
    • @@ -54,39 +50,382 @@

      alarmdecoder Package

      -
      -

      alarmdecoder Module

      +
      +

      alarmdecoder Module

      +

      Provides the main AlarmDecoder class.

      +
      +
      +class alarmdecoder.decoder.AlarmDecoder(device)[source]
      +

      Bases: object

      +

      High-level wrapper around Alarm Decoder (AD2) devices.

      +
      +
      +on_arm
      +

      This event is called when the panel is armed.

      +
      + +
      +
      +on_disarm
      +

      This event is called when the panel is disarmed.

      +
      + +
      +
      +on_power_changed
      +

      This event is called when panel power switches between AC and DC.

      +
      + +
      +
      +on_alarm
      +

      This event is called when the alarm is triggered.

      +
      + +
      +
      +on_fire
      +

      This event is called when a fire is detected.

      +
      + +
      +
      +on_bypass
      +

      This event is called when a zone is bypassed.

      +
      + +
      +
      +on_boot
      +

      This event is called when the device finishes booting.

      +
      + +
      +
      +on_config_received
      +

      This event is called when the device receives its configuration.

      +
      + +
      +
      +on_zone_fault
      +

      This event is called when alarmdecoder.zonetracking.Zonetracker detects a zone fault.

      +
      + +
      +
      +on_zone_restore
      +

      This event is called when alarmdecoder.zonetracking.Zonetracker detects that a fault is restored.

      +
      + +
      +
      +on_low_battery
      +

      This event is called when the device detects a low battery.

      +
      + +
      +
      +on_panic
      +

      This event is called when the device detects a panic.

      +
      + +
      +
      +on_relay_changed
      +

      This event is called when a relay is opened or closed on an expander board.

      +
      + +
      +
      +on_message
      +

      This event is called when any message is received.

      +
      + +
      +
      +on_lrr_message
      +

      This event is called when an alarmdecoder.messages.LRRMessage is received.

      +
      + +
      +
      +on_rfx_message
      +

      This event is called when an alarmdecoder.messages.RFMessage is received.

      +
      + +
      +
      +on_open
      +

      This event is called when the device has been opened.

      +
      + +
      +
      +on_close
      +

      This event is called when the device has been closed.

      +
      + +
      +
      +on_read
      +

      This event is called when a line has been read from the device.

      +
      + +
      +
      +on_write
      +

      This event is called when data has been written to the device.

      +
      + +
      +
      +KEY_F1 = u'\x01\x01\x01'
      +

      Represents panel function key #1

      +
      + +
      +
      +KEY_F2 = u'\x02\x02\x02'
      +

      Represents panel function key #2

      +
      + +
      +
      +KEY_F3 = u'\x03\x03\x03'
      +

      Represents panel function key #3

      +
      + +
      +
      +KEY_F4 = u'\x04\x04\x04'
      +

      Represents panel function key #4

      +
      + +
      +
      +BATTERY_TIMEOUT = 30
      +

      Default timeout (in seconds) before the battery status reverts.

      +
      + +
      +
      +FIRE_TIMEOUT = 30
      +

      Default tTimeout (in seconds) before the fire status reverts.

      +
      + +
      +
      +address = 18
      +

      The keypad address in use by the device.

      +
      + +
      +
      +configbits = 65280
      +

      The configuration bits set on the device.

      +
      + +
      +
      +address_mask = 0
      +

      The address mask configured on the device.

      +
      + +
      +
      +emulate_zone = [False, False, False, False, False]
      +

      List containing the devices zone emulation status.

      +
      + +
      +
      +emulate_relay = [False, False, False, False]
      +

      List containing the devices relay emulation status.

      +
      + +
      +
      +emulate_lrr = False
      +

      The status of the devices LRR emulation.

      +
      + +
      +
      +deduplicate = False
      +

      The status of message deduplication as configured on the device.

      +
      + +
      +
      +id[source]
      +

      The ID of the Alarm Decoder device.

      + +++ + + + +
      Returns:identification string for the device
      +
      + +
      +
      +battery_timeout[source]
      +

      Retrieves the timeout for restoring the battery status, in seconds.

      + +++ + + + +
      Returns:battery status timeout
      +
      + +
      +
      +fire_timeout[source]
      +

      Retrieves the timeout for restoring the fire status, in seconds.

      + +++ + + + +
      Returns:fire status timeout
      +
      + +
      +
      +open(baudrate=None, no_reader_thread=False)[source]
      +

      Opens the device.

      + +++ + + + +
      Parameters:
        +
      • baudrate (int) – baudrate used for the device. Defaults to the lower-level device default.
      • +
      • no_reader_thread (bool) – Specifies whether or not the automatic reader +thread should be started.
      • +
      +
      +
      + +
      +
      +close()[source]
      +

      Closes the device.

      +
      + +
      +
      +send(data)[source]
      +

      Sends data to the Alarm Decoder device.

      + +++ + + + +
      Parameters:data (string) – data to send
      +
      + +
      +
      +get_config()[source]
      +

      Retrieves the configuration from the device. Called automatically by _on_open().

      +
      + +
      +
      +save_config()[source]
      +

      Sets configuration entries on the device.

      +
      + +
      +
      +reboot()[source]
      +

      Reboots the device.

      +
      + +
      +
      +fault_zone(zone, simulate_wire_problem=False)[source]
      +

      Faults a zone if we are emulating a zone expander.

      + +++ + + + +
      Parameters:
        +
      • zone (int) – zone to fault
      • +
      • simulate_wire_problem (bool) – Whether or not to simulate a wire fault
      • +
      +
      +
      + +
      +
      +clear_zone(zone)[source]
      +

      Clears a zone if we are emulating a zone expander.

      + +++ + + + +
      Parameters:zone (int) – zone to clear
      +
      + +
      +

      devices Module

      -

      Contains different types of devices belonging to the Alarm Decoder (AD2) family.

      +

      This module contains different types of devices belonging to the Alarm Decoder (AD2) family.

      +
      class alarmdecoder.devices.Device[source]

      Bases: object

      -

      Generic parent device to all Alarm Decoder (AD2) products.

      +

      Base class for all Alarm Decoder (AD2) device types.

      on_open
      -

      Called when the device has been opened

      +

      This event is called when the device has been opened.

      on_close
      -

      Called when the device has been closed

      +

      This event is called when the device has been closed.

      on_read
      -

      Called when a line has been read from the device

      +

      This event is called when a line has been read from the device.

      on_write
      -

      Called when data has been written to the device

      +

      This event is called when data has been written to the device.

      @@ -97,7 +436,7 @@ -Returns:The identification string for the device. +Returns:identification string for the device @@ -111,7 +450,7 @@ -Returns:Whether or not the reader thread is alive. +Returns:whether or not the reader thread is alive @@ -160,23 +499,23 @@
      class alarmdecoder.devices.USBDevice(interface=0)[source]

      Bases: alarmdecoder.devices.Device

      -

      AD2USB device exposed with PyFTDI’s interface.

      +

      AD2USB device utilizing PyFTDI’s interface.

      FTDI_VENDOR_ID = 1027
      -

      Vendor ID used to recognize AD2USB devices.

      +

      Vendor ID used to recognize AD2USB devices.

      FTDI_PRODUCT_ID = 24577
      -

      Product ID used to recognize AD2USB devices.

      +

      Product ID used to recognize AD2USB devices.

      BAUDRATE = 115200
      -

      Default baudrate for AD2USB devices.

      +

      Default baudrate for AD2USB devices.

      @@ -189,7 +528,7 @@ Returns:list of devices -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -198,12 +537,12 @@
      classmethod devices()[source]
      -

      Returns a cached list of AD2USB devices located on the system.

      +

      Returns a cached list of AD2USB devices located on the system.

      - +
      Returns:cached list of devices found.
      Returns:cached list of devices found
      @@ -212,7 +551,7 @@
      classmethod find(device=None)[source]
      -

      Factory method that returns the requested USBDevice device, or the +

      Factory method that returns the requested USBDevice device, or the first device.

      @@ -221,9 +560,9 @@ first device.

      - + - +
      Parameters:device (tuple) – Tuple describing the USB device to open, as returned by find_all().
      Returns:USBDevice object utilizing the specified device.
      Returns:USBDevice object utilizing the specified device
      Raises :NoDeviceError
      Raises :alarmdecoder.util.NoDeviceError
      @@ -238,8 +577,8 @@ by find_all(). Parameters:
        -
      • on_attached (function) – function to be called when a device is attached.
      • -
      • on_detached (function) – function to be called when a device is detached.
      • +
      • on_attached (function) – function to be called when a device is attached
      • +
      • on_detached (function) – function to be called when a device is detached
      @@ -261,7 +600,7 @@ by find_all(). -Returns:The serial number of the device. +Returns:serial number of the device @@ -275,7 +614,7 @@ by find_all(). -Returns:The description of the device. +Returns:description of the device @@ -289,7 +628,7 @@ by find_all(). -Returns:the interface used to connect to the device. +Returns:the interface used to connect to the device @@ -304,13 +643,13 @@ by find_all(). Parameters:
        -
      • baudrate (int) – The baudrate to use.
      • -
      • no_reader_thread (bool) – Whether or not to automatically start the +
      • baudrate (int) – baudrate to use
      • +
      • no_reader_thread (bool) – whether or not to automatically start the reader thread.
      -Raises :

      NoDeviceError

      +Raises :

      alarmdecoder.util.NoDeviceError

      @@ -331,9 +670,9 @@ reader thread. -Parameters:data (str) – Data to write +Parameters:data (string) – data to write -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -347,9 +686,9 @@ reader thread. -Returns:The character read from the device. +Returns:character read from the device -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -364,16 +703,16 @@ reader thread. Parameters:
        -
      • timeout (float) – The read timeout.
      • +
      • timeout (float) – read timeout
      • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
      -Returns:

      The line that was read.

      +Returns:

      line that was read

      -Raises :

      CommError, TimeoutError

      +Raises :

      alarmdecoder.util.CommError, alarmdecoder.util.TimeoutError

      @@ -388,13 +727,13 @@ reading.
      on_attached
      -

      Called when an AD2USB device has been detected.

      +

      This event is called when an AD2USB device has been detected.

      on_detached
      -

      Called when an AD2USB device has been removed.

      +

      This event is called when an AD2USB device has been removed.

      @@ -417,7 +756,7 @@ reading.
      class alarmdecoder.devices.SerialDevice(interface=None)[source]

      Bases: alarmdecoder.devices.Device

      -

      AD2USB or AD2SERIAL device exposed with the pyserial interface.

      +

      AD2USB, AD2SERIAL or AD2PI device utilizing the PySerial interface.

      BAUDRATE = 19200
      @@ -432,11 +771,11 @@ reading. -Parameters:pattern (str) – Pattern to search for when retrieving serial ports. +Parameters:pattern (string) – pattern to search for when retrieving serial ports Returns:list of devices -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -450,7 +789,7 @@ reading. -Returns:the interface used to connect to the device. +Returns:interface used to connect to the device @@ -465,13 +804,13 @@ reading. Parameters:
        -
      • baudrate (int) – The baudrate to use with the device.
      • -
      • no_reader_thread (bool) – Whether or not to automatically start the +
      • baudrate (int) – baudrate to use with the device
      • +
      • no_reader_thread (bool) – whether or not to automatically start the reader thread.
      -Raises :

      NoDeviceError

      +Raises :

      alarmdecoder.util.NoDeviceError

      @@ -492,9 +831,9 @@ reader thread. -Parameters:data (str) – The data to write. +Parameters:data (string) – data to write -Raises :CommError +Raises :py:class:alarmdecoder.util.CommError @@ -508,9 +847,9 @@ reader thread. -Returns:The character read from the device. +Returns:character read from the device -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -525,16 +864,16 @@ reader thread. Parameters:
        -
      • timeout (float) – The read timeout.
      • +
      • timeout (float) – read timeout
      • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
      -Returns:

      The line that was read.

      +Returns:

      line that was read

      -Raises :

      CommError, TimeoutError

      +Raises :

      alarmdecoder.util.CommError, alarmdecoder.util.TimeoutError

      @@ -547,8 +886,8 @@ reading.
      class alarmdecoder.devices.SocketDevice(interface=('localhost', 10000))[source]

      Bases: alarmdecoder.devices.Device

      -

      Device that supports communication with an Alarm Decoder (AD2) that is -exposed via ser2sock or another Serial to IP interface.

      +

      Device that supports communication with an Alarm Decoder (AD2) that is +exposed via ser2sock or another Serial to IP interface.

      interface[source]
      @@ -557,7 +896,7 @@ exposed via ser2sock or another Serial to IP interface.

      -Returns:the interface used to connect to the device. +Returns:interface used to connect to the device @@ -571,7 +910,7 @@ exposed via ser2sock or another Serial to IP interface.

      -Returns:Whether or not the device is using SSL. +Returns:whether or not the device is using SSL @@ -585,7 +924,7 @@ exposed via ser2sock or another Serial to IP interface.

      -Returns:The certificate path +Returns:path to the certificate path or OpenSSL.crypto.X509 @@ -599,7 +938,7 @@ exposed via ser2sock or another Serial to IP interface.

      -Returns:The key path +Returns:jpath to the SSL key or OpenSSL.crypto.PKey @@ -614,7 +953,7 @@ authentication.

      -Returns:The CA path +Returns:path to the CA certificate or OpenSSL.crypto.X509 @@ -629,13 +968,13 @@ authentication.

      Parameters:
        -
      • baudrate (int) – The baudrate to use
      • -
      • no_reader_thread (bool) – Whether or not to automatically open the reader +
      • baudrate (int) – baudrate to use
      • +
      • no_reader_thread (bool) – whether or not to automatically open the reader thread.
      -Raises :

      NoDeviceError, CommError

      +Raises :

      alarmdecoder.util.NoDeviceError, alarmdecoder.util.CommError

      @@ -656,11 +995,11 @@ thread. -Parameters:data (str) – The data to write. +Parameters:data (string) – data to write -Returns:The number of bytes sent. +Returns:number of bytes sent -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -674,9 +1013,9 @@ thread. -Returns:The character read from the device. +Returns:character read from the device -Raises :CommError +Raises :alarmdecoder.util.CommError @@ -691,16 +1030,16 @@ thread. Parameters:
        -
      • timeout (float) – The read timeout.
      • +
      • timeout (float) – read timeout
      • purge_buffer (bool) – Indicates whether to purge the buffer prior to reading.
      -Returns:

      The line that was read.:

      +Returns:

      line that was read

      -Raises :

      CommError, TimeoutError

      +Raises :

      alarmdecoder.util.CommError, alarmdecoder.util.TimeoutError

      @@ -710,298 +1049,116 @@ reading.
      -
      -

      util Module

      -

      Provides utility classes for the Alarm Decoder (AD2) devices.

      -
      -
      -exception alarmdecoder.util.NoDeviceError[source]
      -

      Bases: exceptions.Exception

      -

      No devices found.

      +
      +

      messages Module

      +

      Message representations received from the panel through the Alarm Decoder (AD2) +devices.

      +
        +
      • Message: The standard and most common message received from a panel.
      • +
      • ExpanderMessage: Messages received from Relay or Zone expander modules.
      • +
      • RFMessage: Message received from an RF receiver module.
      • +
      • LRRMessage: Message received from a long-range radio module.
      • +
      +
      +
      +class alarmdecoder.messages.BaseMessage[source]
      +

      Bases: object

      +

      Base class for messages.

      +
      +
      +raw = None
      +

      The raw message text

      -
      -
      -exception alarmdecoder.util.CommError[source]
      -

      Bases: exceptions.Exception

      -

      There was an error communicating with the device.

      -
      -
      -exception alarmdecoder.util.TimeoutError[source]
      -

      Bases: exceptions.Exception

      -

      There was a timeout while trying to communicate with the device.

      +
      +
      +class alarmdecoder.messages.Message(data=None)[source]
      +

      Bases: alarmdecoder.messages.BaseMessage

      +

      Represents a message from the alarm panel.

      +
      +
      +ready = False
      +

      Indicates whether or not the panel is in a ready state.

      -
      -
      -exception alarmdecoder.util.InvalidMessageError[source]
      -

      Bases: exceptions.Exception

      -

      The format of the panel message was invalid.

      +
      +
      +armed_away = False
      +

      Indicates whether or not the panel is armed away.

      -
      -
      -class alarmdecoder.util.Firmware[source]
      -

      Bases: object

      -

      Represents firmware for the Alarm Decoder devices.

      -
      -STAGE_START = 0
      -
      - -
      -
      -STAGE_WAITING = 1
      -
      - -
      -
      -STAGE_BOOT = 2
      -
      - -
      -
      -STAGE_LOAD = 3
      -
      - -
      -
      -STAGE_UPLOADING = 4
      -
      - -
      -
      -STAGE_DONE = 5
      -
      - -
      -
      -static upload(dev, filename, progress_callback=None)[source]
      -

      Uploads firmware to an Alarm Decoder device.

      - --- - - - - - -
      Parameters:
        -
      • filename (str) – The firmware filename
      • -
      • progress_callback (function) – Callback function used to report progress.
      • -
      -
      Raises :

      NoDeviceError, TimeoutError

      -
      -
      - -
      - -
      -
      -

      zonetracking Module

      -

      Provides zone tracking functionality for the Alarm Decoder (AD2) device family.

      -
      -
      -class alarmdecoder.zonetracking.Zone(zone=0, name='', status=0)[source]
      -

      Bases: object

      -

      Representation of a panel zone.

      -
      -
      -CLEAR = 0
      -

      Status indicating that the zone is cleared.

      -
      - -
      -
      -FAULT = 1
      -

      Status indicating that the zone is faulted.

      -
      - -
      -
      -CHECK = 2
      -

      Status indicating that there is a wiring issue with the zone.

      -
      - -
      -
      -STATUS = {0: 'CLEAR', 1: 'FAULT', 2: 'CHECK'}
      -
      - -
      - -
      -
      -class alarmdecoder.zonetracking.Zonetracker[source]
      -

      Bases: object

      -

      Handles tracking of zone and their statuses.

      -
      -
      -on_fault
      -

      Called when the device detects a zone fault.

      -
      - -
      -
      -on_restore
      -

      Called when the device detects that a fault is restored.

      -
      - -
      -
      -EXPIRE = 30
      -

      Zone expiration timeout.

      -
      - -
      -
      -update(message)[source]
      -

      Update zone statuses based on the current message.

      - --- - - - -
      Parameters:message (Message or ExpanderMessage) – Message to use to update the zone tracking.
      -
      - -
      -
      -expander_to_zone(address, channel)[source]
      -

      Convert an address and channel into a zone number.

      - --- - - - - - -
      Parameters:
        -
      • address (int) – The expander address
      • -
      • channel (int) – The channel
      • -
      -
      Returns:

      The zone number associated with an address and channel.

      -
      -
      - -
      - -
      -
      -

      panels Module

      -

      Representations of Panels and their templates.

      -
      -
      -

      messages Module

      -

      Message representations received from the panel through the Alarm Decoder (AD2) -devices.

      -
      -
      -class alarmdecoder.messages.BaseMessage[source]
      -

      Bases: object

      -

      Base class for messages.

      -
      -
      -raw = None
      -

      The raw message text

      -
      - -
      - -
      -
      -class alarmdecoder.messages.Message(data=None)[source]
      -

      Bases: alarmdecoder.messages.BaseMessage

      -

      Represents a message from the alarm panel.

      -
      -
      -ready = False
      -

      Indicates whether or not the panel is in a ready state

      -
      - -
      -
      -armed_away = False
      -

      Indicates whether or not the panel is armed away

      -
      - -
      -
      -armed_home = False
      -

      Indicates whether or not the panel is armed home

      -
      +
      +armed_home = False
      +

      Indicates whether or not the panel is armed home.

      +
      backlight_on = False
      -

      Indicates whether or not the keypad backlight is on

      +

      Indicates whether or not the keypad backlight is on.

      programming_mode = False
      -

      Indicates whether or not we’re in programming mode

      +

      Indicates whether or not we’re in programming mode.

      beeps = -1
      -

      Number of beeps associated with a message

      +

      Number of beeps associated with a message.

      zone_bypassed = False
      -

      Indicates whether or not a zone is bypassed

      +

      Indicates whether or not a zone is bypassed.

      ac_power = False
      -

      Indicates whether or not the panel is on AC power

      +

      Indicates whether or not the panel is on AC power.

      chime_on = False
      -

      Indicates whether or not the chime is enabled

      +

      Indicates whether or not the chime is enabled.

      alarm_event_occurred = False
      -

      Indicates whether or not an alarm event has occurred

      +

      Indicates whether or not an alarm event has occurred.

      alarm_sounding = False
      -

      Indicates whether or not an alarm is sounding

      +

      Indicates whether or not an alarm is sounding.

      battery_low = False
      -

      Indicates whether or not there is a low battery

      +

      Indicates whether or not there is a low battery.

      entry_delay_off = False
      -

      Indicates whether or not the entry delay is enabled

      +

      Indicates whether or not the entry delay is enabled.

      fire_alarm = False
      -

      Indicates whether or not a fire alarm is sounding

      +

      Indicates whether or not a fire alarm is sounding.

      @@ -1013,43 +1170,43 @@ devices.

      perimeter_only = False
      -

      Indicates whether or not the perimeter is armed

      +

      Indicates whether or not the perimeter is armed.

      numeric_code = None
      -

      The numeric code associated with the message

      +

      The numeric code associated with the message.

      text = None
      -

      The human-readable text to be displayed on the panel LCD

      +

      The human-readable text to be displayed on the panel LCD.

      cursor_location = -1
      -

      Current cursor location on the keypad

      +

      Current cursor location on the keypad.

      mask = None
      -

      Address mask this message is intended for

      +

      Address mask this message is intended for.

      bitfield = None
      -

      The bitfield associated with this message

      +

      The bitfield associated with this message.

      panel_data = None
      -

      The panel data field associated with this message

      +

      The panel data field associated with this message.

      @@ -1102,27 +1259,22 @@ devices.

      class alarmdecoder.messages.RFMessage(data=None)[source]

      Bases: alarmdecoder.messages.BaseMessage

      Represents a message from an RF receiver.

      -
      -
      -x = 3
      -
      -
      serial_number = None
      -

      Serial number of the RF device

      +

      Serial number of the RF device.

      value = -1
      -

      Value associated with this message

      +

      Value associated with this message.

      battery = False
      -

      Battery low indication

      +

      Low battery indication

      @@ -1153,29 +1305,257 @@ devices.

      partition = -1
      -

      The partition that this message applies to

      +

      The partition that this message applies to.

      event_type = None
      -

      The type of the event that occurred

      +

      The type of the event that occurred.

      -
      -

      Subpackages

      -
      -
        -
      • event Package
          -
        • event Package
        • -
        • event Module
        • +
          +

          zonetracking Module

          +

          Provides zone tracking functionality for the Alarm Decoder (AD2) device family.

          +
          +
          +class alarmdecoder.zonetracking.Zone(zone=0, name='', status=0)[source]
          +

          Bases: object

          +

          Representation of a panel zone.

          +
          +
          +CLEAR = 0
          +

          Status indicating that the zone is cleared.

          +
          + +
          +
          +FAULT = 1
          +

          Status indicating that the zone is faulted.

          +
          + +
          +
          +CHECK = 2
          +

          Status indicating that there is a wiring issue with the zone.

          +
          + +
          +
          +STATUS = {0: 'CLEAR', 1: 'FAULT', 2: 'CHECK'}
          +
          + +
          +
          +zone = 0
          +

          Zone ID

          +
          + +
          +
          +name = ''
          +

          Zone name

          +
          + +
          +
          +status = 0
          +

          Zone status

          +
          + +
          +
          +timestamp = None
          +

          Timestamp of last update

          +
          + +
          + +
          +
          +class alarmdecoder.zonetracking.Zonetracker[source]
          +

          Bases: object

          +

          Handles tracking of zones and their statuses.

          +
          +
          +on_fault
          +

          This event is called when the device detects a zone fault.

          +
          + +
          +
          +on_restore
          +

          This event is called when the device detects that a fault is restored.

          +
          + +
          +
          +EXPIRE = 30
          +

          Zone expiration timeout.

          +
          + +
          +
          +zones
          +

          Returns the current list of zones being tracked.

          + +++ + + + +
          Returns:dictionary of Zone being tracked
          +
          + +
          +
          +faulted
          +

          Retrieves the current list of faulted zones.

          + +++ + + + +
          Returns:list of faulted zones
          +
          + +
          +
          +update(message)[source]
          +

          Update zone statuses based on the current message.

          + +++ + + + +
          Parameters:message (alarmdecoder.messages.Message or alarmdecoder.messages.ExpanderMessage) – message to use to update the zone tracking
          +
          + +
          +
          +expander_to_zone(address, channel)[source]
          +

          Convert an address and channel into a zone number.

          + +++ + + + + + +
          Parameters:
            +
          • address (int) – expander address
          • +
          • channel (int) – channel
          - +
          Returns:

          zone number associated with an address and channel

          +
          +
          + +
          + +
          +
          +

          util Module

          +

          Provides utility classes for the Alarm Decoder (AD2) devices.

          +
          +
          +exception alarmdecoder.util.NoDeviceError[source]
          +

          Bases: exceptions.Exception

          +

          No devices found.

          +
          + +
          +
          +exception alarmdecoder.util.CommError[source]
          +

          Bases: exceptions.Exception

          +

          There was an error communicating with the device.

          +
          + +
          +
          +exception alarmdecoder.util.TimeoutError[source]
          +

          Bases: exceptions.Exception

          +

          There was a timeout while trying to communicate with the device.

          +
          + +
          +
          +exception alarmdecoder.util.InvalidMessageError[source]
          +

          Bases: exceptions.Exception

          +

          The format of the panel message was invalid.

          +
          + +
          +
          +class alarmdecoder.util.Firmware[source]
          +

          Bases: object

          +

          Represents firmware for the Alarm Decoder devices.

          +
          +
          +STAGE_START = 0
          +
          + +
          +
          +STAGE_WAITING = 1
          +
          + +
          +
          +STAGE_BOOT = 2
          +
          + +
          +
          +STAGE_LOAD = 3
          +
          + +
          +
          +STAGE_UPLOADING = 4
          +
          + +
          +
          +STAGE_DONE = 5
          +
          + +
          +
          +static upload(dev, filename, progress_callback=None)[source]
          +

          Uploads firmware to an Alarm Decoder device.

          + +++ + + + + + +
          Parameters:
            +
          • filename (string) – firmware filename
          • +
          • progress_callback (function) – callback function used to report progress
          +
          Raises :

          alarmdecoder.util.NoDeviceError, alarmdecoder.util.TimeoutError

          +
          +
          + +
          +
          +
          +

          panels Module

          +

          Representations of Panels and their templates.

      @@ -1188,15 +1568,12 @@ devices.

      Table Of Contents

      @@ -1204,9 +1581,6 @@ devices.

      Previous topic

      Welcome to alarmdecoder’s documentation!

      -

      Next topic

      -

      event Package

      This Page

      • modules |
      • -
      • - next |
      • previous |
      • diff --git a/docs/build/html/genindex.html b/docs/build/html/genindex.html index e92fc80..1cf6cde 100644 --- a/docs/build/html/genindex.html +++ b/docs/build/html/genindex.html @@ -55,7 +55,9 @@ | D | E | F + | G | I + | K | L | M | N @@ -67,7 +69,6 @@ | U | V | W - | X | Z
      @@ -83,7 +84,17 @@ -
      address (alarmdecoder.messages.ExpanderMessage attribute) +
      address (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      (alarmdecoder.messages.ExpanderMessage attribute) +
      + +
      + +
      address_mask (alarmdecoder.decoder.AlarmDecoder attribute)
      @@ -95,16 +106,24 @@ -
      alarmdecoder.devices (module) +
      AlarmDecoder (class in alarmdecoder.decoder)
      -
      alarmdecoder.event (module) +
      alarmdecoder.decoder (module) +
      + + +
      alarmdecoder.devices (module)
      +
      alarmdecoder.event (module) +
      + +
      alarmdecoder.event.event (module)
      @@ -154,9 +173,17 @@
      battery_low (alarmdecoder.messages.Message attribute)
      + +
      BATTERY_TIMEOUT (alarmdecoder.decoder.AlarmDecoder attribute) +
      +
      +
      battery_timeout (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      BAUDRATE (alarmdecoder.devices.SerialDevice attribute)
      @@ -196,18 +223,26 @@
      chime_on (alarmdecoder.messages.Message attribute)
      + +
      CLEAR (alarmdecoder.zonetracking.Zone attribute) +
      +
      -
      CLEAR (alarmdecoder.zonetracking.Zone attribute) +
      clear_zone() (alarmdecoder.decoder.AlarmDecoder method)
      -
      close() (alarmdecoder.devices.Device method) +
      close() (alarmdecoder.decoder.AlarmDecoder method)
      +
      (alarmdecoder.devices.Device method) +
      + +
      (alarmdecoder.devices.SerialDevice method)
      @@ -225,6 +260,10 @@ +
      configbits (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      cursor_location (alarmdecoder.messages.Message attribute)
      @@ -235,6 +274,10 @@
      +
      deduplicate (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      description (alarmdecoder.devices.USBDevice attribute)
      @@ -259,6 +302,18 @@ + -
      +
      emulate_lrr (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      emulate_relay (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      emulate_zone (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      entry_delay_off (alarmdecoder.messages.Message attribute)
      @@ -270,12 +325,12 @@
      event_data (alarmdecoder.messages.LRRMessage attribute)
      +
      event_type (alarmdecoder.messages.LRRMessage attribute)
      -
      EventHandler (class in alarmdecoder.event.event)
      @@ -303,6 +358,14 @@ +
      fault_zone() (alarmdecoder.decoder.AlarmDecoder method) +
      + + +
      faulted (alarmdecoder.zonetracking.Zonetracker attribute) +
      + +
      find() (alarmdecoder.devices.USBDevice class method)
      @@ -327,6 +390,14 @@ +
      fire_timeout (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      FIRE_TIMEOUT (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      Firmware (class in alarmdecoder.util)
      @@ -341,13 +412,29 @@
      +

      G

      + + +
      + +
      get_config() (alarmdecoder.decoder.AlarmDecoder method) +
      + +
      +

      I

      -
      id (alarmdecoder.devices.Device attribute) +
      id (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      (alarmdecoder.devices.Device attribute)
      +
      interface (alarmdecoder.devices.SerialDevice attribute)
      @@ -375,6 +462,30 @@
      +

      K

      + + + +
      + +
      KEY_F1 (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      KEY_F2 (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      KEY_F3 (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      KEY_F4 (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      +

      L

      @@ -411,6 +522,10 @@
      +
      name (alarmdecoder.zonetracking.Zone attribute) +
      + +
      NoDeviceError
      @@ -427,11 +542,37 @@
      +
      on_alarm (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_arm (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      on_attached (alarmdecoder.devices.USBDevice.DetectThread attribute)
      -
      on_close (alarmdecoder.devices.Device attribute) +
      on_boot (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_bypass (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_close (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      (alarmdecoder.devices.Device attribute) +
      + +
      + +
      on_config_received (alarmdecoder.decoder.AlarmDecoder attribute)
      @@ -439,17 +580,61 @@ +
      on_disarm (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      on_fault (alarmdecoder.zonetracking.Zonetracker attribute)
      -
      on_open (alarmdecoder.devices.Device attribute) +
      on_fire (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_low_battery (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_lrr_message (alarmdecoder.decoder.AlarmDecoder attribute)
      -
      on_read (alarmdecoder.devices.Device attribute) +
      on_message (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_open (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      (alarmdecoder.devices.Device attribute) +
      + +
      + +
      on_panic (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_power_changed (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_read (alarmdecoder.decoder.AlarmDecoder attribute) +
      + +
      + +
      (alarmdecoder.devices.Device attribute) +
      + +
      + +
      on_relay_changed (alarmdecoder.decoder.AlarmDecoder attribute)
      @@ -457,15 +642,37 @@ -
      on_write (alarmdecoder.devices.Device attribute) +
      on_rfx_message (alarmdecoder.decoder.AlarmDecoder attribute)
      -
      open() (alarmdecoder.devices.SerialDevice method) +
      on_write (alarmdecoder.decoder.AlarmDecoder attribute)
      +
      (alarmdecoder.devices.Device attribute) +
      + +
      + +
      on_zone_fault (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      on_zone_restore (alarmdecoder.decoder.AlarmDecoder attribute) +
      + + +
      open() (alarmdecoder.decoder.AlarmDecoder method) +
      + +
      + +
      (alarmdecoder.devices.SerialDevice method) +
      + +
      (alarmdecoder.devices.SocketDevice method)
      @@ -547,6 +754,10 @@
      +
      reboot() (alarmdecoder.decoder.AlarmDecoder method) +
      + +
      RELAY (alarmdecoder.messages.ExpanderMessage attribute)
      @@ -575,6 +786,14 @@ + -
      +
      save_config() (alarmdecoder.decoder.AlarmDecoder method) +
      + + +
      send() (alarmdecoder.decoder.AlarmDecoder method) +
      + +
      serial_number (alarmdecoder.devices.USBDevice attribute)
      @@ -616,12 +835,12 @@
      STAGE_DONE (alarmdecoder.util.Firmware attribute)
      +
      STAGE_LOAD (alarmdecoder.util.Firmware attribute)
      -
      STAGE_START (alarmdecoder.util.Firmware attribute)
      @@ -639,6 +858,10 @@ +
      status (alarmdecoder.zonetracking.Zone attribute) +
      + +
      STATUS (alarmdecoder.zonetracking.Zone attribute)
      @@ -681,6 +904,10 @@
      +
      timestamp (alarmdecoder.zonetracking.Zone attribute) +
      + +
      type (alarmdecoder.messages.ExpanderMessage attribute)
      @@ -747,21 +974,15 @@
      -

      X

      +

      Z

      -
      -
      x (alarmdecoder.messages.RFMessage attribute) +
      ZONE (alarmdecoder.messages.ExpanderMessage attribute)
      -
      - -

      Z

      - - + + +
      -
      ZONE (alarmdecoder.messages.ExpanderMessage attribute) +
      zone (alarmdecoder.zonetracking.Zone attribute)
      @@ -775,6 +996,10 @@ +
      zones (alarmdecoder.zonetracking.Zonetracker attribute) +
      + +
      Zonetracker (class in alarmdecoder.zonetracking)
      diff --git a/docs/build/html/index.html b/docs/build/html/index.html index 2caf0e4..bffcd64 100644 --- a/docs/build/html/index.html +++ b/docs/build/html/index.html @@ -50,24 +50,18 @@

      Welcome to alarmdecoder’s documentation!

      -

      Contents:

      +

      This is the API documentation for the Alarm Decoder Python library. It provides support for interacting with the Alarm Decoder (AD2) family of security alarm devices, including the AD2USB, AD2SERIAL and AD2PI.

      +

      The source code, requirements and examples for this project may be found here.

      +

      Table of Contents:

      diff --git a/docs/build/html/modules.html b/docs/build/html/modules.html index 0d97bc4..28bef02 100644 --- a/docs/build/html/modules.html +++ b/docs/build/html/modules.html @@ -49,20 +49,12 @@
      diff --git a/docs/build/html/objects.inv b/docs/build/html/objects.inv index 7e14e50..3bfc8ad 100644 Binary files a/docs/build/html/objects.inv and b/docs/build/html/objects.inv differ diff --git a/docs/build/html/py-modindex.html b/docs/build/html/py-modindex.html index 6064500..50f6b5c 100644 --- a/docs/build/html/py-modindex.html +++ b/docs/build/html/py-modindex.html @@ -64,6 +64,11 @@
      alarmdecoder
          + alarmdecoder.decoder +
          diff --git a/docs/build/html/searchindex.js b/docs/build/html/searchindex.js index ae78dc9..8ae2a6f 100644 --- a/docs/build/html/searchindex.js +++ b/docs/build/html/searchindex.js @@ -1 +1 @@ -Search.setIndex({envversion:42,terms:{represent:1,all:[1,0],code:1,entri:1,zone_bypass:1,text:1,sent:1,recogn:1,arm:1,ssl_kei:1,socketdevic:1,through:1,human:1,stage_don:1,data:1,find:1,backlight:1,paramet:1,raw:1,current:1,baudrat:1,locat:1,expos:1,also:0,readabl:1,except:1,identif:1,whether:1,add:0,program:1,serialdevic:1,bypass:1,on_read:1,match:1,sourc:[1,0],"return":1,string:1,serial_numb:1,format:1,read:1,numeric_cod:1,stop:1,ssl:1,lcd:1,lrr:1,progress:1,report:1,detach:1,requir:1,enabl:1,ad2:1,name:1,earg:0,list:1,upload:1,authent:1,factori:1,"try":1,provid:1,expand:1,stage_wait:1,mode:1,timeout:1,contain:1,found:1,alarm_event_occur:1,expandermessag:1,page:3,certif:1,nodeviceerror:1,on_open:1,request:1,"static":1,connect:1,usbdevic:1,on_writ:1,our:1,charact:1,read_lin:1,event:1,stop_read:1,pyseri:1,index:3,statu:1,detect:1,parent:1,purge_buff:1,pattern:1,ad2seri:1,callback:1,content:3,pyftdi:1,written:1,reader:1,"new":0,awai:1,method:1,localhost:1,ser2sock:1,process:1,perimet:1,run:1,timeouterror:1,kei:1,state:1,numer:1,gener:1,stage_load:1,cursor_loc:1,entry_delay_off:1,like:0,on_clos:1,base:[1,0],ssl_certif:1,address:1,path:1,"byte":1,armed_hom:1,valu:1,describ:1,fire_alarm:1,search:[1,3],actual:1,zone:1,thread:1,fault:1,readthread:1,stage_start:1,prior:1,rais:1,loop:1,fals:1,find_al:1,ad2usb:1,first:1,oper:0,rang:1,via:1,vid:1,appli:1,keypad:1,"float":1,number:1,automat:1,filenam:1,read_timeout:1,"long":1,famili:1,batteri:1,chime:1,open:1,on_attach:1,differ:1,from:1,usb:1,commun:1,detectthread:1,support:1,system:1,been:1,beep:1,attach:1,singl:1,handler:0,call:[1,0],on_detach:1,start_detect:1,ac_pow:1,interfac:1,stage_upload:1,type:1,start:1,low:1,"function":[1,0],no_reader_thread:1,fire:[1,0],tupl:1,commerror:1,chime_on:1,convert:1,specifi:1,stage_boot:1,rfmessag:1,flag:1,indic:1,relai:1,expander_to_zon:1,line:1,repres:1,cach:1,present:1,must:0,sound:1,none:[1,0],sender:0,retriev:1,on_restor:1,restor:1,"default":1,remov:[1,0],purg:1,displai:1,dev:1,stop_detect:1,cursor:1,defin:0,"while":1,kwarg:0,can:0,str:1,error:1,battery_low:1,alarm:1,radio:1,expir:1,backlight_on:1,"int":1,descript:1,arg:0,pid:1,templat:1,bitfield:1,check_zon:1,on_fault:1,itself:0,exist:0,aliv:1,ftdi_vendor_id:1,home:1,close:1,vendor:1,ftdi_product_id:1,alarm_sound:1,serial:1,delai:1,readi:1,panel_data:1,progress_callback:1,author:1,receiv:1,anoth:1,belong:1,when:1,invalid:1,port:1,write:1,field:1,client:1,bool:1,which:1,occur:1,instead:0,you:0,event_data:1,channel:1,updat:1,status:1,product:1,relat:1,intend:1,firmwar:1,supervis:1,buffer:1,expans:1,decod:1,event_typ:1,ftdi:1,partit:1,perimeter_onli:1,wire:1,power:1,user:1,attent:1,basemessag:1,eventhandl:0,associ:1,"class":[1,0],check:1,armed_awai:1,handl:1,classmethod:1,doc:0,clear:1,mask:1,object:[1,0],ssl_ca:1,issu:1,lrrmessag:1,is_reader_al:1,obj:0,thi:1,programming_mod:1,track:1,func:0,invalidmessageerror:1,usual:1},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:classmethod","5":"py:exception","6":"py:staticmethod"},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","classmethod","Python class method"],"5":["py","exception","Python exception"],"6":["py","staticmethod","Python static method"]},filenames:["alarmdecoder.event","alarmdecoder","modules","index"],titles:["event Package","alarmdecoder Package","alarmdecoder","Welcome to alarmdecoder’s documentation!"],objects:{"alarmdecoder.messages.LRRMessage":{partition:[1,3,1,""],event_data:[1,3,1,""],event_type:[1,3,1,""]},"alarmdecoder.messages.BaseMessage":{raw:[1,3,1,""]},"alarmdecoder.messages.ExpanderMessage":{RELAY:[1,3,1,""],ZONE:[1,3,1,""],value:[1,3,1,""],address:[1,3,1,""],type:[1,3,1,""],channel:[1,3,1,""]},"alarmdecoder.event.event":{EventHandler:[0,1,1,""],Event:[0,1,1,""]},"alarmdecoder.zonetracking.Zone":{STATUS:[1,3,1,""],FAULT:[1,3,1,""],CLEAR:[1,3,1,""],CHECK:[1,3,1,""]},"alarmdecoder.devices.SerialDevice":{write:[1,2,1,""],BAUDRATE:[1,3,1,""],read:[1,2,1,""],read_line:[1,2,1,""],find_all:[1,6,1,""],"interface":[1,3,1,""],close:[1,2,1,""],open:[1,2,1,""]},"alarmdecoder.zonetracking":{Zonetracker:[1,1,1,""],Zone:[1,1,1,""]},"alarmdecoder.zonetracking.Zonetracker":{on_restore:[1,3,1,""],EXPIRE:[1,3,1,""],expander_to_zone:[1,2,1,""],update:[1,2,1,""],on_fault:[1,3,1,""]},"alarmdecoder.devices.Device.ReadThread":{READ_TIMEOUT:[1,3,1,""],stop:[1,2,1,""],run:[1,2,1,""]},"alarmdecoder.event":{event:[0,0,1,""]},"alarmdecoder.messages":{Message:[1,1,1,""],LRRMessage:[1,1,1,""],RFMessage:[1,1,1,""],ExpanderMessage:[1,1,1,""],BaseMessage:[1,1,1,""]},"alarmdecoder.devices":{Device:[1,1,1,""],SocketDevice:[1,1,1,""],USBDevice:[1,1,1,""],SerialDevice:[1,1,1,""]},"alarmdecoder.devices.USBDevice.DetectThread":{run:[1,2,1,""],stop:[1,2,1,""],on_attached:[1,3,1,""],on_detached:[1,3,1,""]},alarmdecoder:{zonetracking:[1,0,1,""],messages:[1,0,1,""],devices:[1,0,1,""],util:[1,0,1,""],panels:[1,0,1,""],event:[0,0,1,""]},"alarmdecoder.devices.SocketDevice":{ssl_certificate:[1,3,1,""],ssl_key:[1,3,1,""],read:[1,2,1,""],ssl_ca:[1,3,1,""],read_line:[1,2,1,""],ssl:[1,3,1,""],write:[1,2,1,""],"interface":[1,3,1,""],close:[1,2,1,""],open:[1,2,1,""]},"alarmdecoder.devices.USBDevice":{write:[1,2,1,""],BAUDRATE:[1,3,1,""],description:[1,3,1,""],read:[1,2,1,""],DetectThread:[1,1,1,""],stop_detection:[1,4,1,""],devices:[1,4,1,""],start_detection:[1,4,1,""],read_line:[1,2,1,""],find_all:[1,4,1,""],FTDI_VENDOR_ID:[1,3,1,""],serial_number:[1,3,1,""],"interface":[1,3,1,""],close:[1,2,1,""],FTDI_PRODUCT_ID:[1,3,1,""],open:[1,2,1,""],find:[1,4,1,""]},"alarmdecoder.messages.Message":{backlight_on:[1,3,1,""],alarm_event_occurred:[1,3,1,""],programming_mode:[1,3,1,""],text:[1,3,1,""],bitfield:[1,3,1,""],armed_home:[1,3,1,""],alarm_sounding:[1,3,1,""],ready:[1,3,1,""],zone_bypassed:[1,3,1,""],panel_data:[1,3,1,""],check_zone:[1,3,1,""],numeric_code:[1,3,1,""],battery_low:[1,3,1,""],chime_on:[1,3,1,""],entry_delay_off:[1,3,1,""],perimeter_only:[1,3,1,""],fire_alarm:[1,3,1,""],ac_power:[1,3,1,""],beeps:[1,3,1,""],mask:[1,3,1,""],armed_away:[1,3,1,""],cursor_location:[1,3,1,""]},"alarmdecoder.devices.Device":{stop_reader:[1,2,1,""],on_open:[1,3,1,""],on_write:[1,3,1,""],ReadThread:[1,1,1,""],on_close:[1,3,1,""],on_read:[1,3,1,""],close:[1,2,1,""],is_reader_alive:[1,2,1,""],id:[1,3,1,""]},"alarmdecoder.messages.RFMessage":{battery:[1,3,1,""],value:[1,3,1,""],supervision:[1,3,1,""],serial_number:[1,3,1,""],x:[1,3,1,""],loop:[1,3,1,""]},"alarmdecoder.event.event.EventHandler":{fire:[0,2,1,""],add:[0,2,1,""],remove:[0,2,1,""]},"alarmdecoder.util.Firmware":{STAGE_LOAD:[1,3,1,""],upload:[1,6,1,""],STAGE_BOOT:[1,3,1,""],STAGE_START:[1,3,1,""],STAGE_UPLOADING:[1,3,1,""],STAGE_WAITING:[1,3,1,""],STAGE_DONE:[1,3,1,""]},"alarmdecoder.util":{CommError:[1,5,1,""],Firmware:[1,1,1,""],TimeoutError:[1,5,1,""],NoDeviceError:[1,5,1,""],InvalidMessageError:[1,5,1,""]}},titleterms:{subpackag:1,alarmdecod:[1,2,3],welcom:3,modul:[1,0],devic:1,zonetrack:1,util:1,packag:[1,0],messag:1,indic:3,tabl:3,document:3,event:0,panel:1}}) \ No newline at end of file +Search.setIndex({envversion:42,terms:{represent:2,all:[0,2],code:[3,2],on_boot:2,stage_don:2,backlight:2,zone:2,messagesexpandermessag:[],readabl:2,send:2,program:2,x03:2,x02:2,x01:2,sent:2,x04:2,sourc:[0,2,3],string:2,clear_zon:2,fals:2,on_messag:2,perimeter_onli:2,lrr:2,level:2,list:2,upload:2,"try":2,emul:2,expandermessag:2,second:2,port:2,supervis:2,ad2seri:[3,2],current:2,"new":0,method:2,ser2sock:2,full:[],timeouterror:2,gener:[],usbdevic:2,entry_delay_off:2,here:3,on_config_receiv:2,address:2,path:2,valu:2,fire_alarm:2,search:[3,2],sender:0,prior:2,invalidmessageerror:2,via:2,vid:2,appli:2,filenam:2,api:3,famili:[3,2],from:2,describ:2,commun:2,is_reader_al:2,handler:0,call:[0,2],type:2,relat:2,stage_boot:2,pkei:2,flag:2,indic:[],relai:2,actual:2,cach:2,serialdevic:2,must:0,none:[0,2],retriev:2,key_f2:2,on_restor:2,restor:2,dev:2,kwarg:0,can:0,aliv:2,backlight_on:2,process:2,templat:2,high:2,cursor_loc:2,serial:2,occur:2,delai:2,progress_callback:2,secur:3,anoth:2,simulate_wire_problem:2,write:2,purg:2,instead:0,panic:2,updat:2,product:2,recogn:2,x509:2,ftdi:2,befor:2,attent:2,mai:3,data:2,github:[],classmethod:2,ssl_ca:2,issu:2,callback:2,"switch":2,ttimeout:2,socketdevic:2,disarm:2,jpath:2,through:2,paramet:2,bypass:2,on_read:2,main:2,"return":2,python:3,timestamp:2,on_bypass:2,detach:2,name:2,revert:2,on_pan:2,authent:2,stage_wait:2,mode:2,timeout:2,found:[3,2],earg:0,nodeviceerror:2,"static":2,connect:2,our:2,read_lin:2,event:[],ad2pi:[3,2],reboot:2,content:3,reader:2,factori:2,written:2,standard:2,on_clos:2,base:[0,2],dictionari:2,"byte":2,armed_hom:2,on_detach:2,key_f4:2,key_f1:2,nutechsoftwar:[],key_f3:2,emulate_relai:2,openssl:2,readthread:2,get_config:2,on_rfx_messag:2,find_al:2,ad2usb:[3,2],first:2,oper:0,rang:2,number:2,on_writ:2,configbit:2,open:2,on_power_chang:2,differ:2,associ:2,interact:3,system:2,wrapper:2,attach:2,start_detect:2,on_open:2,battery_low:2,specifi:2,rfmessag:2,on_fir:2,provid:[3,2],remov:[0,2],charact:2,project:3,str:[],save_config:2,ani:2,bitfield:2,raw:2,on_fault:2,expir:2,programming_mod:2,also:[0,2],exampl:3,which:2,event_data:2,channel:2,zone_bypass:2,index:3,pyftdi:2,object:[0,2],most:2,detect:2,basemessag:2,"class":[0,2],armed_awai:2,doc:0,clear:2,request:2,emulate_lrr:2,on_low_batteri:2,text:2,ssl_kei:2,radio:2,find:2,locat:2,configur:2,solut:2,fault_zon:2,should:2,serial_numb:2,stop:2,ssl:2,report:2,requir:[3,2],enabl:2,rfx:[],whether:2,common:2,partit:2,contain:2,alarm_event_occur:2,certif:2,set:2,keypad:2,ac_pow:2,on_alarm:2,perimet:2,arg:0,close:2,arm:2,stop_read:2,pyseri:2,statu:2,wire:2,parent:[],pattern:2,state:2,between:2,progress:2,awai:2,kei:2,numer:2,last:2,fault:2,com:[],batteri:2,identif:2,detectthread:2,been:2,beep:2,trigger:2,no_reader_thread:2,fire:[0,2],commerror:2,chime_on:2,convert:2,func:0,present:2,sound:2,check_zon:2,dedupl:2,cursor:2,defin:0,"while":2,stage_upload:2,error:2,loop:2,readi:2,itself:0,ftdi_vendor_id:2,on_zone_fault:2,alarm_sound:2,panel_data:2,author:2,receiv:2,belong:2,handl:2,decod:[3,2],status:2,finish:2,http:[],expans:2,rais:2,user:2,expand:2,lower:2,entri:2,client:2,thi:[3,2],usual:2,boot:2,human:2,baudrat:2,expos:2,field:2,"_on_open":2,except:2,on_attach:2,add:0,board:2,match:2,vendor:2,around:2,format:2,read:2,numeric_cod:2,lcd:2,bit:2,ad2:[3,2],like:0,singl:2,page:3,www:[],crypto:2,thread:2,toctre:[],fire_timeout:2,home:2,librari:3,buffer:2,localhost:2,run:2,power:2,event_typ:2,stage_load:2,ssl_certif:2,usb:2,expander_to_zon:2,simul:2,stage_start:2,includ:3,address_mask:2,"float":2,automat:2,chime:2,support:[3,2],on_relay_chang:2,"long":2,start:2,interfac:2,low:2,stop_detect:2,"function":[0,2],tupl:2,eventhandl:0,line:2,emulate_zon:2,"default":2,displai:2,purge_buff:2,alarm:[3,2],"int":2,mask:2,pid:2,repres:2,on_zone_restor:2,exist:0,read_timeout:2,ftdi_product_id:2,check:2,battery_timeout:2,when:2,invalid:2,on_disarm:2,bool:2,you:0,maxdepth:[],intend:2,firmwar:2,track:2,on_arm:2,descript:2,lrrmessag:2,on_lrr_messag:2,obj:0},objtypes:{"0":"py:module","1":"py:class","2":"py:method","3":"py:attribute","4":"py:exception","5":"py:classmethod","6":"py:staticmethod"},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","method","Python method"],"3":["py","attribute","Python attribute"],"4":["py","exception","Python exception"],"5":["py","classmethod","Python class method"],"6":["py","staticmethod","Python static method"]},filenames:["alarmdecoder.event","modules","alarmdecoder","index"],titles:["event Package","alarmdecoder","alarmdecoder Package","Welcome to alarmdecoder’s documentation!"],objects:{"alarmdecoder.messages.LRRMessage":{partition:[2,3,1,""],event_data:[2,3,1,""],event_type:[2,3,1,""]},"alarmdecoder.messages.BaseMessage":{raw:[2,3,1,""]},"alarmdecoder.messages.ExpanderMessage":{RELAY:[2,3,1,""],ZONE:[2,3,1,""],value:[2,3,1,""],address:[2,3,1,""],type:[2,3,1,""],channel:[2,3,1,""]},"alarmdecoder.event.event":{EventHandler:[0,1,1,""],Event:[0,1,1,""]},"alarmdecoder.zonetracking.Zone":{status:[2,3,1,""],STATUS:[2,3,1,""],name:[2,3,1,""],zone:[2,3,1,""],timestamp:[2,3,1,""],CLEAR:[2,3,1,""],FAULT:[2,3,1,""],CHECK:[2,3,1,""]},"alarmdecoder.devices.SerialDevice":{read_line:[2,2,1,""],BAUDRATE:[2,3,1,""],read:[2,2,1,""],write:[2,2,1,""],find_all:[2,6,1,""],"interface":[2,3,1,""],close:[2,2,1,""],open:[2,2,1,""]},"alarmdecoder.zonetracking":{Zonetracker:[2,1,1,""],Zone:[2,1,1,""]},"alarmdecoder.zonetracking.Zonetracker":{faulted:[2,3,1,""],on_restore:[2,3,1,""],update:[2,2,1,""],zones:[2,3,1,""],on_fault:[2,3,1,""],EXPIRE:[2,3,1,""],expander_to_zone:[2,2,1,""]},"alarmdecoder.devices.Device.ReadThread":{READ_TIMEOUT:[2,3,1,""],stop:[2,2,1,""],run:[2,2,1,""]},"alarmdecoder.event":{event:[0,0,1,""]},"alarmdecoder.messages":{Message:[2,1,1,""],LRRMessage:[2,1,1,""],RFMessage:[2,1,1,""],ExpanderMessage:[2,1,1,""],BaseMessage:[2,1,1,""]},"alarmdecoder.devices":{Device:[2,1,1,""],SocketDevice:[2,1,1,""],USBDevice:[2,1,1,""],SerialDevice:[2,1,1,""]},"alarmdecoder.devices.USBDevice.DetectThread":{stop:[2,2,1,""],run:[2,2,1,""],on_attached:[2,3,1,""],on_detached:[2,3,1,""]},alarmdecoder:{zonetracking:[2,0,1,""],messages:[2,0,1,""],devices:[2,0,1,""],util:[2,0,1,""],decoder:[2,0,1,""],panels:[2,0,1,""],event:[0,0,1,""]},"alarmdecoder.decoder.AlarmDecoder":{configbits:[2,3,1,""],on_rfx_message:[2,3,1,""],fault_zone:[2,2,1,""],on_open:[2,3,1,""],save_config:[2,2,1,""],on_alarm:[2,3,1,""],on_arm:[2,3,1,""],on_boot:[2,3,1,""],fire_timeout:[2,3,1,""],close:[2,2,1,""],open:[2,2,1,""],id:[2,3,1,""],on_power_changed:[2,3,1,""],BATTERY_TIMEOUT:[2,3,1,""],KEY_F1:[2,3,1,""],KEY_F2:[2,3,1,""],KEY_F3:[2,3,1,""],on_message:[2,3,1,""],reboot:[2,2,1,""],send:[2,2,1,""],on_zone_restore:[2,3,1,""],on_disarm:[2,3,1,""],on_fire:[2,3,1,""],on_write:[2,3,1,""],on_read:[2,3,1,""],on_lrr_message:[2,3,1,""],KEY_F4:[2,3,1,""],clear_zone:[2,2,1,""],on_zone_fault:[2,3,1,""],on_config_received:[2,3,1,""],FIRE_TIMEOUT:[2,3,1,""],on_close:[2,3,1,""],on_bypass:[2,3,1,""],address:[2,3,1,""],battery_timeout:[2,3,1,""],on_panic:[2,3,1,""],on_relay_changed:[2,3,1,""],on_low_battery:[2,3,1,""],emulate_lrr:[2,3,1,""],deduplicate:[2,3,1,""],emulate_zone:[2,3,1,""],get_config:[2,2,1,""],address_mask:[2,3,1,""],emulate_relay:[2,3,1,""]},"alarmdecoder.devices.SocketDevice":{ssl_certificate:[2,3,1,""],ssl_key:[2,3,1,""],read:[2,2,1,""],ssl_ca:[2,3,1,""],read_line:[2,2,1,""],ssl:[2,3,1,""],write:[2,2,1,""],"interface":[2,3,1,""],close:[2,2,1,""],open:[2,2,1,""]},"alarmdecoder.devices.USBDevice":{write:[2,2,1,""],BAUDRATE:[2,3,1,""],description:[2,3,1,""],read:[2,2,1,""],DetectThread:[2,1,1,""],stop_detection:[2,5,1,""],devices:[2,5,1,""],start_detection:[2,5,1,""],read_line:[2,2,1,""],find_all:[2,5,1,""],FTDI_VENDOR_ID:[2,3,1,""],serial_number:[2,3,1,""],"interface":[2,3,1,""],close:[2,2,1,""],FTDI_PRODUCT_ID:[2,3,1,""],open:[2,2,1,""],find:[2,5,1,""]},"alarmdecoder.messages.Message":{backlight_on:[2,3,1,""],alarm_event_occurred:[2,3,1,""],programming_mode:[2,3,1,""],text:[2,3,1,""],bitfield:[2,3,1,""],armed_home:[2,3,1,""],alarm_sounding:[2,3,1,""],ready:[2,3,1,""],zone_bypassed:[2,3,1,""],panel_data:[2,3,1,""],check_zone:[2,3,1,""],numeric_code:[2,3,1,""],battery_low:[2,3,1,""],chime_on:[2,3,1,""],entry_delay_off:[2,3,1,""],perimeter_only:[2,3,1,""],fire_alarm:[2,3,1,""],ac_power:[2,3,1,""],beeps:[2,3,1,""],mask:[2,3,1,""],armed_away:[2,3,1,""],cursor_location:[2,3,1,""]},"alarmdecoder.devices.Device":{stop_reader:[2,2,1,""],on_open:[2,3,1,""],on_write:[2,3,1,""],ReadThread:[2,1,1,""],on_close:[2,3,1,""],on_read:[2,3,1,""],close:[2,2,1,""],is_reader_alive:[2,2,1,""],id:[2,3,1,""]},"alarmdecoder.messages.RFMessage":{battery:[2,3,1,""],value:[2,3,1,""],loop:[2,3,1,""],supervision:[2,3,1,""],serial_number:[2,3,1,""]},"alarmdecoder.decoder":{AlarmDecoder:[2,1,1,""]},"alarmdecoder.event.event.EventHandler":{fire:[0,2,1,""],add:[0,2,1,""],remove:[0,2,1,""]},"alarmdecoder.util.Firmware":{STAGE_LOAD:[2,3,1,""],upload:[2,6,1,""],STAGE_BOOT:[2,3,1,""],STAGE_START:[2,3,1,""],STAGE_UPLOADING:[2,3,1,""],STAGE_WAITING:[2,3,1,""],STAGE_DONE:[2,3,1,""]},"alarmdecoder.util":{CommError:[2,4,1,""],Firmware:[2,1,1,""],TimeoutError:[2,4,1,""],NoDeviceError:[2,4,1,""],InvalidMessageError:[2,4,1,""]}},titleterms:{subpackag:[],alarmdecod:[3,1,2],welcom:3,modul:[0,2],devic:2,zonetrack:2,util:2,packag:[0,2],messag:2,indic:3,tabl:3,document:3,event:0,panel:2}}) \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index e06150d..8c2a7eb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -123,7 +123,7 @@ html_theme = 'default' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ['static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. diff --git a/docs/index.rst b/docs/index.rst index 41929e0..1cc583f 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -4,9 +4,18 @@ contain the root `toctree` directive. Welcome to alarmdecoder's documentation! -==================================== +======================================== -Contents: +This is the API documentation for the `Alarm Decoder`_ Python library. It provides support for interacting with the `Alarm Decoder`_ (AD2) family of security alarm devices, including the `AD2USB`_, `AD2SERIAL`_ and `AD2PI`_. + +The source code, requirements and examples for this project may be found `here `_. + +.. _Alarm Decoder: http://www.alarmdecoder.com +.. _AD2USB: http://www.alarmdecoder.com +.. _AD2SERIAL: http://www.alarmdecoder.com +.. _AD2PI: http://www.alarmdecoder.com + +Table of Contents: .. toctree:: :maxdepth: 4