Automation - POST Add Automation Telemetry Trigger
Add the telemetry trigger for your automation
Post{{url_iot_backend}}/ext/automations
{
"key": "Content-Type",
"value": "application/json"
},
{
"key": "Authorization",
"value": "Bearer {{token}}"
},
Parameter
Field | Type | Description |
---|---|---|
name | String |
Name for your telemetry trigger |
is_active | Integer |
Does your automation active(1) or not(0) |
automation_type | String |
The type of automation (trigger) or (schedule) |
automation_interval | Integer |
Check interval in minutes (default 15) |
automation_delay | Integer |
Action delay in seconds (default 5) |
automation_deadband | String |
Value hysteresis to prevent flapping |
description | String |
The automation description |
triggers | Array |
List of conditions to evaluate for triggering the automation. |
triggers[].device | Integer |
Device ID |
triggers[].source | String |
use "telemetetry" |
triggers[].value[].telemetry_key | String |
Key of the telemetry being monitored |
triggers[].value[].key_wording | String |
Human-readable name for the telemetry key |
triggers[].condition | String |
Operator condition: "<", ">" ,"=", etc |
triggers[].comparator | String |
Value to compare against |
triggers[].relation | String |
Logical relation if multiple triggers are combined |
actions | Array |
List of actions to execute if triggered |
actions[].type | String |
Type of action: "controller", "alarm", "email", "api" |
actions[].detail.controller.device | Integer |
Device ID to control |
actions[].detail.controller.device_action_key | String |
Key for the action |
actions[].detail.controller.device_action_value | String |
Value for the action; "on" or "off" |
actions[].detail.alarm.alarm_email | Array |
List of alarm email recipients |
actions[].detail.email.to | Array |
List of email recipients |
actions[].detail.api.url | String |
Target API URL |
actions[].detail.api.method | String |
HTTP method |
actions[].detail.api.headers[] | Array |
Key-value pairs of headers |
actions[].detail.api.params[] | Array |
Key-value query parameters for the API call |
actions[].detail.api.body | String |
Raw body string (can be JSON, plain text, etc.) |
{
"triggers": [
{
"device": 588,
"source": "telemetry",
"value": [
{
"telemetry_key": "test tele",
"key_wording": "test tele (test tele)"
}
],
"condition": "=",
"comparator": "10"
},
{
"relation": "AND"
},
{
"device": 588,
"source": "telemetry",
"value": [
{
"telemetry_key": "test tele",
"key_wording": "test tele (test tele)"
}
],
"condition": "=",
"comparator": "10"
}
],
"actions": [
{
"type": "alarm",
"detail": {
"alarm": {
"is_send_email": 1,
"alarm_email": [
"owner@gmail.com"
],
"device": 588,
"detail": "testing",
"alarm_email_group_id": [
37,
35
]
}
}
},
{
"type": "controller",
"detail": {
"controller": {
"device": 588,
"device_action_key": "2139129123",
"device_action_value": "on"
}
}
},
{
"type": "email",
"detail": {
"email": {
"to": [
"new@user.com"
],
"subject": "testing",
"content": "testing",
"email_group_id": [
22
]
}
}
},
{
"type": "api",
"detail": {
"api": {
"url": "testing.comm",
"method": "GET",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"params": [
{
"key": "test",
"value": "1"
}
],
"body": "testing"
}
}
}
],
"name": "testing tele postman",
"is_active": 0,
"automation_type": "trigger",
"automation_interval": 15,
"description": "testing",
"automation_delay": 5,
"automation_deadband": "0"
}
{
"message": "automation created",
"data": {
"id": 985
},
"code": 200
}
{
"message": "Invalid Message",
"code": 400,
"errors": [
{
"field": "actions.0.detail.alarm.alarm_email",
"message": "The actions.0.detail.alarm.alarm_email field is required when actions.0.detail.alarm.is_send_email is 1."
},
{
"field": "actions.2.detail.email.to",
"message": "The actions.2.detail.email.to field is required when actions.2.type is email."
}
]
}