A clone of: https://github.com/nutechsoftware/alarmdecoder This is requires as they dropped support for older firmware releases w/o building in backward compatibility code, and they had previously hardcoded pyserial to a python2 only version.

basics.py 708 B

11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
1234567891011121314151617181920212223242526272829
  1. import time
  2. from alarmdecoder import AlarmDecoder
  3. from alarmdecoder.devices import USBDevice
  4. def main():
  5. """
  6. Example application that prints messages from the panel to the terminal.
  7. """
  8. try:
  9. # Retrieve the first USB device
  10. device = AlarmDecoder(USBDevice.find())
  11. # Set up an event handler and open the device
  12. device.on_message += handle_message
  13. with device.open():
  14. while True:
  15. time.sleep(1)
  16. except Exception, ex:
  17. print 'Exception:', ex
  18. def handle_message(sender, message):
  19. """
  20. Handles message events from the AlarmDecoder.
  21. """
  22. print sender, message.raw
  23. if __name__ == '__main__':
  24. main()