Triggers

Connect trigger to sensor: POST /sensors/{id}/triggers

This method connects an existing trigger to a sensor.
After this a notification can be connected to this sensor trigger.

URLhttps://api.sense-os.nl/sensors/{id}/triggers
MethodPOST
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Request Body

The triggers array

{
    "triggers": [
        {
            "trigger": {
                "id": 2
            }
        },
        {
            "trigger": {
                "id": 1
            }
        }
    ]
}

List sensor triggers: GET /sensors/{id}/triggers

This method lists the triggers connected to specific sensor sensor

URLhttps://api.sense-os.nl/sensors/{id}/triggers
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

List all sensor triggers: GET /sensors/triggers

This method returns all the triggers that are connected to a sensors.

URLhttps://api.sense-os.nl/sensors/triggers
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Remove trigger from sensor: DELETE /sensors/{id}/triggers/{trigger_id}

This method removes a trigger from a sensor. Connected notifications will also be disconected.

URLhttps://api.sense-os.nl/sensors/{id}/triggers/{trigger_id}
MethodDELETE
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Update sensor trigger: PUT /sensors/{id}/trigger/{trigger_id}

This method updates a sensor trigger

URLhttps://api.sense-os.nl/sensors/{id}/trigger/{trigger_id}
MethodPUT
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Request Body

The sensor trigger object

{
    "trigger": {
        "active": 1,
        "last_triggered": 0,
        "times_triggerd": 0,
        "last_sensor_data_value": "",
        "last_sensor_data_date": 0
    }
}

Toggle sensor trigger activation: POST /sensors/{id}/triggers/{trigger_id}/active

This method toggles the activiation of a sensor trigger.

URLhttps://api.sense-os.nl/sensors/{id}/triggers/{trigger_id}/active
MethodPOST
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
activeTo activate a trigger send active = 1 and to deactive send active = 0 xsd:boolean

List triggers: GET /triggers

This method returns a list of triggers

URLhttps://api.sense-os.nl/triggers
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
totalReturns a count of the total amount of triggers xsd:int
pageThis parameter specifies which page of the results must be retrieved. The page offset starts at 0. xsd:int
per_pageThis parameter specifies the amount of items that must be received at once. The maximum amount is 1000 items and the default amount is 100 items. xsd:int

Delete trigger: DELETE /triggers/{id}

This method deletes a trigger

URLhttps://api.sense-os.nl/triggers/{id}
MethodDELETE
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Create trigger: POST /triggers

This method creates a sensor data trigger. A trigger can be connected to multiple sensors.
Available variables for the trigger expression are:
last_triggered : unixtime of the last time it got triggered
times_triggered : amount of times it got triggered from the start or rest
last_sensor_data_value : the last sensor data value that was processed, not the current
last_sensor_data_date : the date of this last sensor value
sensor_data_value : the current sensor data value
sensor_data_date : the date of the current sensor data value
current_time : the current unix timestamp
Text in the trigger expression should be surrounded with double quotes: "text".
Triggers fire at a maximum speed of 1x per minute.
Instead of an expression a trigger can have a inactivity value in seconds (smallest value is 60 seconds).
An inactivity trigger will fire if it does not receive sensor data input within the specified inactivity period.

URLhttps://api.sense-os.nl/triggers
MethodPOST
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Request Body

The trigger object

{
    "trigger": {
        "name": "new trigger",
        "expression": "sensor_data_value < 10"
    }
}

Update trigger: PUT /triggers/{id}

This method will update a trigger.

URLhttps://api.sense-os.nl/triggers/{id}
MethodPUT
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType

Request Body

The trigger object

{
    "trigger": {
        "name": "new trigger name",
        "expression": "sensor_data_value > 10"
    }
}