Skip to content
This repository has been archived by the owner on May 14, 2019. It is now read-only.

ideAlarm API

Richard Roe edited this page Mar 9, 2018 · 3 revisions

About the API

For basic usage you can interact with ideAlarm (e.g. arming and disarming) using the openHAB GUI or by scripts using the openHAB items that you have created for each alarm zone. You can also make scripts trigger on the change of of the openHAB items that you've created for each zone.

ideAlarm aims to make it easier for you to develop scripts by exposing definitions from a the ideAlarm module. Those definitions can be imported into your ordinary jython scripts allowing you to interact with ideAlarm using the functions described on this page.

Preparations

Before you can use the ideAlarm definitions in your scripts, you need to import the ideAlarm module by inserting a single line of code like in the following example.

from idealarm import ideAlarm, ARMINGMODE, ZONESTATUS

Just insert the code at the beginning of your jython script. The above example will give you access to the ideAlarm object and to the ARMINGMODE and ZONESTATUS constants (python dictionaries).

The ideAlarm object

The ideAlarm object is the top level parent object of ideAlarm. It provides functions to query and manipulate your ideAlarm system.

  • ideAlarm.isArmed(zone='1'):

    • Returns True if the zone given is armed.
    • Parameter
      • zone: (integer or string) The zone's name or ordinal number. Defaults to the zone first defined in the configuration file.
    • Return value
      • (boolean)
    • Usage example
      • if ideAlarm.isArmed('My Home'):
  • ideAlarm.isDisArmed(zone='1'):

    • Returns True if the zone given is disarmed.
    • Parameter
      • zone: (integer or string) The zone's name or ordinal number. Defaults to the zone first defined in the configuration file.
    • Return value
      • (boolean)
    • Usage example
      • if ideAlarm.isDisArmed('My Home'):
  • ideAlarm.getZoneStatus(zone='1'):

    • Returns the given zones status.
    • Parameter
      • zone: (integer or string) The zone's name or ordinal number. Defaults to the zone first defined in the configuration file.
    • Return value
      • (integer) The return value refers to the ZONESTATUS constant.
    • Usage example
      • if ideAlarm.getZoneStatus('My Home') in [ZONESTATUS['ALERT'], ZONESTATUS['TRIPPED']]:
  • ideAlarm.getAlertingZonesCount():

    • Returns the total count of alarm zones which has the status ZONESTATUS['ALERT'].
    • Return value
      • (integer)
    • Usage example
      • numAlertingZones = ideAlarm.getAlertingZonesCount()

alarm object constants

ZONESTATUS = {'NORMAL': 0, 'ALERT': 1, 'ERROR': 2, 'TRIPPED': 3, 'ARMING': 4}
ARMINGMODE = {'DISARMED': 0, 'ARMED_HOME': 1, 'ARMED_AWAY': 2}