@@ -1,23 +1,28 @@ | |||||
Alarm Decoder | 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 | This also includes devices that have been exposed via [ser2sock](http://github.com/nutechsoftware/ser2sock), which | ||||
supports encryption via SSL/TLS. | supports encryption via SSL/TLS. | ||||
Installation | Installation | ||||
------------ | ------------ | ||||
alarmdecoder can be installed through pip: | |||||
AlarmDecoder can be installed through pip: | |||||
```pip install alarmdecoder``` | ```pip install alarmdecoder``` | ||||
or from source: | or from source: | ||||
```python setup.py install``` | |||||
``` | |||||
git clone http://github.com/nutechsoftware/alarmdecoder | |||||
python setup.py install | |||||
``` | |||||
Requirements | 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 | * [pyftdi](https://github.com/eblot/pyftdi) >= 0.9.0 | ||||
* [pyusb](http://sourceforge.net/apps/trac/pyusb/) >= 1.0.0b1 | * [pyusb](http://sourceforge.net/apps/trac/pyusb/) >= 1.0.0b1 | ||||
* [pyserial](http://pyserial.sourceforge.net/) >= 2.7 | * [pyserial](http://pyserial.sourceforge.net/) >= 2.7 | ||||
@@ -1,5 +1,7 @@ | |||||
""" | """ | ||||
Provides the full AlarmDecoder class. | |||||
Provides the main AlarmDecoder class. | |||||
.. _Alarm Decoder: http://www.alarmdecoder.com | |||||
.. moduleauthor:: Scott Petersen <scott@nutech.com> | .. moduleauthor:: Scott Petersen <scott@nutech.com> | ||||
""" | """ | ||||
@@ -14,34 +16,34 @@ from .zonetracking import Zonetracker | |||||
class AlarmDecoder(object): | class AlarmDecoder(object): | ||||
""" | """ | ||||
High-level wrapper around Alarm Decoder (AD2) devices. | |||||
High-level wrapper around `Alarm Decoder`_ (AD2) devices. | |||||
""" | """ | ||||
# High-level Events | # 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 | # 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 | # 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 | # Constants | ||||
KEY_F1 = unichr(1) + unichr(1) + unichr(1) | KEY_F1 = unichr(1) + unichr(1) + unichr(1) | ||||
@@ -54,15 +56,31 @@ class AlarmDecoder(object): | |||||
"""Represents panel function key #4""" | """Represents panel function key #4""" | ||||
BATTERY_TIMEOUT = 30 | BATTERY_TIMEOUT = 30 | ||||
"""Timeout before the battery status reverts.""" | |||||
"""Default timeout (in seconds) before the battery status reverts.""" | |||||
FIRE_TIMEOUT = 30 | 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): | def __init__(self, device): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
:param device: The low-level device used for this Alarm Decoder | |||||
:param device: The low-level device used for this `Alarm Decoder`_ | |||||
interface. | interface. | ||||
:type device: Device | :type device: Device | ||||
""" | """ | ||||
@@ -105,9 +123,9 @@ class AlarmDecoder(object): | |||||
@property | @property | ||||
def id(self): | 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 | return self._device.id | ||||
@@ -116,7 +134,7 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Retrieves the timeout for restoring the battery status, in seconds. | Retrieves the timeout for restoring the battery status, in seconds. | ||||
:returns: The battery status timeout | |||||
:returns: battery status timeout | |||||
""" | """ | ||||
return self._battery_timeout | return self._battery_timeout | ||||
@@ -125,7 +143,7 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Sets the timeout for restoring the battery status, in seconds. | Sets the timeout for restoring the battery status, in seconds. | ||||
:param value: The timeout in seconds. | |||||
:param value: timeout in seconds | |||||
:type value: int | :type value: int | ||||
""" | """ | ||||
self._battery_timeout = value | self._battery_timeout = value | ||||
@@ -135,7 +153,7 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Retrieves the timeout for restoring the fire status, in seconds. | Retrieves the timeout for restoring the fire status, in seconds. | ||||
:returns: The fire status timeout | |||||
:returns: fire status timeout | |||||
""" | """ | ||||
return self._fire_timeout | return self._fire_timeout | ||||
@@ -144,7 +162,7 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Sets the timeout for restoring the fire status, in seconds. | Sets the timeout for restoring the fire status, in seconds. | ||||
:param value: The timeout in seconds. | |||||
:param value: timeout in seconds | |||||
:type value: int | :type value: int | ||||
""" | """ | ||||
self._fire_timeout = value | self._fire_timeout = value | ||||
@@ -153,10 +171,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Opens the device. | 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 | :type baudrate: int | ||||
:param no_reader_thread: Specifies whether or not the automatic reader | :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 | :type no_reader_thread: bool | ||||
""" | """ | ||||
self._wire_events() | self._wire_events() | ||||
@@ -176,17 +194,17 @@ class AlarmDecoder(object): | |||||
def send(self, data): | 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: | if self._device: | ||||
self._device.write(data) | self._device.write(data) | ||||
def get_config(self): | 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") | self.send("C\r") | ||||
@@ -227,9 +245,9 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Faults a zone if we are emulating a zone expander. | Faults a zone if we are emulating a zone expander. | ||||
:param zone: The zone to fault. | |||||
:param zone: zone to fault | |||||
:type zone: int | :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 | :type simulate_wire_problem: bool | ||||
""" | """ | ||||
@@ -250,7 +268,7 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Clears a zone if we are emulating a zone expander. | Clears a zone if we are emulating a zone expander. | ||||
:param zone: The zone to clear. | |||||
:param zone: zone to clear | |||||
:type zone: int | :type zone: int | ||||
""" | """ | ||||
self.send("L{0:02}0\r".format(zone)) | self.send("L{0:02}0\r".format(zone)) | ||||
@@ -270,10 +288,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Parses messages from the panel. | 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: | if data is None: | ||||
raise InvalidMessageError() | raise InvalidMessageError() | ||||
@@ -310,10 +328,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Handle RF messages. | 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) | msg = RFMessage(data) | ||||
@@ -325,10 +343,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Handle Long Range Radio messages. | 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) | msg = LRRMessage(data) | ||||
@@ -349,8 +367,8 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Handles received configuration data. | 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('>') | _, config_string = data.split('>') | ||||
for setting in config_string.split('&'): | for setting in config_string.split('&'): | ||||
@@ -377,8 +395,8 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Updates internal device states. | 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): | if isinstance(message, Message): | ||||
self._update_power_status(message) | self._update_power_status(message) | ||||
@@ -397,10 +415,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the AC power state. | 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: | if message.ac_power != self._power_status: | ||||
self._power_status, old_status = 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. | 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: | if message.alarm_sounding != self._alarm_status: | ||||
@@ -432,10 +450,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the zone bypass state. | 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: | if message.zone_bypassed != self._bypass_status: | ||||
@@ -450,10 +468,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the armed state. | 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 | message_status = message.armed_away | message.armed_home | ||||
@@ -472,10 +490,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the battery state. | 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 | last_status, last_update = self._battery_status | ||||
@@ -492,10 +510,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the fire alarm state. | 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 | last_status, last_update = self._fire_status | ||||
@@ -512,10 +530,10 @@ class AlarmDecoder(object): | |||||
""" | """ | ||||
Uses the provided message to update the expander states. | 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: | if message.type == ExpanderMessage.RELAY: | ||||
@@ -527,10 +545,10 @@ class AlarmDecoder(object): | |||||
def _update_zone_tracker(self, message): | 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. | # Retrieve a list of faults. | ||||
@@ -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 <scott@nutech.com> | .. moduleauthor:: Scott Petersen <scott@nutech.com> | ||||
""" | """ | ||||
@@ -20,14 +31,14 @@ from .event import event | |||||
class Device(object): | class Device(object): | ||||
""" | """ | ||||
Generic parent device to all Alarm Decoder (AD2) products. | |||||
Base class for all `Alarm Decoder`_ (AD2) device types. | |||||
""" | """ | ||||
# Generic device events | # 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): | def __init__(self): | ||||
""" | """ | ||||
@@ -58,7 +69,7 @@ class Device(object): | |||||
""" | """ | ||||
Retrieve the device ID. | Retrieve the device ID. | ||||
:returns: The identification string for the device. | |||||
:returns: identification string for the device | |||||
""" | """ | ||||
return self._id | return self._id | ||||
@@ -67,8 +78,8 @@ class Device(object): | |||||
""" | """ | ||||
Sets the device ID. | Sets the device ID. | ||||
:param value: The device identification. | |||||
:type value: str | |||||
:param value: device identification string | |||||
:type value: string | |||||
""" | """ | ||||
self._id = value | self._id = value | ||||
@@ -76,7 +87,7 @@ class Device(object): | |||||
""" | """ | ||||
Indicates whether or not the reader thread is alive. | 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() | return self._read_thread.is_alive() | ||||
@@ -112,8 +123,8 @@ class Device(object): | |||||
""" | """ | ||||
Constructor | 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) | threading.Thread.__init__(self) | ||||
self._device = device | self._device = device | ||||
@@ -146,16 +157,16 @@ class Device(object): | |||||
class USBDevice(Device): | class USBDevice(Device): | ||||
""" | """ | ||||
AD2USB device exposed with PyFTDI's interface. | |||||
`AD2USB`_ device utilizing PyFTDI's interface. | |||||
""" | """ | ||||
# Constants | # Constants | ||||
FTDI_VENDOR_ID = 0x0403 | FTDI_VENDOR_ID = 0x0403 | ||||
"""Vendor ID used to recognize AD2USB devices.""" | |||||
"""Vendor ID used to recognize `AD2USB`_ devices.""" | |||||
FTDI_PRODUCT_ID = 0x6001 | FTDI_PRODUCT_ID = 0x6001 | ||||
"""Product ID used to recognize AD2USB devices.""" | |||||
"""Product ID used to recognize `AD2USB`_ devices.""" | |||||
BAUDRATE = 115200 | BAUDRATE = 115200 | ||||
"""Default baudrate for AD2USB devices.""" | |||||
"""Default baudrate for `AD2USB`_ devices.""" | |||||
__devices = [] | __devices = [] | ||||
__detect_thread = None | __detect_thread = None | ||||
@@ -166,7 +177,7 @@ class USBDevice(Device): | |||||
Returns all FTDI devices matching our vendor and product IDs. | Returns all FTDI devices matching our vendor and product IDs. | ||||
:returns: list of devices | :returns: list of devices | ||||
:raises: CommError | |||||
:raises: :py:class:`alarmdecoder.util.CommError` | |||||
""" | """ | ||||
cls.__devices = [] | cls.__devices = [] | ||||
@@ -181,24 +192,24 @@ class USBDevice(Device): | |||||
@classmethod | @classmethod | ||||
def devices(cls): | 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 | return cls.__devices | ||||
@classmethod | @classmethod | ||||
def find(cls, device=None): | 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. | first device. | ||||
:param device: Tuple describing the USB device to open, as returned | :param device: Tuple describing the USB device to open, as returned | ||||
by find_all(). | by find_all(). | ||||
:type device: tuple | :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() | cls.find_all() | ||||
@@ -217,9 +228,9 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Starts the device detection thread. | 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 | :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 | :type on_detached: function | ||||
""" | """ | ||||
cls.__detect_thread = USBDevice.DetectThread(on_attached, on_detached) | 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. | 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 | return self._interface | ||||
@@ -253,8 +264,8 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Sets the interface used to connect to the 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 | self._interface = value | ||||
if isinstance(value, int): | if isinstance(value, int): | ||||
@@ -267,7 +278,7 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Retrieves the serial number of the 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 | return self._serial_number | ||||
@@ -277,7 +288,7 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Sets the serial number of the 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 | :type value: string | ||||
""" | """ | ||||
self._serial_number = value | self._serial_number = value | ||||
@@ -287,7 +298,7 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Retrieves the description of the device. | Retrieves the description of the device. | ||||
:returns: The description of the device. | |||||
:returns: description of the device | |||||
""" | """ | ||||
return self._description | return self._description | ||||
@@ -296,7 +307,7 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Sets the description of the device. | Sets the description of the device. | ||||
:param value: The description of the device. | |||||
:param value: description of the device | |||||
:type value: string | :type value: string | ||||
""" | """ | ||||
self._description = value | self._description = value | ||||
@@ -307,7 +318,7 @@ class USBDevice(Device): | |||||
:param interface: May specify either the serial number or the device | :param interface: May specify either the serial number or the device | ||||
index. | index. | ||||
:type interface: str or int | |||||
:type interface: string or int | |||||
""" | """ | ||||
Device.__init__(self) | Device.__init__(self) | ||||
@@ -327,13 +338,13 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Opens the device. | Opens the device. | ||||
:param baudrate: The baudrate to use. | |||||
:param baudrate: baudrate to use | |||||
:type baudrate: int | :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. | reader thread. | ||||
:type no_reader_thread: bool | :type no_reader_thread: bool | ||||
:raises: NoDeviceError | |||||
:raises: :py:class:`alarmdecoder.util.NoDeviceError` | |||||
""" | """ | ||||
# Set up defaults | # Set up defaults | ||||
if baudrate is None: | if baudrate is None: | ||||
@@ -384,10 +395,10 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Writes data to the 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: | try: | ||||
self._device.write_data(data) | self._device.write_data(data) | ||||
@@ -401,8 +412,8 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Reads a single character from the 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 | ret = None | ||||
@@ -418,14 +429,14 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Reads a line from the device. | Reads a line from the device. | ||||
:param timeout: The read timeout. | |||||
:param timeout: read timeout | |||||
:type timeout: float | :type timeout: float | ||||
:param purge_buffer: Indicates whether to purge the buffer prior to | :param purge_buffer: Indicates whether to purge the buffer prior to | ||||
reading. | reading. | ||||
:type purge_buffer: bool | :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(): | def timeout_event(): | ||||
@@ -477,7 +488,7 @@ class USBDevice(Device): | |||||
""" | """ | ||||
Retrieves the FTDI device serial number. | 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) | 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. | 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): | def __init__(self, on_attached=None, on_detached=None): | ||||
""" | """ | ||||
Constructor | 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 | :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 | :type on_detached: function | ||||
""" | """ | ||||
threading.Thread.__init__(self) | threading.Thread.__init__(self) | ||||
@@ -541,7 +552,7 @@ class USBDevice(Device): | |||||
class SerialDevice(Device): | class SerialDevice(Device): | ||||
""" | """ | ||||
AD2USB or AD2SERIAL device exposed with the pyserial interface. | |||||
`AD2USB`_, `AD2SERIAL`_ or `AD2PI`_ device utilizing the PySerial interface. | |||||
""" | """ | ||||
# Constants | # Constants | ||||
@@ -553,11 +564,11 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Returns all serial ports present. | 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 | :returns: list of devices | ||||
:raises: CommError | |||||
:raises: :py:class:`alarmdecoder.util.CommError` | |||||
""" | """ | ||||
devices = [] | devices = [] | ||||
@@ -577,7 +588,7 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Retrieves the interface used to connect to the 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 | return self._port | ||||
@@ -586,7 +597,7 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Sets the interface used to connect to the 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 | :type value: string | ||||
""" | """ | ||||
self._port = value | self._port = value | ||||
@@ -595,8 +606,8 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Constructor | Constructor | ||||
:param interface: The device to open. | |||||
:type interface: str | |||||
:param interface: device to open | |||||
:type interface: string | |||||
""" | """ | ||||
Device.__init__(self) | Device.__init__(self) | ||||
@@ -609,13 +620,13 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Opens the device. | Opens the device. | ||||
:param baudrate: The baudrate to use with the device. | |||||
:param baudrate: baudrate to use with the device | |||||
:type baudrate: int | :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. | reader thread. | ||||
:type no_reader_thread: bool | :type no_reader_thread: bool | ||||
:raises: NoDeviceError | |||||
:raises: :py:class:`alarmdecoder.util.NoDeviceError` | |||||
""" | """ | ||||
# Set up the defaults | # Set up the defaults | ||||
if baudrate is None: | if baudrate is None: | ||||
@@ -662,10 +673,10 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Writes data to the 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: | try: | ||||
self._device.write(data) | self._device.write(data) | ||||
@@ -683,8 +694,8 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Reads a single character from the 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 | ret = None | ||||
@@ -700,14 +711,14 @@ class SerialDevice(Device): | |||||
""" | """ | ||||
Reads a line from the device. | Reads a line from the device. | ||||
:param timeout: The read timeout. | |||||
:param timeout: read timeout | |||||
:type timeout: float | :type timeout: float | ||||
:param purge_buffer: Indicates whether to purge the buffer prior to | :param purge_buffer: Indicates whether to purge the buffer prior to | ||||
reading. | reading. | ||||
:type purge_buffer: bool | :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(): | def timeout_event(): | ||||
@@ -759,8 +770,8 @@ class SerialDevice(Device): | |||||
class SocketDevice(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 | @property | ||||
@@ -768,7 +779,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Retrieves the interface used to connect to the 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) | return (self._host, self._port) | ||||
@@ -777,7 +788,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Sets the interface used to connect to the 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 | :type value: tuple | ||||
""" | """ | ||||
self._host, self._port = value | self._host, self._port = value | ||||
@@ -787,7 +798,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Retrieves whether or not the device is using SSL. | 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 | return self._use_ssl | ||||
@@ -796,7 +807,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Sets whether or not SSL communication is in use. | 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 | :type value: bool | ||||
""" | """ | ||||
self._use_ssl = value | self._use_ssl = value | ||||
@@ -806,7 +817,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Retrieves the SSL client certificate path used for authentication. | 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 | return self._ssl_certificate | ||||
@@ -815,8 +826,8 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Sets the SSL client certificate to use for authentication. | 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 | self._ssl_certificate = value | ||||
@@ -825,7 +836,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Retrieves the SSL client certificate key used for authentication. | 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 | return self._ssl_key | ||||
@@ -834,8 +845,8 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Sets the SSL client certificate key to use for authentication. | 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 | self._ssl_key = value | ||||
@@ -845,7 +856,7 @@ class SocketDevice(Device): | |||||
Retrieves the SSL Certificate Authority certificate used for | Retrieves the SSL Certificate Authority certificate used for | ||||
authentication. | authentication. | ||||
:returns: The CA path | |||||
:returns: path to the CA certificate or :py:class:`OpenSSL.crypto.X509` | |||||
""" | """ | ||||
return self._ssl_ca | return self._ssl_ca | ||||
@@ -854,8 +865,8 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Sets the SSL Certificate Authority certificate used for authentication. | 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 | self._ssl_ca = value | ||||
@@ -863,7 +874,7 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Constructor | 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 | :type interface: tuple | ||||
""" | """ | ||||
Device.__init__(self) | Device.__init__(self) | ||||
@@ -878,13 +889,13 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Opens the device. | Opens the device. | ||||
:param baudrate: The baudrate to use | |||||
:param baudrate: baudrate to use | |||||
:type baudrate: int | :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. | thread. | ||||
:type no_reader_thread: bool | :type no_reader_thread: bool | ||||
:raises: NoDeviceError, CommError | |||||
:raises: :py:class:`alarmdecoder.util.NoDeviceError`, :py:class:`alarmdecoder.util.CommError` | |||||
""" | """ | ||||
try: | try: | ||||
@@ -934,11 +945,11 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Writes data to the 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 | data_sent = None | ||||
@@ -959,8 +970,8 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Reads a single character from the 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 | data = None | ||||
@@ -976,14 +987,14 @@ class SocketDevice(Device): | |||||
""" | """ | ||||
Reads a line from the device. | Reads a line from the device. | ||||
:param timeout: The read timeout. | |||||
:param timeout: read timeout | |||||
:type timeout: float | :type timeout: float | ||||
:param purge_buffer: Indicates whether to purge the buffer prior to | :param purge_buffer: Indicates whether to purge the buffer prior to | ||||
reading. | reading. | ||||
:type purge_buffer: bool | :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(): | def timeout_event(): | ||||
@@ -1034,6 +1045,8 @@ class SocketDevice(Device): | |||||
def _init_ssl(self): | def _init_ssl(self): | ||||
""" | """ | ||||
Initializes our device as an SSL connection. | Initializes our device as an SSL connection. | ||||
:raises: :py:class:`alarmdecoder.util.CommError` | |||||
""" | """ | ||||
try: | try: | ||||
@@ -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. | 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 <scott@nutech.com> | .. moduleauthor:: Scott Petersen <scott@nutech.com> | ||||
""" | """ | ||||
@@ -37,56 +44,56 @@ class Message(BaseMessage): | |||||
""" | """ | ||||
ready = False | 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 | armed_away = False | ||||
"""Indicates whether or not the panel is armed away""" | |||||
"""Indicates whether or not the panel is armed away.""" | |||||
armed_home = False | armed_home = False | ||||
"""Indicates whether or not the panel is armed home""" | |||||
"""Indicates whether or not the panel is armed home.""" | |||||
backlight_on = False | backlight_on = False | ||||
"""Indicates whether or not the keypad backlight is on""" | |||||
"""Indicates whether or not the keypad backlight is on.""" | |||||
programming_mode = False | programming_mode = False | ||||
"""Indicates whether or not we're in programming mode""" | |||||
"""Indicates whether or not we're in programming mode.""" | |||||
beeps = -1 | beeps = -1 | ||||
"""Number of beeps associated with a message""" | |||||
"""Number of beeps associated with a message.""" | |||||
zone_bypassed = False | zone_bypassed = False | ||||
"""Indicates whether or not a zone is bypassed""" | |||||
"""Indicates whether or not a zone is bypassed.""" | |||||
ac_power = False | 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 | chime_on = False | ||||
"""Indicates whether or not the chime is enabled""" | |||||
"""Indicates whether or not the chime is enabled.""" | |||||
alarm_event_occurred = False | 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 | alarm_sounding = False | ||||
"""Indicates whether or not an alarm is sounding""" | |||||
"""Indicates whether or not an alarm is sounding.""" | |||||
battery_low = False | 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 | 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 | fire_alarm = False | ||||
"""Indicates whether or not a fire alarm is sounding""" | |||||
"""Indicates whether or not a fire alarm is sounding.""" | |||||
check_zone = False | check_zone = False | ||||
"""Indicates whether or not there are zones that require attention.""" | """Indicates whether or not there are zones that require attention.""" | ||||
perimeter_only = False | perimeter_only = False | ||||
"""Indicates whether or not the perimeter is armed""" | |||||
"""Indicates whether or not the perimeter is armed.""" | |||||
numeric_code = None | numeric_code = None | ||||
"""The numeric code associated with the message""" | |||||
"""The numeric code associated with the message.""" | |||||
text = None | 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 | cursor_location = -1 | ||||
"""Current cursor location on the keypad""" | |||||
"""Current cursor location on the keypad.""" | |||||
mask = None | mask = None | ||||
"""Address mask this message is intended for""" | |||||
"""Address mask this message is intended for.""" | |||||
bitfield = None | bitfield = None | ||||
"""The bitfield associated with this message""" | |||||
"""The bitfield associated with this message.""" | |||||
panel_data = None | panel_data = None | ||||
"""The panel data field associated with this message""" | |||||
"""The panel data field associated with this message.""" | |||||
def __init__(self, data=None): | def __init__(self, data=None): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
:param data: Message data to parse. | |||||
:type data: str | |||||
:param data: message data to parse | |||||
:type data: string | |||||
""" | """ | ||||
BaseMessage.__init__(self) | BaseMessage.__init__(self) | ||||
@@ -105,10 +112,10 @@ class Message(BaseMessage): | |||||
""" | """ | ||||
Parse the message from the device. | 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) | match = self._regex.match(data) | ||||
@@ -168,8 +175,8 @@ class ExpanderMessage(BaseMessage): | |||||
""" | """ | ||||
Constructor | Constructor | ||||
:param data: The message data to parse. | |||||
:type data: str | |||||
:param data: message data to parse | |||||
:type data: string | |||||
""" | """ | ||||
BaseMessage.__init__(self) | BaseMessage.__init__(self) | ||||
@@ -186,8 +193,10 @@ class ExpanderMessage(BaseMessage): | |||||
""" | """ | ||||
Parse the raw message from the device. | 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: | try: | ||||
header, values = data.split(':') | header, values = data.split(':') | ||||
@@ -215,22 +224,22 @@ class RFMessage(BaseMessage): | |||||
""" | """ | ||||
serial_number = None | serial_number = None | ||||
"""Serial number of the RF device""" | |||||
"""Serial number of the RF device.""" | |||||
value = -1 | value = -1 | ||||
"""Value associated with this message""" | |||||
"""Value associated with this message.""" | |||||
battery = False | battery = False | ||||
"""Battery low indication""" | |||||
"""Low battery indication""" | |||||
supervision = False | supervision = False | ||||
"""Supervision required indication""" | """Supervision required indication""" | ||||
loop = [False for x in range(4)] | |||||
loop = [False for _ in range(4)] | |||||
"""Loop indicators""" | """Loop indicators""" | ||||
def __init__(self, data=None): | def __init__(self, data=None): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
:param data: The message data to parse | |||||
:type data: str | |||||
:param data: message data to parse | |||||
:type data: string | |||||
""" | """ | ||||
BaseMessage.__init__(self) | BaseMessage.__init__(self) | ||||
@@ -247,8 +256,10 @@ class RFMessage(BaseMessage): | |||||
""" | """ | ||||
Parses the raw message from the device. | 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: | try: | ||||
self.raw = data | self.raw = data | ||||
@@ -280,16 +291,16 @@ class LRRMessage(BaseMessage): | |||||
event_data = None | event_data = None | ||||
"""Data associated with the LRR message. Usually user ID or zone.""" | """Data associated with the LRR message. Usually user ID or zone.""" | ||||
partition = -1 | partition = -1 | ||||
"""The partition that this message applies to""" | |||||
"""The partition that this message applies to.""" | |||||
event_type = None | event_type = None | ||||
"""The type of the event that occurred""" | |||||
"""The type of the event that occurred.""" | |||||
def __init__(self, data=None): | def __init__(self, data=None): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
:param data: The message data to parse. | |||||
:type data: str | |||||
:param data: message data to parse | |||||
:type data: string | |||||
""" | """ | ||||
BaseMessage.__init__(self) | BaseMessage.__init__(self) | ||||
@@ -306,8 +317,10 @@ class LRRMessage(BaseMessage): | |||||
""" | """ | ||||
Parses the raw message from the device. | 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: | try: | ||||
self.raw = data | self.raw = data | ||||
@@ -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 <scott@nutech.com> | .. moduleauthor:: Scott Petersen <scott@nutech.com> | ||||
""" | """ | ||||
@@ -53,14 +55,14 @@ class Firmware(object): | |||||
@staticmethod | @staticmethod | ||||
def upload(dev, filename, progress_callback=None): | 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 | :type progress_callback: function | ||||
:raises: NoDeviceError, TimeoutError | |||||
:raises: :py:class:`alarmdecoder.util.NoDeviceError`, :py:class:`alarmdecoder.util.TimeoutError` | |||||
""" | """ | ||||
def do_upload(): | def do_upload(): | ||||
@@ -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 <scott@nutech.com> | .. moduleauthor:: Scott Petersen <scott@nutech.com> | ||||
""" | """ | ||||
@@ -16,6 +18,7 @@ class Zone(object): | |||||
Representation of a panel zone. | Representation of a panel zone. | ||||
""" | """ | ||||
# Constants | |||||
CLEAR = 0 | CLEAR = 0 | ||||
"""Status indicating that the zone is cleared.""" | """Status indicating that the zone is cleared.""" | ||||
FAULT = 1 | FAULT = 1 | ||||
@@ -25,15 +28,25 @@ class Zone(object): | |||||
STATUS = {CLEAR: 'CLEAR', FAULT: 'FAULT', CHECK: 'CHECK'} | 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): | def __init__(self, zone=0, name='', status=CLEAR): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
:param zone: The zone number. | |||||
:param zone: zone number | |||||
:type zone: int | :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 | :type status: int | ||||
""" | """ | ||||
self.zone = zone | self.zone = zone | ||||
@@ -56,15 +69,53 @@ class Zone(object): | |||||
class Zonetracker(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 | EXPIRE = 30 | ||||
"""Zone expiration timeout.""" | """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): | def __init__(self): | ||||
""" | """ | ||||
Constructor | Constructor | ||||
@@ -77,8 +128,8 @@ class Zonetracker(object): | |||||
""" | """ | ||||
Update zone statuses based on the current message. | 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 isinstance(message, ExpanderMessage): | ||||
if message.type == ExpanderMessage.ZONE: | if message.type == ExpanderMessage.ZONE: | ||||
@@ -159,12 +210,12 @@ class Zonetracker(object): | |||||
""" | """ | ||||
Convert an address and channel into a zone number. | Convert an address and channel into a zone number. | ||||
:param address: The expander address | |||||
:param address: expander address | |||||
:type address: int | :type address: int | ||||
:param channel: The channel | |||||
:param channel: channel | |||||
:type channel: int | :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 | # 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. | Clear all expired zones from our status list. | ||||
:param zone: current zone being processed. | |||||
:param zone: current zone being processed | |||||
:type zone: int | :type zone: int | ||||
""" | """ | ||||
cleared_zones = [] | cleared_zones = [] | ||||
@@ -251,11 +302,11 @@ class Zonetracker(object): | |||||
""" | """ | ||||
Adds a zone to the internal zone list. | Adds a zone to the internal zone list. | ||||
:param zone: The zone number. | |||||
:param zone: zone number | |||||
:type zone: int | :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 | :type status: int | ||||
""" | """ | ||||
if not zone in self._zones: | if not zone in self._zones: | ||||
@@ -268,9 +319,9 @@ class Zonetracker(object): | |||||
""" | """ | ||||
Updates a zones status. | Updates a zones status. | ||||
:param zone: The zone number. | |||||
:param zone: zone number | |||||
:type zone: int | :type zone: int | ||||
:param status: The zone status. | |||||
:param status: zone status | |||||
:type status: int | :type status: int | ||||
:raises: IndexError | :raises: IndexError | ||||
@@ -293,9 +344,9 @@ class Zonetracker(object): | |||||
""" | """ | ||||
Determine if a zone is expired or not. | Determine if a zone is expired or not. | ||||
:param zone: The zone number. | |||||
:param zone: zone number | |||||
:type zone: int | :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 | return time.time() > self._zones[zone].timestamp + Zonetracker.EXPIRE |
@@ -1,10 +1,10 @@ | |||||
alarmdecoder Package | alarmdecoder Package | ||||
================ | |||||
==================== | |||||
:mod:`alarmdecoder` Module | :mod:`alarmdecoder` Module | ||||
-------------------- | |||||
-------------------------- | |||||
.. automodule:: alarmdecoder.alarmdecoder | |||||
.. automodule:: alarmdecoder.decoder | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
@@ -17,10 +17,10 @@ alarmdecoder Package | |||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`util` Module | |||||
------------------ | |||||
:mod:`messages` Module | |||||
---------------------- | |||||
.. automodule:: alarmdecoder.util | |||||
.. automodule:: alarmdecoder.messages | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
@@ -33,26 +33,27 @@ alarmdecoder Package | |||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`panels` Module | |||||
-------------------- | |||||
:mod:`util` Module | |||||
------------------ | |||||
.. automodule:: alarmdecoder.panels | |||||
.. automodule:: alarmdecoder.util | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`messages` Module | |||||
---------------------- | |||||
:mod:`panels` Module | |||||
-------------------- | |||||
.. automodule:: alarmdecoder.messages | |||||
.. automodule:: alarmdecoder.panels | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
Subpackages | |||||
----------- | |||||
.. | |||||
Subpackages | |||||
----------- | |||||
.. toctree:: | |||||
.. toctree:: | |||||
alarmdecoder.event | |||||
alarmdecoder.event | |||||
@@ -1,4 +1,4 @@ | |||||
# Sphinx build info version 1 | # 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. | # 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 | tags: a205e9ed8462ae86fdd2f73488852ba9 |
@@ -0,0 +1,677 @@ | |||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | |||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | |||||
<html xmlns="http://www.w3.org/1999/xhtml"> | |||||
<head> | |||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |||||
<title>alarmdecoder.decoder — alarmdecoder documentation</title> | |||||
<link rel="stylesheet" href="../../_static/default.css" type="text/css" /> | |||||
<link rel="stylesheet" href="../../_static/pygments.css" type="text/css" /> | |||||
<script type="text/javascript"> | |||||
var DOCUMENTATION_OPTIONS = { | |||||
URL_ROOT: '../../', | |||||
VERSION: '', | |||||
COLLAPSE_INDEX: false, | |||||
FILE_SUFFIX: '.html', | |||||
HAS_SOURCE: true | |||||
}; | |||||
</script> | |||||
<script type="text/javascript" src="../../_static/jquery.js"></script> | |||||
<script type="text/javascript" src="../../_static/underscore.js"></script> | |||||
<script type="text/javascript" src="../../_static/doctools.js"></script> | |||||
<link rel="top" title="alarmdecoder documentation" href="../../index.html" /> | |||||
<link rel="up" title="Module code" href="../index.html" /> | |||||
</head> | |||||
<body> | |||||
<div class="related"> | |||||
<h3>Navigation</h3> | |||||
<ul> | |||||
<li class="right" style="margin-right: 10px"> | |||||
<a href="../../genindex.html" title="General Index" | |||||
accesskey="I">index</a></li> | |||||
<li class="right" > | |||||
<a href="../../py-modindex.html" title="Python Module Index" | |||||
>modules</a> |</li> | |||||
<li><a href="../../index.html">alarmdecoder documentation</a> »</li> | |||||
<li><a href="../index.html" accesskey="U">Module code</a> »</li> | |||||
</ul> | |||||
</div> | |||||
<div class="document"> | |||||
<div class="documentwrapper"> | |||||
<div class="bodywrapper"> | |||||
<div class="body"> | |||||
<h1>Source code for alarmdecoder.decoder</h1><div class="highlight"><pre> | |||||
<span class="sd">"""</span> | |||||
<span class="sd">Provides the full AlarmDecoder class.</span> | |||||
<span class="sd">.. moduleauthor:: Scott Petersen <scott@nutech.com></span> | |||||
<span class="sd">"""</span> | |||||
<span class="kn">import</span> <span class="nn">time</span> | |||||
<span class="kn">from</span> <span class="nn">.event</span> <span class="kn">import</span> <span class="n">event</span> | |||||
<span class="kn">from</span> <span class="nn">.util</span> <span class="kn">import</span> <span class="n">InvalidMessageError</span> | |||||
<span class="kn">from</span> <span class="nn">.messages</span> <span class="kn">import</span> <span class="n">Message</span><span class="p">,</span> <span class="n">ExpanderMessage</span><span class="p">,</span> <span class="n">RFMessage</span><span class="p">,</span> <span class="n">LRRMessage</span> | |||||
<span class="kn">from</span> <span class="nn">.zonetracking</span> <span class="kn">import</span> <span class="n">Zonetracker</span> | |||||
<div class="viewcode-block" id="AlarmDecoder"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder">[docs]</a><span class="k">class</span> <span class="nc">AlarmDecoder</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> High-level wrapper around Alarm Decoder (AD2) devices.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="c"># High-level Events</span> | |||||
<span class="n">on_arm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the panel is armed.'</span><span class="p">)</span> | |||||
<span class="n">on_disarm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the panel is disarmed.'</span><span class="p">)</span> | |||||
<span class="n">on_power_changed</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when panel power switches between AC and DC.'</span><span class="p">)</span> | |||||
<span class="n">on_alarm</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the alarm is triggered.'</span><span class="p">)</span> | |||||
<span class="n">on_fire</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when a fire is detected.'</span><span class="p">)</span> | |||||
<span class="n">on_bypass</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when a zone is bypassed.'</span><span class="p">)</span> | |||||
<span class="n">on_boot</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device finishes bootings.'</span><span class="p">)</span> | |||||
<span class="n">on_config_received</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device receives its configuration.'</span><span class="p">)</span> | |||||
<span class="n">on_zone_fault</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device detects a zone fault.'</span><span class="p">)</span> | |||||
<span class="n">on_zone_restore</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device detects that a fault is restored.'</span><span class="p">)</span> | |||||
<span class="n">on_low_battery</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device detects a low battery.'</span><span class="p">)</span> | |||||
<span class="n">on_panic</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device detects a panic.'</span><span class="p">)</span> | |||||
<span class="n">on_relay_changed</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when a relay is opened or closed on an expander board.'</span><span class="p">)</span> | |||||
<span class="c"># Mid-level Events</span> | |||||
<span class="n">on_message</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when a message has been received from the device.'</span><span class="p">)</span> | |||||
<span class="n">on_lrr_message</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when an LRR message is received.'</span><span class="p">)</span> | |||||
<span class="n">on_rfx_message</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when an RFX message is received.'</span><span class="p">)</span> | |||||
<span class="c"># Low-level Events</span> | |||||
<span class="n">on_open</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device has been opened.'</span><span class="p">)</span> | |||||
<span class="n">on_close</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when the device has been closed.'</span><span class="p">)</span> | |||||
<span class="n">on_read</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when a line has been read from the device.'</span><span class="p">)</span> | |||||
<span class="n">on_write</span> <span class="o">=</span> <span class="n">event</span><span class="o">.</span><span class="n">Event</span><span class="p">(</span><span class="s">'Called when data has been written to the device.'</span><span class="p">)</span> | |||||
<span class="c"># Constants</span> | |||||
<span class="n">KEY_F1</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span> | |||||
<span class="sd">"""Represents panel function key #1"""</span> | |||||
<span class="n">KEY_F2</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">2</span><span class="p">)</span> | |||||
<span class="sd">"""Represents panel function key #2"""</span> | |||||
<span class="n">KEY_F3</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">3</span><span class="p">)</span> | |||||
<span class="sd">"""Represents panel function key #3"""</span> | |||||
<span class="n">KEY_F4</span> <span class="o">=</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="nb">unichr</span><span class="p">(</span><span class="mi">4</span><span class="p">)</span> | |||||
<span class="sd">"""Represents panel function key #4"""</span> | |||||
<span class="n">BATTERY_TIMEOUT</span> <span class="o">=</span> <span class="mi">30</span> | |||||
<span class="sd">"""Timeout before the battery status reverts."""</span> | |||||
<span class="n">FIRE_TIMEOUT</span> <span class="o">=</span> <span class="mi">30</span> | |||||
<span class="sd">"""Timeout before the fire status reverts."""</span> | |||||
<span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">device</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Constructor</span> | |||||
<span class="sd"> :param device: The low-level device used for this Alarm Decoder</span> | |||||
<span class="sd"> interface.</span> | |||||
<span class="sd"> :type device: Device</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="n">device</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span> <span class="o">=</span> <span class="n">Zonetracker</span><span class="p">()</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_timeout</span> <span class="o">=</span> <span class="n">AlarmDecoder</span><span class="o">.</span><span class="n">BATTERY_TIMEOUT</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span> <span class="o">=</span> <span class="n">AlarmDecoder</span><span class="o">.</span><span class="n">FIRE_TIMEOUT</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span> <span class="o">=</span> <span class="p">(</span><span class="bp">False</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span> <span class="o">=</span> <span class="p">(</span><span class="bp">False</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_panic_status</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_relay_status</span> <span class="o">=</span> <span class="p">{}</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="mi">18</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">configbits</span> <span class="o">=</span> <span class="mh">0xFF00</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">address_mask</span> <span class="o">=</span> <span class="mh">0x00000000</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_zone</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">)]</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_relay</span> <span class="o">=</span> <span class="p">[</span><span class="bp">False</span> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">)]</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_lrr</span> <span class="o">=</span> <span class="bp">False</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">deduplicate</span> <span class="o">=</span> <span class="bp">False</span> | |||||
<span class="k">def</span> <span class="nf">__enter__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Support for context manager __enter__.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">return</span> <span class="bp">self</span> | |||||
<span class="k">def</span> <span class="nf">__exit__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">exc_type</span><span class="p">,</span> <span class="n">exc_value</span><span class="p">,</span> <span class="n">traceback</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Support for context manager __exit__.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> | |||||
<span class="k">return</span> <span class="bp">False</span> | |||||
<span class="nd">@property</span> | |||||
<div class="viewcode-block" id="AlarmDecoder.id"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.id">[docs]</a> <span class="k">def</span> <span class="nf">id</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> The ID of the Alarm Decoder device.</span> | |||||
<span class="sd"> :returns: The identification string for the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">id</span> | |||||
</div> | |||||
<span class="nd">@property</span> | |||||
<span class="k">def</span> <span class="nf">battery_timeout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Retrieves the timeout for restoring the battery status, in seconds.</span> | |||||
<span class="sd"> :returns: The battery status timeout</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_battery_timeout</span> | |||||
<span class="nd">@battery_timeout.setter</span> | |||||
<div class="viewcode-block" id="AlarmDecoder.battery_timeout"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.battery_timeout">[docs]</a> <span class="k">def</span> <span class="nf">battery_timeout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Sets the timeout for restoring the battery status, in seconds.</span> | |||||
<span class="sd"> :param value: The timeout in seconds.</span> | |||||
<span class="sd"> :type value: int</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_timeout</span> <span class="o">=</span> <span class="n">value</span> | |||||
</div> | |||||
<span class="nd">@property</span> | |||||
<span class="k">def</span> <span class="nf">fire_timeout</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Retrieves the timeout for restoring the fire status, in seconds.</span> | |||||
<span class="sd"> :returns: The fire status timeout</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span> | |||||
<span class="nd">@fire_timeout.setter</span> | |||||
<div class="viewcode-block" id="AlarmDecoder.fire_timeout"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.fire_timeout">[docs]</a> <span class="k">def</span> <span class="nf">fire_timeout</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Sets the timeout for restoring the fire status, in seconds.</span> | |||||
<span class="sd"> :param value: The timeout in seconds.</span> | |||||
<span class="sd"> :type value: int</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span> <span class="o">=</span> <span class="n">value</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.open"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.open">[docs]</a> <span class="k">def</span> <span class="nf">open</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">baudrate</span><span class="o">=</span><span class="bp">None</span><span class="p">,</span> <span class="n">no_reader_thread</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Opens the device.</span> | |||||
<span class="sd"> :param baudrate: The baudrate used for the device.</span> | |||||
<span class="sd"> :type baudrate: int</span> | |||||
<span class="sd"> :param no_reader_thread: Specifies whether or not the automatic reader</span> | |||||
<span class="sd"> thread should be started or not</span> | |||||
<span class="sd"> :type no_reader_thread: bool</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_wire_events</span><span class="p">()</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="n">baudrate</span><span class="o">=</span><span class="n">baudrate</span><span class="p">,</span> <span class="n">no_reader_thread</span><span class="o">=</span><span class="n">no_reader_thread</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.close"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.close">[docs]</a> <span class="k">def</span> <span class="nf">close</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Closes the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">close</span><span class="p">()</span> | |||||
<span class="k">del</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span> <span class="o">=</span> <span class="bp">None</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.send"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.send">[docs]</a> <span class="k">def</span> <span class="nf">send</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Sends data to the Alarm Decoder device.</span> | |||||
<span class="sd"> :param data: The data to send.</span> | |||||
<span class="sd"> :type data: str</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">write</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.get_config"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.get_config">[docs]</a> <span class="k">def</span> <span class="nf">get_config</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Retrieves the configuration from the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">"C</span><span class="se">\r</span><span class="s">"</span><span class="p">)</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.save_config"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.save_config">[docs]</a> <span class="k">def</span> <span class="nf">save_config</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Sets configuration entries on the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">config_string</span> <span class="o">=</span> <span class="s">''</span> | |||||
<span class="n">config_entries</span> <span class="o">=</span> <span class="p">[]</span> | |||||
<span class="c"># HACK: This is ugly.. but I can't think of an elegant way of doing it.</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'ADDRESS'</span><span class="p">,</span> | |||||
<span class="s">'{0}'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">address</span><span class="p">)))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'CONFIGBITS'</span><span class="p">,</span> | |||||
<span class="s">'{0:x}'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">configbits</span><span class="p">)))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'MASK'</span><span class="p">,</span> | |||||
<span class="s">'{0:x}'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">address_mask</span><span class="p">)))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'EXP'</span><span class="p">,</span> | |||||
<span class="s">''</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s">'Y'</span> <span class="k">if</span> <span class="n">z</span> <span class="k">else</span> <span class="s">'N'</span> <span class="k">for</span> <span class="n">z</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">emulate_zone</span><span class="p">])))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'REL'</span><span class="p">,</span> | |||||
<span class="s">''</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s">'Y'</span> <span class="k">if</span> <span class="n">r</span> <span class="k">else</span> <span class="s">'N'</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">emulate_relay</span><span class="p">])))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'LRR'</span><span class="p">,</span> | |||||
<span class="s">'Y'</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">emulate_lrr</span> <span class="k">else</span> <span class="s">'N'</span><span class="p">))</span> | |||||
<span class="n">config_entries</span><span class="o">.</span><span class="n">append</span><span class="p">((</span><span class="s">'DEDUPLICATE'</span><span class="p">,</span> | |||||
<span class="s">'Y'</span> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">deduplicate</span> <span class="k">else</span> <span class="s">'N'</span><span class="p">))</span> | |||||
<span class="n">config_string</span> <span class="o">=</span> <span class="s">'&'</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="s">'='</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">t</span><span class="p">)</span> <span class="k">for</span> <span class="n">t</span> <span class="ow">in</span> <span class="n">config_entries</span><span class="p">])</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">"C{0}</span><span class="se">\r</span><span class="s">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">config_string</span><span class="p">))</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.reboot"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.reboot">[docs]</a> <span class="k">def</span> <span class="nf">reboot</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Reboots the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">'='</span><span class="p">)</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.fault_zone"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.fault_zone">[docs]</a> <span class="k">def</span> <span class="nf">fault_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">,</span> <span class="n">simulate_wire_problem</span><span class="o">=</span><span class="bp">False</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Faults a zone if we are emulating a zone expander.</span> | |||||
<span class="sd"> :param zone: The zone to fault.</span> | |||||
<span class="sd"> :type zone: int</span> | |||||
<span class="sd"> :param simulate_wire_problem: Whether or not to simulate a wire fault.</span> | |||||
<span class="sd"> :type simulate_wire_problem: bool</span> | |||||
<span class="sd"> """</span> | |||||
<span class="c"># Allow ourselves to also be passed an address/channel combination</span> | |||||
<span class="c"># for zone expanders.</span> | |||||
<span class="c">#</span> | |||||
<span class="c"># Format (expander index, channel)</span> | |||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="nb">tuple</span><span class="p">):</span> | |||||
<span class="n">expander_idx</span><span class="p">,</span> <span class="n">channel</span> <span class="o">=</span> <span class="n">zone</span> | |||||
<span class="n">zone</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span><span class="o">.</span><span class="n">expander_to_zone</span><span class="p">(</span><span class="n">expander_idx</span><span class="p">,</span> <span class="n">channel</span><span class="p">)</span> | |||||
<span class="n">status</span> <span class="o">=</span> <span class="mi">2</span> <span class="k">if</span> <span class="n">simulate_wire_problem</span> <span class="k">else</span> <span class="mi">1</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">"L{0:02}{1}</span><span class="se">\r</span><span class="s">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">zone</span><span class="p">,</span> <span class="n">status</span><span class="p">))</span> | |||||
</div> | |||||
<div class="viewcode-block" id="AlarmDecoder.clear_zone"><a class="viewcode-back" href="../../alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.clear_zone">[docs]</a> <span class="k">def</span> <span class="nf">clear_zone</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">zone</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Clears a zone if we are emulating a zone expander.</span> | |||||
<span class="sd"> :param zone: The zone to clear.</span> | |||||
<span class="sd"> :type zone: int</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">"L{0:02}0</span><span class="se">\r</span><span class="s">"</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">zone</span><span class="p">))</span> | |||||
</div> | |||||
<span class="k">def</span> <span class="nf">_wire_events</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Wires up the internal device events.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">on_open</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_open</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">on_close</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_close</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">on_read</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_read</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_device</span><span class="o">.</span><span class="n">on_write</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_write</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span><span class="o">.</span><span class="n">on_fault</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_zone_fault</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span><span class="o">.</span><span class="n">on_restore</span> <span class="o">+=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_on_zone_restore</span> | |||||
<span class="k">def</span> <span class="nf">_handle_message</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Parses messages from the panel.</span> | |||||
<span class="sd"> :param data: Panel data to parse.</span> | |||||
<span class="sd"> :type data: str</span> | |||||
<span class="sd"> :returns: An object representing the message.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="n">data</span> <span class="ow">is</span> <span class="bp">None</span><span class="p">:</span> | |||||
<span class="k">raise</span> <span class="n">InvalidMessageError</span><span class="p">()</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="bp">None</span> | |||||
<span class="n">header</span> <span class="o">=</span> <span class="n">data</span><span class="p">[</span><span class="mi">0</span><span class="p">:</span><span class="mi">4</span><span class="p">]</span> | |||||
<span class="k">if</span> <span class="n">header</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">!=</span> <span class="s">'!'</span> <span class="ow">or</span> <span class="n">header</span> <span class="o">==</span> <span class="s">'!KPE'</span><span class="p">:</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="n">Message</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">address_mask</span> <span class="o">&</span> <span class="n">msg</span><span class="o">.</span><span class="n">mask</span> <span class="o">></span> <span class="mi">0</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_internal_states</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">header</span> <span class="o">==</span> <span class="s">'!EXP'</span> <span class="ow">or</span> <span class="n">header</span> <span class="o">==</span> <span class="s">'!REL'</span><span class="p">:</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="n">ExpanderMessage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_internal_states</span><span class="p">(</span><span class="n">msg</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">header</span> <span class="o">==</span> <span class="s">'!RFX'</span><span class="p">:</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_rfx</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">header</span> <span class="o">==</span> <span class="s">'!LRR'</span><span class="p">:</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_lrr</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">data</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">'!Ready'</span><span class="p">):</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_boot</span><span class="p">()</span> | |||||
<span class="k">elif</span> <span class="n">data</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="s">'!CONFIG'</span><span class="p">):</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_handle_config</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="n">msg</span> | |||||
<span class="k">def</span> <span class="nf">_handle_rfx</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Handle RF messages.</span> | |||||
<span class="sd"> :param data: RF message to parse.</span> | |||||
<span class="sd"> :type data: str</span> | |||||
<span class="sd"> :returns: An object representing the RF message.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="n">RFMessage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_rfx_message</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="n">msg</span> | |||||
<span class="k">def</span> <span class="nf">_handle_lrr</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Handle Long Range Radio messages.</span> | |||||
<span class="sd"> :param data: LRR message to parse.</span> | |||||
<span class="sd"> :type data: str</span> | |||||
<span class="sd"> :returns: An object representing the LRR message.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="n">LRRMessage</span><span class="p">(</span><span class="n">data</span><span class="p">)</span> | |||||
<span class="k">if</span> <span class="n">msg</span><span class="o">.</span><span class="n">event_type</span> <span class="o">==</span> <span class="s">'ALARM_PANIC'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_panic_status</span> <span class="o">=</span> <span class="bp">True</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_panic</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">True</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">msg</span><span class="o">.</span><span class="n">event_type</span> <span class="o">==</span> <span class="s">'CANCEL'</span><span class="p">:</span> | |||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_panic_status</span> <span class="ow">is</span> <span class="bp">True</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_panic_status</span> <span class="o">=</span> <span class="bp">False</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_panic</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">False</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_lrr_message</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="n">msg</span> | |||||
<span class="k">def</span> <span class="nf">_handle_config</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">data</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Handles received configuration data.</span> | |||||
<span class="sd"> :param data: Configuration string to parse.</span> | |||||
<span class="sd"> :type data: str</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">_</span><span class="p">,</span> <span class="n">config_string</span> <span class="o">=</span> <span class="n">data</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">'>'</span><span class="p">)</span> | |||||
<span class="k">for</span> <span class="n">setting</span> <span class="ow">in</span> <span class="n">config_string</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">'&'</span><span class="p">):</span> | |||||
<span class="n">key</span><span class="p">,</span> <span class="n">val</span> <span class="o">=</span> <span class="n">setting</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s">'='</span><span class="p">)</span> | |||||
<span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'ADDRESS'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">address</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">val</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'CONFIGBITS'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">configbits</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">val</span><span class="p">,</span> <span class="mi">16</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'MASK'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">address_mask</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">val</span><span class="p">,</span> <span class="mi">16</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'EXP'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_zone</span> <span class="o">=</span> <span class="p">[</span><span class="n">val</span><span class="p">[</span><span class="n">z</span><span class="p">]</span> <span class="o">==</span> <span class="s">'Y'</span> <span class="k">for</span> <span class="n">z</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">5</span><span class="p">)]</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'REL'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_relay</span> <span class="o">=</span> <span class="p">[</span><span class="n">val</span><span class="p">[</span><span class="n">r</span><span class="p">]</span> <span class="o">==</span> <span class="s">'Y'</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">4</span><span class="p">)]</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'LRR'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">emulate_lrr</span> <span class="o">=</span> <span class="p">(</span><span class="n">val</span> <span class="o">==</span> <span class="s">'Y'</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="n">key</span> <span class="o">==</span> <span class="s">'DEDUPLICATE'</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">deduplicate</span> <span class="o">=</span> <span class="p">(</span><span class="n">val</span> <span class="o">==</span> <span class="s">'Y'</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_config_received</span><span class="p">()</span> | |||||
<span class="k">def</span> <span class="nf">_update_internal_states</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Updates internal device states.</span> | |||||
<span class="sd"> :param message: Message to update internal states with.</span> | |||||
<span class="sd"> :type message: Message, ExpanderMessage, LRRMessage, or RFMessage</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">Message</span><span class="p">):</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_power_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_alarm_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone_bypass_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_armed_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_battery_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_fire_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="k">elif</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">ExpanderMessage</span><span class="p">):</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_expander_status</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_update_zone_tracker</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_update_power_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the AC power state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">ac_power</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span><span class="p">,</span> <span class="n">old_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">ac_power</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span> | |||||
<span class="k">if</span> <span class="n">old_status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_power_changed</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_power_status</span> | |||||
<span class="k">def</span> <span class="nf">_update_alarm_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the alarm state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">alarm_sounding</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">,</span> <span class="n">old_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">alarm_sounding</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span> | |||||
<span class="k">if</span> <span class="n">old_status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_alarm</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_alarm_status</span> | |||||
<span class="k">def</span> <span class="nf">_update_zone_bypass_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the zone bypass state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">zone_bypassed</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span><span class="p">,</span> <span class="n">old_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">zone_bypassed</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span> | |||||
<span class="k">if</span> <span class="n">old_status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_bypass</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_bypass_status</span> | |||||
<span class="k">def</span> <span class="nf">_update_armed_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the armed state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">message_status</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">armed_away</span> <span class="o">|</span> <span class="n">message</span><span class="o">.</span><span class="n">armed_home</span> | |||||
<span class="k">if</span> <span class="n">message_status</span> <span class="o">!=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span><span class="p">,</span> <span class="n">old_status</span> <span class="o">=</span> <span class="n">message_status</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span> | |||||
<span class="k">if</span> <span class="n">old_status</span> <span class="ow">is</span> <span class="ow">not</span> <span class="bp">None</span><span class="p">:</span> | |||||
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_arm</span><span class="p">()</span> | |||||
<span class="k">else</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_disarm</span><span class="p">()</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_armed_status</span> | |||||
<span class="k">def</span> <span class="nf">_update_battery_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the battery state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">last_status</span><span class="p">,</span> <span class="n">last_update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">battery_low</span> <span class="o">==</span> <span class="n">last_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span> <span class="o">=</span> <span class="p">(</span><span class="n">last_status</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> | |||||
<span class="k">else</span><span class="p">:</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">battery_low</span> <span class="ow">is</span> <span class="bp">True</span> <span class="ow">or</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">></span> <span class="n">last_update</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_battery_timeout</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span> <span class="o">=</span> <span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">battery_low</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_low_battery</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="o">.</span><span class="n">battery_low</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_battery_status</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> | |||||
<span class="k">def</span> <span class="nf">_update_fire_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the fire alarm state.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: Message</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="n">last_status</span><span class="p">,</span> <span class="n">last_update</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">fire_alarm</span> <span class="o">==</span> <span class="n">last_status</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span> <span class="o">=</span> <span class="p">(</span><span class="n">last_status</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> | |||||
<span class="k">else</span><span class="p">:</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">fire_alarm</span> <span class="ow">is</span> <span class="bp">True</span> <span class="ow">or</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">()</span> <span class="o">></span> <span class="n">last_update</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fire_timeout</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span> <span class="o">=</span> <span class="p">(</span><span class="n">message</span><span class="o">.</span><span class="n">fire_alarm</span><span class="p">,</span> <span class="n">time</span><span class="o">.</span><span class="n">time</span><span class="p">())</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_fire</span><span class="p">(</span><span class="n">status</span><span class="o">=</span><span class="n">message</span><span class="o">.</span><span class="n">fire_alarm</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_fire_status</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> | |||||
<span class="k">def</span> <span class="nf">_update_expander_status</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Uses the provided message to update the expander states.</span> | |||||
<span class="sd"> :param message: The message to use to update.</span> | |||||
<span class="sd"> :type message: ExpanderMessage</span> | |||||
<span class="sd"> :returns: Boolean indicating the new status</span> | |||||
<span class="sd"> """</span> | |||||
<span class="k">if</span> <span class="n">message</span><span class="o">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">ExpanderMessage</span><span class="o">.</span><span class="n">RELAY</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_relay_status</span><span class="p">[(</span><span class="n">message</span><span class="o">.</span><span class="n">address</span><span class="p">,</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</span><span class="p">)]</span> <span class="o">=</span> <span class="n">message</span><span class="o">.</span><span class="n">value</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_relay_changed</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_relay_status</span><span class="p">[(</span><span class="n">message</span><span class="o">.</span><span class="n">address</span><span class="p">,</span> <span class="n">message</span><span class="o">.</span><span class="n">channel</span><span class="p">)]</span> | |||||
<span class="k">def</span> <span class="nf">_update_zone_tracker</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Trigger an update of the zonetracker.</span> | |||||
<span class="sd"> :param message: The message to update the zonetracker with.</span> | |||||
<span class="sd"> :type message: Message, ExpanderMessage, LRRMessage, or RFMessage</span> | |||||
<span class="sd"> """</span> | |||||
<span class="c"># Retrieve a list of faults.</span> | |||||
<span class="c"># NOTE: This only happens on first boot or after exiting programming mode.</span> | |||||
<span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">message</span><span class="p">,</span> <span class="n">Message</span><span class="p">):</span> | |||||
<span class="k">if</span> <span class="ow">not</span> <span class="n">message</span><span class="o">.</span><span class="n">ready</span> <span class="ow">and</span> <span class="s">"Hit * for faults"</span> <span class="ow">in</span> <span class="n">message</span><span class="o">.</span><span class="n">text</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">send</span><span class="p">(</span><span class="s">'*'</span><span class="p">)</span> | |||||
<span class="k">return</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">_zonetracker</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">message</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_open</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for opening the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">get_config</span><span class="p">()</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_open</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_close</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for closing the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_close</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_read</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for reading from the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_read</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span> | |||||
<span class="n">msg</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_handle_message</span><span class="p">(</span><span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s">'data'</span><span class="p">,</span> <span class="bp">None</span><span class="p">))</span> | |||||
<span class="k">if</span> <span class="n">msg</span><span class="p">:</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_message</span><span class="p">(</span><span class="n">message</span><span class="o">=</span><span class="n">msg</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_write</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for writing to the device.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_write</span><span class="p">(</span><span class="n">args</span><span class="p">,</span> <span class="n">kwargs</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_zone_fault</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for zone faults.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_zone_fault</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span> | |||||
<span class="k">def</span> <span class="nf">_on_zone_restore</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">sender</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span> | |||||
<span class="sd">"""</span> | |||||
<span class="sd"> Internal handler for zone restoration.</span> | |||||
<span class="sd"> """</span> | |||||
<span class="bp">self</span><span class="o">.</span><span class="n">on_zone_restore</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></div> | |||||
</pre></div> | |||||
</div> | |||||
</div> | |||||
</div> | |||||
<div class="sphinxsidebar"> | |||||
<div class="sphinxsidebarwrapper"> | |||||
<div id="searchbox" style="display: none"> | |||||
<h3>Quick search</h3> | |||||
<form class="search" action="../../search.html" method="get"> | |||||
<input type="text" name="q" /> | |||||
<input type="submit" value="Go" /> | |||||
<input type="hidden" name="check_keywords" value="yes" /> | |||||
<input type="hidden" name="area" value="default" /> | |||||
</form> | |||||
<p class="searchtip" style="font-size: 90%"> | |||||
Enter search terms or a module, class or function name. | |||||
</p> | |||||
</div> | |||||
<script type="text/javascript">$('#searchbox').show(0);</script> | |||||
</div> | |||||
</div> | |||||
<div class="clearer"></div> | |||||
</div> | |||||
<div class="related"> | |||||
<h3>Navigation</h3> | |||||
<ul> | |||||
<li class="right" style="margin-right: 10px"> | |||||
<a href="../../genindex.html" title="General Index" | |||||
>index</a></li> | |||||
<li class="right" > | |||||
<a href="../../py-modindex.html" title="Python Module Index" | |||||
>modules</a> |</li> | |||||
<li><a href="../../index.html">alarmdecoder documentation</a> »</li> | |||||
<li><a href="../index.html" >Module code</a> »</li> | |||||
</ul> | |||||
</div> | |||||
<div class="footer"> | |||||
© Copyright 2013, Nu Tech Software Solutions, Inc.. | |||||
Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.2b1. | |||||
</div> | |||||
</body> | |||||
</html> |
@@ -45,7 +45,8 @@ | |||||
<div class="body"> | <div class="body"> | ||||
<h1>All modules for which code is available</h1> | <h1>All modules for which code is available</h1> | ||||
<ul><li><a href="alarmdecoder/devices.html">alarmdecoder.devices</a></li> | |||||
<ul><li><a href="alarmdecoder/decoder.html">alarmdecoder.decoder</a></li> | |||||
<li><a href="alarmdecoder/devices.html">alarmdecoder.devices</a></li> | |||||
<li><a href="alarmdecoder/event/event.html">alarmdecoder.event.event</a></li> | <li><a href="alarmdecoder/event/event.html">alarmdecoder.event.event</a></li> | ||||
<li><a href="alarmdecoder/messages.html">alarmdecoder.messages</a></li> | <li><a href="alarmdecoder/messages.html">alarmdecoder.messages</a></li> | ||||
<li><a href="alarmdecoder/util.html">alarmdecoder.util</a></li> | <li><a href="alarmdecoder/util.html">alarmdecoder.util</a></li> | ||||
@@ -1,10 +1,10 @@ | |||||
alarmdecoder Package | alarmdecoder Package | ||||
================ | |||||
==================== | |||||
:mod:`alarmdecoder` Module | :mod:`alarmdecoder` Module | ||||
-------------------- | |||||
-------------------------- | |||||
.. automodule:: alarmdecoder.alarmdecoder | |||||
.. automodule:: alarmdecoder.decoder | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
@@ -17,10 +17,10 @@ alarmdecoder Package | |||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`util` Module | |||||
------------------ | |||||
:mod:`messages` Module | |||||
---------------------- | |||||
.. automodule:: alarmdecoder.util | |||||
.. automodule:: alarmdecoder.messages | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
@@ -33,26 +33,27 @@ alarmdecoder Package | |||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`panels` Module | |||||
-------------------- | |||||
:mod:`util` Module | |||||
------------------ | |||||
.. automodule:: alarmdecoder.panels | |||||
.. automodule:: alarmdecoder.util | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
:mod:`messages` Module | |||||
---------------------- | |||||
:mod:`panels` Module | |||||
-------------------- | |||||
.. automodule:: alarmdecoder.messages | |||||
.. automodule:: alarmdecoder.panels | |||||
:members: | :members: | ||||
:undoc-members: | :undoc-members: | ||||
:show-inheritance: | :show-inheritance: | ||||
Subpackages | |||||
----------- | |||||
.. | |||||
Subpackages | |||||
----------- | |||||
.. toctree:: | |||||
.. toctree:: | |||||
alarmdecoder.event | |||||
alarmdecoder.event | |||||
@@ -4,9 +4,18 @@ | |||||
contain the root `toctree` directive. | contain the root `toctree` directive. | ||||
Welcome to alarmdecoder's documentation! | 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 <http://github.com/nutechsoftware/alarmdecoder>`_. | |||||
.. _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:: | .. toctree:: | ||||
:maxdepth: 4 | :maxdepth: 4 | ||||
@@ -55,7 +55,9 @@ | |||||
| <a href="#D"><strong>D</strong></a> | | <a href="#D"><strong>D</strong></a> | ||||
| <a href="#E"><strong>E</strong></a> | | <a href="#E"><strong>E</strong></a> | ||||
| <a href="#F"><strong>F</strong></a> | | <a href="#F"><strong>F</strong></a> | ||||
| <a href="#G"><strong>G</strong></a> | |||||
| <a href="#I"><strong>I</strong></a> | | <a href="#I"><strong>I</strong></a> | ||||
| <a href="#K"><strong>K</strong></a> | |||||
| <a href="#L"><strong>L</strong></a> | | <a href="#L"><strong>L</strong></a> | ||||
| <a href="#M"><strong>M</strong></a> | | <a href="#M"><strong>M</strong></a> | ||||
| <a href="#N"><strong>N</strong></a> | | <a href="#N"><strong>N</strong></a> | ||||
@@ -67,7 +69,6 @@ | |||||
| <a href="#U"><strong>U</strong></a> | | <a href="#U"><strong>U</strong></a> | ||||
| <a href="#V"><strong>V</strong></a> | | <a href="#V"><strong>V</strong></a> | ||||
| <a href="#W"><strong>W</strong></a> | | <a href="#W"><strong>W</strong></a> | ||||
| <a href="#X"><strong>X</strong></a> | |||||
| <a href="#Z"><strong>Z</strong></a> | | <a href="#Z"><strong>Z</strong></a> | ||||
</div> | </div> | ||||
@@ -83,7 +84,17 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.address">address (alarmdecoder.messages.ExpanderMessage attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.address">address (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.address">(alarmdecoder.messages.ExpanderMessage attribute)</a> | |||||
</dt> | |||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.address_mask">address_mask (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
@@ -95,16 +106,24 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#module-alarmdecoder.devices">alarmdecoder.devices (module)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder">AlarmDecoder (class in alarmdecoder.decoder)</a> | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.event.html#module-alarmdecoder.event">alarmdecoder.event (module)</a> | |||||
<dt><a href="alarmdecoder.html#module-alarmdecoder.decoder">alarmdecoder.decoder (module)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#module-alarmdecoder.devices">alarmdecoder.devices (module)</a> | |||||
</dt> | </dt> | ||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.event.html#module-alarmdecoder.event">alarmdecoder.event (module)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.event.html#module-alarmdecoder.event.event">alarmdecoder.event.event (module)</a> | <dt><a href="alarmdecoder.event.html#module-alarmdecoder.event.event">alarmdecoder.event.event (module)</a> | ||||
</dt> | </dt> | ||||
@@ -154,9 +173,17 @@ | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.battery_low">battery_low (alarmdecoder.messages.Message attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.battery_low">battery_low (alarmdecoder.messages.Message attribute)</a> | ||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.BATTERY_TIMEOUT">BATTERY_TIMEOUT (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.battery_timeout">battery_timeout (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.BAUDRATE">BAUDRATE (alarmdecoder.devices.SerialDevice attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.BAUDRATE">BAUDRATE (alarmdecoder.devices.SerialDevice attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -196,18 +223,26 @@ | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.chime_on">chime_on (alarmdecoder.messages.Message attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.chime_on">chime_on (alarmdecoder.messages.Message attribute)</a> | ||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.CLEAR">CLEAR (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
</dt> | |||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.CLEAR">CLEAR (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.clear_zone">clear_zone() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.close">close() (alarmdecoder.devices.Device method)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.close">close() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | </dt> | ||||
<dd><dl> | <dd><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.close">(alarmdecoder.devices.Device method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.close">(alarmdecoder.devices.SerialDevice method)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.close">(alarmdecoder.devices.SerialDevice method)</a> | ||||
</dt> | </dt> | ||||
@@ -225,6 +260,10 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.configbits">configbits (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.cursor_location">cursor_location (alarmdecoder.messages.Message attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.cursor_location">cursor_location (alarmdecoder.messages.Message attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -235,6 +274,10 @@ | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.deduplicate">deduplicate (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.description">description (alarmdecoder.devices.USBDevice attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.description">description (alarmdecoder.devices.USBDevice attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -259,6 +302,18 @@ | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.emulate_lrr">emulate_lrr (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.emulate_relay">emulate_relay (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.emulate_zone">emulate_zone (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.entry_delay_off">entry_delay_off (alarmdecoder.messages.Message attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.Message.entry_delay_off">entry_delay_off (alarmdecoder.messages.Message attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -270,12 +325,12 @@ | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.LRRMessage.event_data">event_data (alarmdecoder.messages.LRRMessage attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.LRRMessage.event_data">event_data (alarmdecoder.messages.LRRMessage attribute)</a> | ||||
</dt> | </dt> | ||||
</dl></td> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.LRRMessage.event_type">event_type (alarmdecoder.messages.LRRMessage attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.LRRMessage.event_type">event_type (alarmdecoder.messages.LRRMessage attribute)</a> | ||||
</dt> | </dt> | ||||
</dl></td> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.event.html#alarmdecoder.event.event.EventHandler">EventHandler (class in alarmdecoder.event.event)</a> | <dt><a href="alarmdecoder.event.html#alarmdecoder.event.event.EventHandler">EventHandler (class in alarmdecoder.event.event)</a> | ||||
</dt> | </dt> | ||||
@@ -303,6 +358,14 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.fault_zone">fault_zone() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.faulted">faulted (alarmdecoder.zonetracking.Zonetracker attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.find">find() (alarmdecoder.devices.USBDevice class method)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.find">find() (alarmdecoder.devices.USBDevice class method)</a> | ||||
</dt> | </dt> | ||||
@@ -327,6 +390,14 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.fire_timeout">fire_timeout (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.FIRE_TIMEOUT">FIRE_TIMEOUT (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware">Firmware (class in alarmdecoder.util)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware">Firmware (class in alarmdecoder.util)</a> | ||||
</dt> | </dt> | ||||
@@ -341,13 +412,29 @@ | |||||
</dl></td> | </dl></td> | ||||
</tr></table> | </tr></table> | ||||
<h2 id="G">G</h2> | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.get_config">get_config() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
</dl></td> | |||||
</tr></table> | |||||
<h2 id="I">I</h2> | <h2 id="I">I</h2> | ||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.id">id (alarmdecoder.devices.Device attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.id">id (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.id">(alarmdecoder.devices.Device attribute)</a> | |||||
</dt> | </dt> | ||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.interface">interface (alarmdecoder.devices.SerialDevice attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.interface">interface (alarmdecoder.devices.SerialDevice attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -375,6 +462,30 @@ | |||||
</dl></td> | </dl></td> | ||||
</tr></table> | </tr></table> | ||||
<h2 id="K">K</h2> | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F1">KEY_F1 (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F2">KEY_F2 (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
</dl></td> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F3">KEY_F3 (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.KEY_F4">KEY_F4 (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
</dl></td> | |||||
</tr></table> | |||||
<h2 id="L">L</h2> | <h2 id="L">L</h2> | ||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
@@ -411,6 +522,10 @@ | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.name">name (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.util.NoDeviceError">NoDeviceError</a> | <dt><a href="alarmdecoder.html#alarmdecoder.util.NoDeviceError">NoDeviceError</a> | ||||
</dt> | </dt> | ||||
@@ -427,11 +542,37 @@ | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_alarm">on_alarm (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_arm">on_arm (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.DetectThread.on_attached">on_attached (alarmdecoder.devices.USBDevice.DetectThread attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.DetectThread.on_attached">on_attached (alarmdecoder.devices.USBDevice.DetectThread attribute)</a> | ||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_close">on_close (alarmdecoder.devices.Device attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_boot">on_boot (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_bypass">on_bypass (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_close">on_close (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_close">(alarmdecoder.devices.Device attribute)</a> | |||||
</dt> | |||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_config_received">on_config_received (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
@@ -439,17 +580,61 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_disarm">on_disarm (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.on_fault">on_fault (alarmdecoder.zonetracking.Zonetracker attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.on_fault">on_fault (alarmdecoder.zonetracking.Zonetracker attribute)</a> | ||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_open">on_open (alarmdecoder.devices.Device attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_fire">on_fire (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_low_battery">on_low_battery (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_lrr_message">on_lrr_message (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_read">on_read (alarmdecoder.devices.Device attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_message">on_message (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_open">on_open (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_open">(alarmdecoder.devices.Device attribute)</a> | |||||
</dt> | |||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_panic">on_panic (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_power_changed">on_power_changed (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_read">on_read (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_read">(alarmdecoder.devices.Device attribute)</a> | |||||
</dt> | |||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_relay_changed">on_relay_changed (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
@@ -457,15 +642,37 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_write">on_write (alarmdecoder.devices.Device attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_rfx_message">on_rfx_message (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.open">open() (alarmdecoder.devices.SerialDevice method)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_write">on_write (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | </dt> | ||||
<dd><dl> | <dd><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.Device.on_write">(alarmdecoder.devices.Device attribute)</a> | |||||
</dt> | |||||
</dl></dd> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_zone_fault">on_zone_fault (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.on_zone_restore">on_zone_restore (alarmdecoder.decoder.AlarmDecoder attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.open">open() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
<dd><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SerialDevice.open">(alarmdecoder.devices.SerialDevice method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.SocketDevice.open">(alarmdecoder.devices.SocketDevice method)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.SocketDevice.open">(alarmdecoder.devices.SocketDevice method)</a> | ||||
</dt> | </dt> | ||||
@@ -547,6 +754,10 @@ | |||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.reboot">reboot() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.RELAY">RELAY (alarmdecoder.messages.ExpanderMessage attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.RELAY">RELAY (alarmdecoder.messages.ExpanderMessage attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -575,6 +786,14 @@ | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.save_config">save_config() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.decoder.AlarmDecoder.send">send() (alarmdecoder.decoder.AlarmDecoder method)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.serial_number">serial_number (alarmdecoder.devices.USBDevice attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.devices.USBDevice.serial_number">serial_number (alarmdecoder.devices.USBDevice attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -616,12 +835,12 @@ | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_DONE">STAGE_DONE (alarmdecoder.util.Firmware attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_DONE">STAGE_DONE (alarmdecoder.util.Firmware attribute)</a> | ||||
</dt> | </dt> | ||||
</dl></td> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_LOAD">STAGE_LOAD (alarmdecoder.util.Firmware attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_LOAD">STAGE_LOAD (alarmdecoder.util.Firmware attribute)</a> | ||||
</dt> | </dt> | ||||
</dl></td> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_START">STAGE_START (alarmdecoder.util.Firmware attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.util.Firmware.STAGE_START">STAGE_START (alarmdecoder.util.Firmware attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -639,6 +858,10 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.status">status (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.STATUS">STATUS (alarmdecoder.zonetracking.Zone attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.STATUS">STATUS (alarmdecoder.zonetracking.Zone attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -681,6 +904,10 @@ | |||||
</dl></td> | </dl></td> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.timestamp">timestamp (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.type">type (alarmdecoder.messages.ExpanderMessage attribute)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.type">type (alarmdecoder.messages.ExpanderMessage attribute)</a> | ||||
</dt> | </dt> | ||||
@@ -747,21 +974,15 @@ | |||||
</dl></td> | </dl></td> | ||||
</tr></table> | </tr></table> | ||||
<h2 id="X">X</h2> | |||||
<h2 id="Z">Z</h2> | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | <table style="width: 100%" class="indextable genindextable"><tr> | ||||
<td style="width: 33%" valign="top"><dl> | <td style="width: 33%" valign="top"><dl> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.RFMessage.x">x (alarmdecoder.messages.RFMessage attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.ZONE">ZONE (alarmdecoder.messages.ExpanderMessage attribute)</a> | |||||
</dt> | </dt> | ||||
</dl></td> | |||||
</tr></table> | |||||
<h2 id="Z">Z</h2> | |||||
<table style="width: 100%" class="indextable genindextable"><tr> | |||||
<td style="width: 33%" valign="top"><dl> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.messages.ExpanderMessage.ZONE">ZONE (alarmdecoder.messages.ExpanderMessage attribute)</a> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zone.zone">zone (alarmdecoder.zonetracking.Zone attribute)</a> | |||||
</dt> | </dt> | ||||
@@ -775,6 +996,10 @@ | |||||
</dt> | </dt> | ||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker.zones">zones (alarmdecoder.zonetracking.Zonetracker attribute)</a> | |||||
</dt> | |||||
<dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker">Zonetracker (class in alarmdecoder.zonetracking)</a> | <dt><a href="alarmdecoder.html#alarmdecoder.zonetracking.Zonetracker">Zonetracker (class in alarmdecoder.zonetracking)</a> | ||||
</dt> | </dt> | ||||
@@ -50,24 +50,18 @@ | |||||
<div class="section" id="welcome-to-alarmdecoder-s-documentation"> | <div class="section" id="welcome-to-alarmdecoder-s-documentation"> | ||||
<h1>Welcome to alarmdecoder’s documentation!<a class="headerlink" href="#welcome-to-alarmdecoder-s-documentation" title="Permalink to this headline">¶</a></h1> | <h1>Welcome to alarmdecoder’s documentation!<a class="headerlink" href="#welcome-to-alarmdecoder-s-documentation" title="Permalink to this headline">¶</a></h1> | ||||
<p>Contents:</p> | |||||
<p>This is the API documentation for the <a class="reference external" href="http://www.alarmdecoder.com">Alarm Decoder</a> Python library. It provides support for interacting with the <a class="reference external" href="http://www.alarmdecoder.com">Alarm Decoder</a> (AD2) family of security alarm devices, including the <a class="reference external" href="http://www.alarmdecoder.com">AD2USB</a>, <a class="reference external" href="http://www.alarmdecoder.com">AD2SERIAL</a> and <a class="reference external" href="http://www.alarmdecoder.com">AD2PI</a>.</p> | |||||
<p>The source code, requirements and examples for this project may be found <a class="reference external" href="http://github.com/nutechsoftware/alarmdecoder">here</a>.</p> | |||||
<p>Table of Contents:</p> | |||||
<div class="toctree-wrapper compound"> | <div class="toctree-wrapper compound"> | ||||
<ul> | <ul> | ||||
<li class="toctree-l1"><a class="reference internal" href="alarmdecoder.html">alarmdecoder Package</a><ul> | <li class="toctree-l1"><a class="reference internal" href="alarmdecoder.html">alarmdecoder Package</a><ul> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#alarmdecoder-module"><tt class="docutils literal"><span class="pre">alarmdecoder</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.decoder"><tt class="docutils literal"><span class="pre">alarmdecoder</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.devices"><tt class="docutils literal"><span class="pre">devices</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.devices"><tt class="docutils literal"><span class="pre">devices</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.util"><tt class="docutils literal"><span class="pre">util</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.messages"><tt class="docutils literal"><span class="pre">messages</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.zonetracking"><tt class="docutils literal"><span class="pre">zonetracking</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.zonetracking"><tt class="docutils literal"><span class="pre">zonetracking</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.util"><tt class="docutils literal"><span class="pre">util</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.panels"><tt class="docutils literal"><span class="pre">panels</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.panels"><tt class="docutils literal"><span class="pre">panels</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.messages"><tt class="docutils literal"><span class="pre">messages</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#subpackages">Subpackages</a><ul> | |||||
<li class="toctree-l3"><a class="reference internal" href="alarmdecoder.event.html">event Package</a><ul> | |||||
<li class="toctree-l4"><a class="reference internal" href="alarmdecoder.event.html#id1"><tt class="docutils literal"><span class="pre">event</span></tt> Package</a></li> | |||||
<li class="toctree-l4"><a class="reference internal" href="alarmdecoder.event.html#module-alarmdecoder.event.event"><tt class="docutils literal"><span class="pre">event</span></tt> Module</a></li> | |||||
</ul> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
</ul> | </ul> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
@@ -49,20 +49,12 @@ | |||||
<div class="toctree-wrapper compound"> | <div class="toctree-wrapper compound"> | ||||
<ul> | <ul> | ||||
<li class="toctree-l1"><a class="reference internal" href="alarmdecoder.html">alarmdecoder Package</a><ul> | <li class="toctree-l1"><a class="reference internal" href="alarmdecoder.html">alarmdecoder Package</a><ul> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#alarmdecoder-module"><tt class="docutils literal"><span class="pre">alarmdecoder</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.decoder"><tt class="docutils literal"><span class="pre">alarmdecoder</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.devices"><tt class="docutils literal"><span class="pre">devices</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.devices"><tt class="docutils literal"><span class="pre">devices</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.util"><tt class="docutils literal"><span class="pre">util</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.messages"><tt class="docutils literal"><span class="pre">messages</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.zonetracking"><tt class="docutils literal"><span class="pre">zonetracking</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.zonetracking"><tt class="docutils literal"><span class="pre">zonetracking</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.util"><tt class="docutils literal"><span class="pre">util</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.panels"><tt class="docutils literal"><span class="pre">panels</span></tt> Module</a></li> | <li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.panels"><tt class="docutils literal"><span class="pre">panels</span></tt> Module</a></li> | ||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#module-alarmdecoder.messages"><tt class="docutils literal"><span class="pre">messages</span></tt> Module</a></li> | |||||
<li class="toctree-l2"><a class="reference internal" href="alarmdecoder.html#subpackages">Subpackages</a><ul> | |||||
<li class="toctree-l3"><a class="reference internal" href="alarmdecoder.event.html">event Package</a><ul> | |||||
<li class="toctree-l4"><a class="reference internal" href="alarmdecoder.event.html#id1"><tt class="docutils literal"><span class="pre">event</span></tt> Package</a></li> | |||||
<li class="toctree-l4"><a class="reference internal" href="alarmdecoder.event.html#module-alarmdecoder.event.event"><tt class="docutils literal"><span class="pre">event</span></tt> Module</a></li> | |||||
</ul> | |||||
</li> | |||||
</ul> | |||||
</li> | |||||
</ul> | </ul> | ||||
</li> | </li> | ||||
</ul> | </ul> | ||||
@@ -64,6 +64,11 @@ | |||||
<td> | <td> | ||||
<tt class="xref">alarmdecoder</tt></td><td> | <tt class="xref">alarmdecoder</tt></td><td> | ||||
<em></em></td></tr> | <em></em></td></tr> | ||||
<tr class="cg-1"> | |||||
<td></td> | |||||
<td> | |||||
<a href="alarmdecoder.html#module-alarmdecoder.decoder"><tt class="xref">alarmdecoder.decoder</tt></a></td><td> | |||||
<em></em></td></tr> | |||||
<tr class="cg-1"> | <tr class="cg-1"> | ||||
<td></td> | <td></td> | ||||
<td> | <td> | ||||
@@ -123,7 +123,7 @@ html_theme = 'default' | |||||
# Add any paths that contain custom static files (such as style sheets) here, | # 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, | # relative to this directory. They are copied after the builtin static files, | ||||
# so a file named "default.css" will overwrite the builtin "default.css". | # 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, | # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, | ||||
# using the given strftime format. | # using the given strftime format. | ||||
@@ -4,9 +4,18 @@ | |||||
contain the root `toctree` directive. | contain the root `toctree` directive. | ||||
Welcome to alarmdecoder's documentation! | 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 <http://github.com/nutechsoftware/alarmdecoder>`_. | |||||
.. _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:: | .. toctree:: | ||||
:maxdepth: 4 | :maxdepth: 4 | ||||