Documentation

← Back to site

Create a new Trigger

Last updated on June 15, 2016 10:26

This method will create a new alert trigger on a Door or Motion Sensor subdevice.

URL

/api/v1/triggers/create

Parameters

  • subdevice_id - The ID of the subdevice to which we want to add a trigger
  • trigger_type - The type of event that we wish to trigger the alert. The value depends on the subdevice type
    • For Door Sensors the value should be one of opened or closed or all, where all will trigger on both door open and door closed events
    • For Motion Sensors the value should be one of motion_started or motion_stopped
  • days_active - A bitmap representing days of the week for which the trigger should be active. Each bit represents a day of the week, starting with Monday. Mon = 1, Tue = 2, Wed = 4 through to sun = 64. For example 65 would mean the trigger was active on Sunday and Monday.
  • all_day - Is the trigger active all day and every day. 'true' or 'false'. If this value is 'true' the trigger is on at all times. This will take precedence over the days_active bitmap, start_time and end_time.
  • start_time - Time of day after which the trigger should be active, in the format HH:MM, eg '09:30'
  • end_time - Time of day before which the trigger should be active, in the format HH:MM, eg '22:30'

Response

The created alert trigger will be returned, or a validation error.

[
  {
    "subdevice_id": 1,
    "id": 33,
    "trigger_type": "opened",
    "days_active": 8,
    "all_day": false,
    "start_time": "2000-01-01T01:10:00.000Z",
    "end_time": "2000-01-01T05:20:00.000Z"
  }
]

~