Things should just work - Automagically
  • Home
  • Blog
  • Home Automation

REST API

Besides the web-interface Automagically is controllable by an API. This is composed of a couple of URL:s that it is possible to do HTTP GET or POST to retrive information and update information respectivly.

Devices
URL:/rest/devices/ (GET)
This returns the current devices and which commands that it can handle

Global Variables
URL:/rest/gv/all/ (GET)
Return all global variables and their current value. Replace all in the URL with a global variable id to just fetch one variable.

Device State
URL:/rest/dev/all/ (GET)
Return all known device states. Replace all in the URL with a device id to just fetch status for one device.

Events
URL:/rest/events/ (GET)
Resturn a list of all device events that will occur.

Do
URL:/rest/do/ (POST)
This is used to modify or execute commands. The following is possible to do. Return value is a JSON object. Always with a result entry but sometimes also with other information.

Device Command
Parameters to the POST request
  • type="COMMAND" - Mandatory
  • commandid=[Command ID] - Mandatory
    ID of the command to do. Supported commands listed for each device by /rest/devices/ .
  • deviceid=[Device ID] - Mandatory
    ID of the device to execute the command.

Signal
Parameters to the POST request
  • type="SIGNAL" - Mandatory
  • signal=[Signal content] - Mandatory
    The signal to send in.
  • source=[Source] - Optional
    The given source of the signal. Defaults to "http_post" if not present.

Create Event
Parameters to the POST request
  • type="CREATEEVENT" - Mandatory
  • commandid=[Command ID] - Mandatory
    ID of the command to do at the event. Supported commands listed for each device by /rest/devices/ .
  • deviceid=[Device ID] - Mandatory
    ID of the device to execute the command.
  • dotime=[Time] - Mandatory
    Time to do the event in format HH:MM:SS.
  • dodate=[Date] - Mandatory
    Dato to do the event in format YYYY-MM-DD.
  • condition_globalvariableid=[Global Variable ID] - Optionaly
    Only do the event if the value of the Global variable is True or not 0.

Cancel Event
Parameters to the POST request
  • type="CANCELEVENT" - Mandatory
  • eventid=[Event ID] - Mandatory
    The ID of the event to cancel.

Delay Event
Parameters to the POST request
  • type="DELAYEVENT" - Mandatory
  • eventid=[Event ID] - Mandatory
    The ID of the event to delay.
  • time=[minutes] - Mandatory
    The number of minutes to delay the event. Integer numbers only.

Powered by Create your own unique website with customizable templates.