{
"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."
}
}
]
}
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."
}
}
]
}'{
"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": "turn_on"
}
],
"_id": "6822a355f5451751b0c737f0",
"createdAt": "2025-05-13T01:41:41.136Z",
"updatedAt": "2025-05-13T01:41:41.136Z",
"__v": 0
}
}