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.')
on_arm = event.Event("This event is called when the panel is armed.\n\n**Callback definition:** *def callback(device)*")
on_disarm = event.Event("This event is called when the panel is disarmed.\n\n**Callback definition:** *def callback(device)*")
on_power_changed = event.Event("This event is called when panel power switches between AC and DC.\n\n**Callback definition:** *def callback(device, status)*")
on_alarm = event.Event("This event is called when the alarm is triggered.\n\n**Callback definition:** *def callback(device, status)*")
on_fire = event.Event("This event is called when a fire is detected.\n\n**Callback definition:** *def callback(device, status)*")
on_bypass = event.Event("This event is called when a zone is bypassed. \n\n\n\n**Callback definition:** *def callback(device, status)*")
on_boot = event.Event("This event is called when the device finishes booting.\n\n**Callback definition:** *def callback(device)*")
on_config_received = event.Event("This event is called when the device receives its configuration. \n\n**Callback definition:** *def callback(device)*")
on_zone_fault = event.Event("This event is called when :py:class:`~alarmdecoder.zonetracking.Zonetracker` detects a zone fault.\n\n**Callback definition:** *def callback(device, zone)*")
on_zone_restore = event.Event("This event is called when :py:class:`~alarmdecoder.zonetracking.Zonetracker` detects that a fault is restored.\n\n**Callback definition:** *def callback(device, zone)*")
on_low_battery = event.Event("This event is called when the device detects a low battery.\n\n**Callback definition:** *def callback(device, status)*")
on_panic = event.Event("This event is called when the device detects a panic.\n\n**Callback definition:** *def callback(device, status)*")
on_relay_changed = event.Event("This event is called when a relay is opened or closed on an expander board.\n\n**Callback definition:** *def callback(device, message)*")
# Mid-level Events
# Mid-level Events
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.')
on_message = event.Event("This event is called when any message is received.\n\n**Callback definition:** *def callback(device, message)*")
on_lrr_message = event.Event("This event is called when an :py:class:`~alarmdecoder.messages.LRRMessage` is received.\n\n**Callback definition:** *def callback(device, message)*")
on_rfx_message = event.Event("This event is called when an :py:class:`~alarmdecoder.messages.RFMessage` is received.\n\n**Callback definition:** *def callback(device, message)*")
# Low-level Events
# Low-level Events
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.')
on_open = event.Event("This event is called when the device has been opened.\n\n**Callback definition:** *def callback(device)*")
on_close = event.Event("This event is called when the device has been closed.\n\n**Callback definition:** *def callback(device)*")
on_read = event.Event("This event is called when a line has been read from the device.\n\n**Callback definition:** *def callback(device, data)*")
on_write = event.Event("This event is called when data has been written to the device.\n\n**Callback definition:** *def callback(device, data)*")
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.')
on_fault = event.Event("This event is called when the device detects a zone fault.\n\n**Callback definition:** *def callback(device, zone)*")
on_restore = event.Event("This event is called when the device detects that a fault is restored.\n\n**Callback definition:** *def callback(device, zone)*")
EXPIRE = 30
EXPIRE = 30
"""Zone expiration timeout."""
"""Zone expiration timeout."""
@@ -129,7 +129,7 @@ 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
:param message: message to use to update the zone tracking
:type message: :py:class:`alarmdecoder.messages.Message` or :py:class:`alarmdecoder.messages.ExpanderMessage`
:type message: :py:class:`~alarmdecoder.messages.Message` or :py:class:`~alarmdecoder.messages.ExpanderMessage`
You can adapt this file completely to your liking, but it should at least
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
contain the root `toctree` directive.
Welcome to alarmdecoder's documentation!
Welcome to Alarm Decoder's documentation!
========================================
========================================
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>`_.
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>`_.
Please see the `examples`_ directory for more samples, but a basic one is included below::
import time
from alarmdecoder import AlarmDecoder
from alarmdecoder.devices import USBDevice
def main():
"""
Example application that prints messages from the panel to the terminal.
<tt class="descname">on_arm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_arm" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_arm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_arm" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the panel is armed.</p>
<dd><p>This event is called when the panel is armed.</p>
<tt class="descname">on_disarm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_disarm" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_disarm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_disarm" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the panel is disarmed.</p>
<dd><p>This event is called when the panel is disarmed.</p>
<tt class="descname">on_power_changed</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_power_changed" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_power_changed</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_power_changed" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when panel power switches between AC and DC.</p>
<dd><p>This event is called when panel power switches between AC and DC.</p>
<tt class="descname">on_alarm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_alarm" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_alarm</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_alarm" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the alarm is triggered.</p>
<dd><p>This event is called when the alarm is triggered.</p>
<tt class="descname">on_fire</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_fire" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_fire</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_fire" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when a fire is detected.</p>
<dd><p>This event is called when a fire is detected.</p>
<tt class="descname">on_bypass</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_bypass" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_bypass</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_bypass" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when a zone is bypassed.</p>
<dd><p>This event is called when a zone is bypassed.</p>
<tt class="descname">on_boot</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_boot" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_boot</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_boot" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device finishes booting.</p>
<dd><p>This event is called when the device finishes booting.</p>
<tt class="descname">on_config_received</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_config_received" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_config_received</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_config_received" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device receives its configuration.</p>
<dd><p>This event is called when the device receives its configuration.</p>
<tt class="descname">on_zone_fault</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_zone_fault" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_zone_fault</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_zone_fault" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when <a class="reference internal" href="#alarmdecoder.zonetracking.Zonetracker" title="alarmdecoder.zonetracking.Zonetracker"><tt class="xref py py-class docutils literal"><span class="pre">alarmdecoder.zonetracking.Zonetracker</span></tt></a> detects a zone fault.</p>
<dd><p>This event is called when <a class="reference internal" href="#alarmdecoder.zonetracking.Zonetracker" title="alarmdecoder.zonetracking.Zonetracker"><tt class="xref py py-class docutils literal"><span class="pre">Zonetracker</span></tt></a> detects a zone fault.</p>
<tt class="descname">on_zone_restore</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_zone_restore" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_zone_restore</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_zone_restore" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when <a class="reference internal" href="#alarmdecoder.zonetracking.Zonetracker" title="alarmdecoder.zonetracking.Zonetracker"><tt class="xref py py-class docutils literal"><span class="pre">alarmdecoder.zonetracking.Zonetracker</span></tt></a> detects that a fault is restored.</p>
<dd><p>This event is called when <a class="reference internal" href="#alarmdecoder.zonetracking.Zonetracker" title="alarmdecoder.zonetracking.Zonetracker"><tt class="xref py py-class docutils literal"><span class="pre">Zonetracker</span></tt></a> detects that a fault is restored.</p>
<tt class="descname">on_low_battery</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_low_battery" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_low_battery</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_low_battery" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device detects a low battery.</p>
<dd><p>This event is called when the device detects a low battery.</p>
<tt class="descname">on_panic</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_panic" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_panic</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_panic" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device detects a panic.</p>
<dd><p>This event is called when the device detects a panic.</p>
<tt class="descname">on_relay_changed</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_relay_changed" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_relay_changed</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_relay_changed" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when a relay is opened or closed on an expander board.</p>
<dd><p>This event is called when a relay is opened or closed on an expander board.</p>
<tt class="descname">on_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_message" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_message" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when any message is received.</p>
<dd><p>This event is called when any message is received.</p>
<tt class="descname">on_lrr_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_lrr_message" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_lrr_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_lrr_message" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when an <a class="reference internal" href="#alarmdecoder.messages.LRRMessage" title="alarmdecoder.messages.LRRMessage"><tt class="xref py py-class docutils literal"><span class="pre">alarmdecoder.messages.LRRMessage</span></tt></a> is received.</p>
<dd><p>This event is called when an <a class="reference internal" href="#alarmdecoder.messages.LRRMessage" title="alarmdecoder.messages.LRRMessage"><tt class="xref py py-class docutils literal"><span class="pre">LRRMessage</span></tt></a> is received.</p>
<tt class="descname">on_rfx_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_rfx_message" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_rfx_message</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_rfx_message" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when an <a class="reference internal" href="#alarmdecoder.messages.RFMessage" title="alarmdecoder.messages.RFMessage"><tt class="xref py py-class docutils literal"><span class="pre">alarmdecoder.messages.RFMessage</span></tt></a> is received.</p>
<dd><p>This event is called when an <a class="reference internal" href="#alarmdecoder.messages.RFMessage" title="alarmdecoder.messages.RFMessage"><tt class="xref py py-class docutils literal"><span class="pre">RFMessage</span></tt></a> is received.</p>
<tt class="descname">on_open</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_open" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_open</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_open" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device has been opened.</p>
<dd><p>This event is called when the device has been opened.</p>
<tt class="descname">on_close</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_close" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_close</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_close" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device has been closed.</p>
<dd><p>This event is called when the device has been closed.</p>
<tt class="descname">on_read</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_read" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_read</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_read" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when a line has been read from the device.</p>
<dd><p>This event is called when a line has been read from the device.</p>
<tt class="descname">on_write</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_write" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_write</tt><a class="headerlink" href="#alarmdecoder.decoder.AlarmDecoder.on_write" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when data has been written to the device.</p>
<dd><p>This event is called when data has been written to the device.</p>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>on_attached</strong> (<em>function</em>) – function to be called when a device is attached</li>
<li><strong>on_detached</strong> (<em>function</em>) – function to be called when a device is detached</li>
<li><strong>on_attached</strong> (<em>function</em>) – function to be called when a device is attached <strong>Callback definition:</strong> <em>def callback(thread, device)</em></li>
<li><strong>on_detached</strong> (<em>function</em>) – function to be called when a device is detached <strong>Callback definition:</strong> <em>def callback(thread, device)</em></li>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) – data to write</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) – data to write</td>
<tt class="descname">on_attached</tt><a class="headerlink" href="#alarmdecoder.devices.USBDevice.DetectThread.on_attached" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_attached</tt><a class="headerlink" href="#alarmdecoder.devices.USBDevice.DetectThread.on_attached" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when an <a class="reference external" href="http://www.alarmdecoder.com">AD2USB</a> device has been detected.</p>
<dd><p>This event is called when an <a class="reference external" href="http://www.alarmdecoder.com">AD2USB</a> device has been detected.</p>
<tt class="descname">on_detached</tt><a class="headerlink" href="#alarmdecoder.devices.USBDevice.DetectThread.on_detached" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_detached</tt><a class="headerlink" href="#alarmdecoder.devices.USBDevice.DetectThread.on_detached" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when an <a class="reference external" href="http://www.alarmdecoder.com">AD2USB</a> device has been removed.</p>
<dd><p>This event is called when an <a class="reference external" href="http://www.alarmdecoder.com">AD2USB</a> device has been removed.</p>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) – data to write</td>
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> (<em>string</em>) – data to write</td>
<tt class="descname">on_fault</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.on_fault" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_fault</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.on_fault" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device detects a zone fault.</p>
<dd><p>This event is called when the device detects a zone fault.</p>
<tt class="descname">on_restore</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.on_restore" title="Permalink to this definition">¶</a></dt>
<tt class="descname">on_restore</tt><a class="headerlink" href="#alarmdecoder.zonetracking.Zonetracker.on_restore" title="Permalink to this definition">¶</a></dt>
<dd><p>This event is called when the device detects that a fault is restored.</p>
<dd><p>This event is called when the device detects that a fault is restored.</p>
<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 Alarm Decoder’s documentation!<a class="headerlink" href="#welcome-to-alarm-decoder-s-documentation" title="Permalink to this headline">¶</a></h1>
<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>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>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>Please see the <a class="reference external" href="http://github.com/nutechsoftware/alarmdecoder/tree/master/examples">examples</a> directory for more samples, but a basic one is included below:</p>
You can adapt this file completely to your liking, but it should at least
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
contain the root `toctree` directive.
Welcome to alarmdecoder's documentation!
Welcome to Alarm Decoder's documentation!
========================================
========================================
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>`_.
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>`_.
Please see the `examples`_ directory for more samples, but a basic one is included below::
import time
from alarmdecoder import AlarmDecoder
from alarmdecoder.devices import USBDevice
def main():
"""
Example application that prints messages from the panel to the terminal.