Automation - PUT Update Automation Controller Trigger
Update the telemetry trigger for your automation
Put{{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 |
automation_type | String |
The type of automation (trigger) or (schedule) |
is_active | Integer |
Does your automation active(1) or not(0) |
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 "controller" |
triggers[].value[].telemetry_key | String |
Key of the telemetry being monitored |
triggers[].value[].actuator_name | String |
Human-readable name for the controller 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.alarm.device | Integer |
Target device for alarm |
actions[].detail.alarm.device | String |
Alarm message |
actions[].detail.alarm.is_send_email | Integer |
Whether to send email (0 or 1) |
actions[].detail.alarm.alarm_email[] | Array |
Recipient email addresses |
actions[].detail.alarm.alarm_email_group_id[] | Array |
Optional email group IDs |
actions[].detail.controller.device | Integer |
Target device to control |
actions[].detail.controller.device_action_key | String |
Key for the control command |
actions[].detail.controller.device_action_value | String |
Value to send for control: "on", or "off" |
actions[].detail.email.to[] | Array |
Recipient emails |
actions[].detail.email.subject | String |
Email subject |
actions[].detail.email.content | String |
Email body |
actions[].detail.email.email_group_id[] | Array |
Optional email group IDs |
actions[].detail.api.url | String |
External API URL |
actions[].detail.api.method | String |
HTTP method |
actions[].detail.api.headers[] | Array |
Optional header |
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": "controller",
"value": [
{
"telemetry_key": "2139129123",
"actuator_name": "ets"
}
],
"condition": "=",
"comparator": "on"
},
{
"relation": "AND"
},
{
"device": 568,
"source": "controller",
"value": [
{
"telemetry_key": "door_sensor",
"actuator_name": "door sensor"
}
],
"condition": "=",
"comparator": "true"
}
],
"actions": [
{
"type": "alarm",
"detail": {
"alarm": {
"is_send_email": 1,
"alarm_email": [
"usertenant4@baru.com"
],
"device": 588,
"detail": "test",
"alarm_email_group_id": [
23
]
}
}
},
{
"type": "controller",
"detail": {
"controller": {
"device": 588,
"device_action_key": "2139129123",
"device_action_value": "off"
}
}
},
{
"type": "email",
"detail": {
"email": {
"to": [
"usertenant2@baru.com"
],
"subject": "test",
"content": "testing",
"email_group_id": [
4
]
}
}
},
{
"type": "api",
"detail": {
"api": {
"url": "testing.com",
"method": "GET",
"headers": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"params": [
{
"key": "test",
"value": "22"
}
],
"body": "testing"
}
}
}
],
"name": "test controller trigger postman update",
"is_active": 0,
"automation_type": "trigger",
"description": "test"
}
{
"message": "automation updated",
"data": {
"id": 1004
},
"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."
}
]
}