IoT Stadium

API Documentation

Automation

Automation - PUT Update Automation Schedule: Hour

Add the automation schedule hourly

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

Parameter

Field Type Description
schedule.type String

Schedule type: "hourly"

schedule.start_time String

Start time in format: YYYY-MM-DD HH:MM:SS

schedule.end_time String

End time in format: YYYY-MM-DD HH:MM:SS

schedule.every_x_hour Integer

Interval in hours for the hourly trigger

actions Array

Array of automation actions

actions[].type String

Type of action: "controller"

actions[].detail.controller.device Integer

Device ID to control

actions[].detail.controller.device_action_key String

Action key for the device

actions[].detail.controller.device_action_value String

Value to send

name String

Name for your schedule automation

is_active Integer

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

automation_type String

The type of automation (trigger) or (schedule)

description String

The automation description

{
    "schedule": {
        "type": "hourly",
        "start_time": "2024-05-30 09:55:00",
        "end_time": "2024-05-31 19:55:00",
        "every_x_hour": 2
    },
    "actions": [
        {
            "type": "controller",
            "detail": {
                "controller": {
                    "device": 588,
                    "device_action_key": "2139129123",
                    "device_action_value": "off"
                }
            }
        }
    ],
    "name": "test scheduler hourly postman",
    "is_active": 0,
    "automation_type": "schedule",
    "description": "test scheduler hourly"
}                                            
{
    "message": "automation updated",
    "data": {
        "id": 1006
    },
    "code": 200
}
{
    "message": "Invalid Message",
    "code": 400,
    "errors": [
        {
            "field": "schedule.every_x_hour",
            "message": "The schedule.every x hour field is required when schedule.type is hourly."
        }
    ]
}                                                
{
    "message": "Invalid Message",
    "code": 400,
    "errors": [
        {
            "field": "name",
            "message": "The name field is required.."
        },
        {
            "field": "is_active",
            "message": "The is active field is required.."
        },
        {
            "field": "automation_type",
            "message": "The automation type field is required.."
        },
        {
            "field": "schedule.every_x_hour",
            "message": "The schedule.every x hour field is required when schedule.type is hourly."
        }
    ]
}