IoT Stadium

API Documentation

Automation

Automation - POST Add Automation Schedule: Day

Add the automation schedule daily

Post
{{url_iot_backend}}/ext/automations
{
	"key": "Content-Type",
	"value": "application/json"
},
{
	"key": "Authorization",
	"value": "Bearer {{token}}"
},

Parameter

Field Type Description
name String

Name of your automation

automation_type String

The type of automation (trigger) or (schedule)

is_active String

Does your automation active(1) or not(0)

description String

The automation description

schedule.type String

Schedule type: "daily"

schedule.start_time String

Start time of the schedule

schedule.end_time String

End time of the schedule

schedule.every_on_day Array

Days of the week (0=Sun to 6=Sat)

schedule.exec_at_hour_day Integer

Hour of the day for execution (24h format)

schedule.exec_at_minute_hour Integer

Minute of the hour for execution

actions Array

Array of automation actions

actions[].type String

Type of action: "controller"

actions[].detail.controller.device Integer

ID of the device to control

actions[].detail.controller.device_action_key String

Action key for the device

actions[].detail.controller.device_action_value String

Value to send

{
    "schedule": {
        "type": "daily",
        "start_time": "2024-05-31 13:45:00",
        "end_time": "2024-06-30 13:45:00",
        "every_on_day": [
            1, // monday
            2, // tuesday
            3, // wednesday
            4, // thursay
            5, // friday
            0, // sunday
            6  // satuday
        ],
        "exec_at_hour_day": 13,
        "exec_at_minute_hour": 30
    },
    "actions": [
        {
            "type": "controller",
            "detail": {
                "controller": {
                    "device": 588,
                    "device_action_key": "2139129123",
                    "device_action_value": "off"
                }
            }
        }
    ],
    "name": "test schedule daily postman",
    "is_active": 1,
    "automation_type": "schedule",
    "description": "test schedule daily"
}                                            
{
    "message": "automation created",
    "data": {
        "id": 1000
    },
    "code": 200
}
{
    "message": "Invalid Message",
    "code": 400,
    "errors": [
        {
            "field": "schedule.every_on_day",
            "message": "The schedule.every on day field is required when schedule.type is daily."
        }
    ]
}