Skip to content
Alknopfler edited this page Oct 6, 2018 · 7 revisions

Features

The next table shows the operations available using the API:

sensors [API] insert [API] select [API] delete N/A
alarm insert [API] select [API] delete (all) N/A
mail [API] insert [API] select [API] delete N/A
control [API] insert [API] select [API] delete N/A
global insert select N/A update

Fixed Values

  • Sensor: *TypeOf: "presence|aperture|other"
  • Control: *TypeOf: "full|partial|inactive"

Script to detect sensor codes

This feature is also available on the webserver using the Setup -> Sensor -> Scan. But when you're using the api, it's better to use this script in order to discover the code that you have to use in the API call.

  • Inside of the project there's an interactive script to discover 433Mhz codes to register new sensors into the system.
  • The output will be the payload to register new sensors/control to the system.
  • The script is able to register several sensors/controls at the same time.
  • The script is installed automatically with the installation phase and the route is: /opt/alkalarm/discoverCode

Operations

  • Create Sensor

    • URL: "/setup/sensor"
    • METHOD: POST
    • PAYLOAD: [ { "Code":"234554", "TypeOf":"presence", "Zone": "puerta entrada" }, { "Code":"555555", "TypeOf":"other", "Zone": "tejado" } ]
  • Get Sensor Info

    • URL: "/setup/sensor"
    • METHOD: GET
    • PAYLOAD: ``
  • Delete Sensor

    • URL: "/setup/sensor/{code}"
    • METHOD: DELETE
    • PAYLOAD: ``
  • Create Control

    • URL: "/setup/control"
    • METHOD: POST
    • PAYLOAD: [{"Code":"3462412","Description":"mando1","TypeOf":"inactive"},{"Code":"3462448","Description":"mando1","TypeOf":"full"},{"Code":"3462592","Description":"mando1","TypeOf":"partial"}]
  • Get Control Info

    • URL: "/setup/control"
    • METHOD: GET
    • PAYLOAD: ``
  • Delete Control

    • URL: "/setup/control/{code}"
    • METHOD: DELETE
    • PAYLOAD: ``
  • Create Mail

    • URL: "/setup/mail"
    • METHOD: POST
    • PAYLOAD: [ { "receptor":"xxxxx@gmail.com" }]
  • Get Mail Info

    • URL: "/setup/mail"
    • METHOD: GET
    • PAYLOAD: ``
  • Delete Mail

    • URL: "/setup/mail/{receptor}"
    • METHOD: DELETE
    • PAYLOAD: ``
  • Get Alarm Info

    • URL: "/alarm"
    • METHOD: GET
    • PAYLOAD: ``
  • Delete all the Alarm

    • URL: "/alarm"
    • METHOD: DELETE
    • PAYLOAD: ``
  • Activate all the Alarm Sensors

    • URL: "/activate/full"
    • METHOD: POST
    • PAYLOAD: ``

After the activation we've got 30 sec to avoid any sensor trigger in order to be able to go out home. During this period of time any event will be ignored and the global state will be inactive during this time. After that, the system will be armed and all the event will be processed.

  • Activate part of the Alarm Sensors
    • URL: "/activate/partial"
    • METHOD: POST
    • PAYLOAD: ``

After the activation we've got 30 sec to avoid any sensor trigger in order to be able to go out home. During this period of time any event will be ignored and the global state will be inactive during this time. After that, the system will be armed and all the event will be processed.

  • Stop the Alarm System

    • URL: "/deactivate"
    • METHOD: POST
    • PAYLOAD: ``
  • Status the Alarm System

    • URL: "/status"
    • METHOD: GET
    • PAYLOAD: ``

Clone this wiki locally