I have been working on getting a python script working with my new AD2USB. I am able to extract and parse RFX messages using the python module, however I am not able to get any zone tracking events or events such as on_arm or on_disarm.
Here is the script I am using to test with, it outputs nothing at all to the referenced log file.
- Code: Select all
import time, logging
from alarmdecoder import AlarmDecoder
from alarmdecoder.devices import USBDevice
# Global Variables
LOG_FILE = 'alarm_state.log'
def main():
try:
# Setup and begin logging
logging.basicConfig(filename=LOG_FILE, level=logging.INFO, format='%(asctime)s %(message)s', datefmt='%m/%d/%Y %H:%M:%S')
logging.info('---------- Starting log ----------')
# Retrieve the first USB device
device = AlarmDecoder(USBDevice.find())
# Set up an event handler and open the device
device.on_zone_fault += handle_zone_fault
device.on_zone_restore += handle_zone_restore
device.on_arm += handle_arm
device.on_disarm += handle_disarm
with device.open():
while True:
time.sleep(1)
except Exception, ex:
logging.error('Exception:'+str(ex))
def handle_zone_fault(sender, zone):
logging.info('Zone Fault:'+str(zone))
def handle_zone_restore(sender, zone):
logging.info('Zone Restored:'+str(zone))
def handle_arm(sender):
logging.info('System Armed')
def handle_disarm(sender):
logging.info('System Disarmed')
if __name__ == '__main__':
main()
Here is the output from the AD2USB device directly, while faulting a zone and restoring it. Curiously, I get a series of keypad messages, one stating everything is in the ready state and another telling me the zone is faulted, both while the zone is in the faulted state.
- Code: Select all
!Ademco Keypad Emulator V2.2a.6
!Copyright (C) 2008-2010 Nu Tech Software Solutions, Inc.
!Reproduction without permission is prohibited
!By Sean Mathews <drwho at f34r.com>
!For support email general@support.nutech.com
!www.NuTech.com
!Reading configuration.
!UART init.
!Ready. Press ! for configuration.
[1000000110000000----],008,[f70000031008001c28020000000000]," DISARMED CHIME Ready to Arm "
[1000000110000000----],008,[f70000040008001c28020000000000]," DISARMED CHIME Ready to Arm "
!RFX:0206723,80
[0000030110000000----],010,[f70000011010030028020000000000],"FAULT 10 BACK DOOR "
[0000000110000000----],010,[f70000020010000028020000000000],"FAULT 10 BACK DOOR "
[0000000110000000----],008,[f70000031008000c28020000000000]," DISARMED CHIME Hit * for faults"
[1000000110000000----],008,[f70000040008001c28020000000000]," DISARMED CHIME Ready to Arm "
[0000000110000000----],008,[f70000031008000c28020000000000]," DISARMED CHIME Hit * for faults"
[1000000110000000----],008,[f70000040008001c28020000000000]," DISARMED CHIME Ready to Arm "
[0000000110000000----],008,[f70000031008000c28020000000000]," DISARMED CHIME Hit * for faults"
[1000000110000000----],008,[f70000040008001c28020000000000]," DISARMED CHIME Ready to Arm "
[0000000110000000----],008,[f70000031008000c28020000000000]," DISARMED CHIME Hit * for faults"
[1000000110000000----],008,[f70000040008001c28020000000000]," DISARMED CHIME Ready to Arm "
The AD2USB is has the default configuration and I am using a Vista 20P. Can someone provide guidance on where I may be going wrong?
Robert