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.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
712 B

  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 as 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()