- Auth
- Users
- Reports
- Room
- Device
- category
- Sensor
- Automation
Add New Automation
Developing
POST
/automation/create
Automation
Request
Header Params
Authorization
string
optional
Example:
token
Body Params application/json
triggers
array [object {4}]
required
type
string
required
sensorId
string
required
value
string
required
time
integer
required
actions
array [object {2}]
required
type
string
required
data
object
required
conditions
array [object {3}]
required
type
string
required
deviceId
string
required
state
string
required
name
string
required
Example
{
"name": "Automation 1",
"triggers": [
{
"type": "SENSOR",
"sensorId": "60b8d2950f1b2c001f8c8e4d",
"value": 30
}
],
"conditions": [
{
"type": "DEVICE",
"deviceId": "60b8d2950f1b2c001f8c8e4f",
"state": "on"
}
],
"actions": [
{
"type": "NOTIFICATION",
"data": {
"title": "Temperature Alert",
"message": "The temperature has reached 30°C."
}
}
]
}
Request samples
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST '/automation/create' \
--header 'Authorization: token' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Automation 1",
"triggers": [
{
"type": "SENSOR",
"sensorId": "60b8d2950f1b2c001f8c8e4d",
"value": 30
}
],
"conditions": [
{
"type": "DEVICE",
"deviceId": "60b8d2950f1b2c001f8c8e4f",
"state": "on"
}
],
"actions": [
{
"type": "NOTIFICATION",
"data": {
"title": "Temperature Alert",
"message": "The temperature has reached 30°C."
}
}
]
}'
Responses
🟢200Success
application/json
Body
object {0}
Example
{
"message": "Automation created successfully",
"automation": {
"userId": "680a9b2dcdf756b0e0909dde",
"triggers": [
{
"type": "SENSOR",
"sensorId": "60b8d2950f1b2c001f8c8e4d",
"value": 30
}
],
"actions": [
{
"type": "NOTIFICATION",
"data": {
"title": "Temperature Alert",
"message": "The temperature has reached 30°C."
}
}
],
"conditions": [
{
"type": "DEVICE",
"deviceId": "60b8d2950f1b2c001f8c8e4f",
"state": "on"
}
],
"_id": "6822a355f5451751b0c737f0",
"createdAt": "2025-05-13T01:41:41.136Z",
"updatedAt": "2025-05-13T01:41:41.136Z",
"__v": 0
}
}