API examples

General Discussion

API examples

Postby lucavista » Mon Oct 05, 2015 4:05 am

Hi,
I'm looking at the python api but the examples available are very basic.
Is anywhere some example including sending messages (keypad numbers) and handling incoming messages?
lucavista
newt
newt
 
Posts: 15
Joined: Tue Apr 21, 2015 8:40 am

Re: API examples

Postby kevin » Mon Oct 05, 2015 9:54 am

https://github.com/nutechsoftware/alarm ... ialport.py is an example of handling a message

To send a message, you just call "device.send(string)" and if you want to verify the message actually sent to the panel you can use the "on_sending_received" event

Code: Select all
#fake disarm
device.on_sending_received += handle_send
device.send(12341)


def handle_send(device, status, message):
    print "Successful alarm panel send"




Here is the API documentation: http://alarmdecoder.readthedocs.org/en/ ... rmdecoder/

You will see that a message has these properties:
Code: Select all

raw = None

    The raw message text

timestamp = None

    The timestamp of the message


ready = False

    Indicates whether or not the panel is in a ready state.

armed_away = False

    Indicates whether or not the panel is armed away.

armed_home = False

    Indicates whether or not the panel is armed home.

backlight_on = False

    Indicates whether or not the keypad backlight is on.

programming_mode = False

    Indicates whether or not we’re in programming mode.

beeps = -1

    Number of beeps associated with a message.

zone_bypassed = False

    Indicates whether or not a zone is bypassed.

ac_power = False

    Indicates whether or not the panel is on AC power.

chime_on = False

    Indicates whether or not the chime is enabled.

alarm_event_occurred = False

    Indicates whether or not an alarm event has occurred.

alarm_sounding = False

    Indicates whether or not an alarm is sounding.

battery_low = False

    Indicates whether or not there is a low battery.

entry_delay_off = False

    Indicates whether or not the entry delay is enabled.

fire_alarm = False

    Indicates whether or not a fire alarm is sounding.

check_zone = False

    Indicates whether or not there are zones that require attention.

perimeter_only = False

    Indicates whether or not the perimeter is armed.

system_fault = False

    Indicates whether a system fault has occurred.

panel_type = 0

    Indicates which panel type was the source of this message.

numeric_code = None

    The numeric code associated with the message.

text = None

    The human-readable text to be displayed on the panel LCD.

cursor_location = -1

    Current cursor location on the keypad.

mask = 4294967295

    Address mask this message is intended for.

bitfield = None

    The bitfield associated with this message.

panel_data = None

    The panel data field associated with this message.



So you could access message.armed_away to see if your alarm is in an armed_away state in your handle_message routine
Not an employee of the company. Just here to help and keep things clean.
kevin
Platinum Nut
Platinum Nut
 
Posts: 994
Joined: Fri Aug 16, 2013 10:10 am

Re: API examples

Postby lucavista » Tue Oct 06, 2015 10:00 am

Thanks for the answer! I'm coding now :)
lucavista
newt
newt
 
Posts: 15
Joined: Tue Apr 21, 2015 8:40 am


Return to General

Who is online

Users browsing this forum: No registered users and 5 guests

cron