CG Cloud API

Version: v1.0 2021-05-14

This page describes the parameters and results for the operations of the CG Cloud API v1.0 (2021-05-14), and shows how to use the API to obtain data from the system. This documentation is specific to the 2021-05-14 API version of the system.

Introduction

All the requests and responses are based on RESTful APIs that are performed within Amazon Virtual Private Cloud (VPC). Public access of the API is not allowed. Each request to the API must include only one "action".

Base URL: http://api.cgcloud.co/

URI: v1.0/

API Command Summary

getUserList

Get the list of system users with the user's details.

getBSList

Get the list of Base Stations in the system with the Base Station's details.

getEMUList

Get the list of EMUs in the system with the EMU's details.

getBSOnlineStatus

Get the list of Base Stations in the system with online status.

getEMUOnlineStatus

Get the list of EMUs in the system with online status.

getUserBSList

Get the list of Base Stations associated with a particular user.

getUserEMUList

Get the list of EMUs associated with a particular user.

getBSZoneList

Get the list of zones created by users that associated with a particular Base Station.

getBSDeviceList

Get the list of devices that associated with a particular Base Station.

getEMUCircuitList

Get the list of circuits that associated with a particular EMU.

getDeviceControlRecord

Get the device control records within a particular period of time.

getSensorRecord

Get the sensor records within a particular period of time.

getPowerConsumptionRecord

Get the power consumption records from EMU within a particular period of time.

deviceControlRequest

Send a device control request.

deviceGroupControlRequest

Send a group of device control request (scene control).

getDeviceStatusRequest

Get device status request.

getScheduleRequest

Get all schedule of a Base Station

setScheduleRequest

Set a new schedule or update an existing schedule of a Base Station.

deleteScheduleRequest

Delete a schedule of Base Station.

updateScheduleToBSRequest

Update the schedule settings from server to Base Station.


getUserList

Get the list of system users with the user's details. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getUserList",
"clientName":"String: Client Name"
}
Response [
{
"id":"Number: System assigned ID for the user",
"firstname":"String: Name of user",
"lastname":"String: Lastname of user",
"email":"String: User registered email used for login",
"birthday":"Date: Brithday of user",
"mobile":"String: User registered mobile phone number",
"reg_datetime":"DateTime: User registration date and time",
"ipaddr":"String: User registration IP Address",
"state":"Number: User account state: 1->normal, -1->blocked"
},
{
"id":"Number: System assigned ID for the user",
"firstname":"String: Name of user",
"lastname":"String: Lastname of user",
"email":"String: User registered email used for login",
"birthday":"Date: Brithday of user",
"mobile":"String: User registered mobile phone number",
"reg_datetime":"DateTime: User registration date and time",
"ipaddr":"String: User registration IP Address",
"state":"Number: User account state: 1->normal, -1->blocked"
},...
]

cURL example: curl -d '{"cmd":"getUserList","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getBSList

Get the list of Base Stations in the system with the Base Station's details. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getBSList",
"clientName":"String: Client Name"
}
Response [
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"last_update_bs_setting":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address"
},
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"last_update_bs_setting":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address"
},...
]

cURL example: curl -d '{"cmd":"getBSList","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getEMUList

Get the list of EMUs in the system with the EMU's details. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getEMUList",
"clientName":"String: Client Name"
}
Response [
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"reg_time":"DateTime: EMU registration date and time",
"update_time":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"last_online_time":"DateTime: Last online time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address"
},
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"reg_time":"DateTime: EMU registration date and time",
"update_time":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"last_online_time":"DateTime: Last online time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address"
},...
]

cURL example: curl -d '{"cmd":"getEMUList","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getBSOnlineStatus

Get the list of Base Stations in the system with online status. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getBSOnlineStatus",
"clientName":"String: Client Name"
}
Response [
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"ip":"String: Last online IP Address"
"status":"String: online/offline"
},
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"ip":"String: Last online IP Address"
"status":"String: online/offline"
},...
]

cURL example: curl -d '{"cmd":"getBSOnlineStatus","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getEMUOnlineStatus

Get the list of EMUs in the system with online status. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getEMUOnlineStatus",
"clientName":"String: Client Name"
}
Response [
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"last_online_time":"DateTime: Last online time",
"ip":"String: Last online IP Address"
"status":"String: online/offline"
},
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"last_online_time":"DateTime: Last online time",
"ip":"String: Last online IP Address"
"status":"String: online/offline"
},...
]

cURL example: curl -d '{"cmd":"getEMUOnlineStatus","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getUserBSList

Get the list of Base Stations associated with a particular user. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getUserBSList",
"userID":Number: System assigned ID for the user,
"clientName":"String: Client Name"
}
Response {
"userID":"Number: System assigned ID for the user",
"bsList":
[
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"last_update_bs_setting":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address",
"user_role":"String: Assigned user role: Admin/PowerUser/User"
},
{
"id":"Number: System assigned ID for the Base Station",
"name":"String: Name of Base Station",
"last_online_time":"DateTime: Last online time",
"last_update_bs_setting":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address",
"user_role":"String: Assigned user role: Admin/PowerUser/User"
},...
]
}

cURL example: curl -d '{"cmd":"getUserBSList","userID":124,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getUserEMUList

Get the list of EMUs associated with a particular user. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getUserEMUList",
"userID":Number: System assigned ID for the user,
"clientName":"String: Client Name"
}
Response {
"userID":"Number: System assigned ID for the user",
"emuList":
[
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"reg_time":"DateTime: EMU registration date and time",
"update_time":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"last_online_time":"DateTime: Last online time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address",
"user_role":"String: Assigned user role: Admin/User"
},
{
"id":"Number: System assigned ID for the EMU",
"name":"String: Name of EMU",
"reg_time":"DateTime: EMU registration date and time",
"update_time":"DateTime: Last setting update time",
"last_firmware_update":"DateTime: Last firmware update time",
"last_online_time":"DateTime: Last online time",
"firmware_version":"String: Firmware version",
"ip":"String: Last online IP Address",
"user_role":"String: Assigned user role: Admin/User"
},...
]
}

cURL example: curl -d '{"cmd":"getUserEMUList","userID":124,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getBSZoneList

Get the list of zones created by users that associated with a particular Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getBSZoneList",
"bsID":Number: System assigned ID for the Base Station,
"clientName":"String: Client Name"
}
Response {
"bsID":"Number: System assigned ID for the Base Station",
"zoneList":
[
{
"bs_zone_id":"Number: System assigned ID for the zone",
"bs_zone_order":"Number: User assigned order the zone on App",
"name":"String: Name of zone",
"last_update":"DateTime: Last setting update time"
},
{
"bs_zone_id":"Number: System assigned ID for the zone",
"bs_zone_order":"Number: User assigned order the zone on App",
"name":"String: Name of zone",
"last_update":"DateTime: Last setting update time"
},...
]
}

cURL example: curl -d '{"cmd":"getBSZoneList","bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getBSDeviceList

Get the list of devices that associated with a particular Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getBSDeviceList",
"bsID":Number: System assigned ID for the Base Station,
"clientName":"String: Client Name"
}
Response {
"bsID":"Number: System assigned ID for the Base Station",
"deviceList":
[
{
"id":"Number: System assigned ID for the device",
"bs_zone_id":"Number: System assigned ID for the zone, used to indicate the device is associated with the zone",
"bs_device_id":"Number: System assigned ID for the Base Station to identify the device",
"device_id":"Number: System assigned ID for the App to identify the device",
"ep":"Number: System assigned endpoint ID for the Base Station to identify the device",
"type":"Number: Device type in number. Please refer to System device type code number",
"name":"String: Device name",
"last_update":"DateTime: Last setting update time"
},
{
"id":"Number: System assigned ID for the device",
"bs_zone_id":"Number: System assigned ID for the zone, used to indicate the device is associated with the zone",
"bs_device_id":"Number: System assigned ID for the Base Station to identify the device",
"device_id":"Number: System assigned ID for the App to identify the device",
"ep":"Number: System assigned endpoint ID for the Base Station to identify the device",
"type":"Number: Device type in number. Please refer to System device type code number",
"name":"String: Device name",
"last_update":"DateTime: Last setting update time"
},...
]
}

cURL example: curl -d '{"cmd":"getBSDeviceList","bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getEMUCircuitList

Get the list of circuits that associated with a particular EMU. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getEMUCircuitList",
"emuID":Number: System assigned ID for the EMU,
"clientName":"String: Client Name"
}
Response {
"emuID":"Number: System assigned ID for the EMU",
"circuitList":
[
{
"circuit_id":"Number: System assigned ID for the circuit within the EMU",
"name":"String: Circuit name",
"ct_rating":"Number: Configured CT rating",
"input_gp":"Number: Indicate 3-phase group",
},
{
"circuit_id":"Number: System assigned ID for the circuit within the EMU",
"name":"String: Circuit name",
"ct_rating":"Number: Configured CT rating",
"input_gp":"Number: Indicate 3-phase group",
},...
]
}

cURL example: curl -d '{"cmd":"getEMUCircuitList","emuID":4,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getDeviceControlRecord

Get the device control records within a particular period of time. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getDeviceControlRecord",
"bsID":Number: System assigned ID for the Base Station.,
"deviceID":Number: System assigned ID for the device. When deviceID set to 0, the system responses with all the control rescords of the Base Station within the period of time,
"start":DateTime: Record start time,
"end":DateTime: Record end time,
"clientName":"String: Client Name"
}
Response [
{
"time":"DateTime: Control record time",
"user_id":"Number: System assigned ID for the user, indicate the user to trigger the control. If the control is not trigger by a user, the value will be 0",
"user_email":"String: User register email, indicate the user to trigger the control. If the control is not trigger by a user, the value will be blank",
"src_name":"String: Indicate the source to trigger control. Possible value: Single Control/Scene Control/Sensor Control/Schedule Contro/Status Response",
"bs_id":"Number: System assigned ID for the Base Station, indicate the user access to ",
"bs_name":"String: Name of Base Station",
"dev_id":"Number: System assigned ID for the device, indicate which device is controlled",
"dev_name":"String: Device name",
"dev_type":"Number: Device type in number. Please refer to System device type code number",
"status":"String: Target control status. Please refer to System device control status",
"result":"String: Control result: success/fail",
},
{
"time":"DateTime: Control record time",
"user_id":"Number: System assigned ID for the user, indicate the user to trigger the control. If the control is not trigger by a user, the value will be 0",
"user_email":"String: User register email, indicate the user to trigger the control. If the control is not trigger by a user, the value will be blank",
"src_name":"String: Indicate the source to trigger control. Possible value: Single Control/Scene Control/Sensor Control/Schedule Contro/Status Response",
"bs_id":"Number: System assigned ID for the Base Station, indicate the user access to ",
"bs_name":"String: Name of Base Station",
"dev_id":"Number: System assigned ID for the device, indicate which device is controlled",
"dev_name":"String: Device name",
"dev_type":"Number: Device type in number. Please refer to System device type code number",
"status":"String: Target control status. Please refer to System device control status",
"result":"String: Control result: success/fail",
},...
]

cURL example: curl -d '{"cmd":"getDeviceControlRecord","bsID":61,"deviceID":0,"start":"2021-05-10 00:00:00","end":"2021-05-15 00:00:00","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getSensorRecord

Get the sensor records within a particular period of time. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getSensorRecord",
"bsID":Number: System assigned ID for the Base Station.,
"deviceID":Number: System assigned ID for the sensor. When deviceID set to 0, the system responses with all the sensor rescords of the Base Station within the period of time,
"start":DateTime: Record start time,
"end":DateTime: Record end time,
"clientName":"String: Client Name"
}
Response [
{
"bs_id":"Number: System assigned ID for the Base Station",
"bs_device_id":"Number: System assigned ID for the Base Station to identify the device",
"ep":"Number: System assigned endpoint ID for the Base Station to identify the device",
"time":"DateTime: Sensor record time",
"status":"String/Number: Sensor status. Please refer to System sensor status",
"device_id":"Number: System assigned ID for the sensor, indicate which sensor is triggered",
"name":"String: Sensor name",
},
{
"bs_id":"Number: System assigned ID for the Base Station",
"bs_device_id":"Number: System assigned ID for the Base Station to identify the device",
"ep":"Number: System assigned endpoint ID for the Base Station to identify the device",
"time":"DateTime: Sensor record time",
"status":"String/Number: Sensor status. Please refer to System sensor status",
"device_id":"Number: System assigned ID for the sensor, indicate which sensor is triggered",
"name":"String: Sensor name",
},...
]

cURL example: curl -d '{"cmd":"getSensorRecord","bsID":61,"deviceID":0,"start":"2019-01-01 00:00:00","end":"2019-01-01 12:00:00","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getPowerConsumptionRecord

Get the power consumption records from EMU within a particular period of time. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getPowerConsumptionRecord",
"emuID":Number: System assigned ID for the EMU.,
"circuitID":Number: System assigned ID for the circuit within the EMU. When circuitID set to 0, the system responses with all the consumption rescords of the EMU within the period of time,
"start":DateTime: Record start time,
"end":DateTime: Record end time,
"clientName":"String: Client Name"
}
Response [
{
"emu_id":"Number: System assigned ID for the EMU",
"circuit_id":"Number: System assigned ID for the circuit within the EMU",
"input_gp":"Number: Indicate 3-phase group",
"time":"DateTime: Consumption record time",
"reading":"Float: Consumption (kWh)",
},
{
"emu_id":"Number: System assigned ID for the EMU",
"circuit_id":"Number: System assigned ID for the circuit within the EMU",
"input_gp":"Number: Indicate 3-phase group",
"time":"DateTime: Consumption record time",
"reading":"Float: Consumption (kWh)",
},...
]

cURL example: curl -d '{"cmd":"getPowerConsumptionRecord","emuID":4,"circuitID":0,"start":"2021-05-10 00:00:00","end":"2021-05-15 00:00:00","clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


deviceControlRequest

Send a device control request. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"deviceControlRequest",
"bsID":Number: System assigned ID for the Base Station.,
"deviceID":Number: System assigned ID for the device.,
"type":Number: Device type in number. Please refer to System device type code number,
"status":String/Number: Control status. Please refer to System device control status,
"clientName":"String: Client Name"
}
Response {
"result":"String: Control result: success/fail",
}

cURL example:

Control ON/OFF
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":19,"type":0,"status":{"power":"off"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/

Control Dimmer
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":24,"type":2,"status":{"level":90},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/

Control AC
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":41,"type":12,"status":{"power":"on","temperature":16,"fan":"lo"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":41,"type":12,"status":{"power":"on","temperature":22,"fan":"hi"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":41,"type":12,"status":{"power":"off","temperature":22,"fan":"hi"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/

Control IR AC
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":40,"type":19,"status":{"power":"on","mode":"dry"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":40,"type":19,"status":{"power":"on","mode":"fan","fan":"mi"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":40,"type":19,"status":{"power":"on","mode":"cool","temperature":16,"fan":"lo"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":40,"type":19,"status":{"power":"on","mode":"cool","temperature":22,"fan":"mi"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/
curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceID":40,"type":19,"status":{"power":"off","mode":"cool","temperature":22,"fan":"hi"},"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


deviceGroupControlRequest

Send a group of device control request (scene control). Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"deviceGroupControlRequest",
"clientName":"String: Client Name",
"bsID":Number: System assigned ID for the Base Station.,
"deviceList":List of devices to be controlled with desired status
[
{
"deviceID":Number: System assigned ID for the device.,
"type":Number: Device type in number. Please refer to System device type code number,
"status":String/Number: Control status. Please refer to System device control status
},
{
"deviceID":Number: System assigned ID for the device.,
"type":Number: Device type in number. Please refer to System device type code number,
"status":String/Number: Control status. Please refer to System device control status
},...
]
}
Response {
"result":"String: Control result: success/fail",
}

cURL example:

curl -d '{"cmd":"deviceControlRequest","bsID":61,"deviceList":[{"deviceID":19,"type":0,"status":{"power":"off"}},{"deviceID":24,"type":2,"status":{"level":90}},{"deviceID":41,"type":12,"status":{"power":"on","temperature":16,"fan":"lo"}},{"deviceID":40,"type":19,"status":{"power":"on","mode":"cool","temperature":22,"fan":"hi"}}],"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getDeviceStatusRequest

Get device status request. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getDeviceStatusRequest",
"bsID":Number: System assigned ID for the Base Station.,
"clientName":"String: Client Name"
}
Response {
"result":"String: Control result: success/fail",
"deviceList":
[
{
"deviceID":"Number: System assigned ID for the device",
"status":"String/Number: Device status. Please refer to System device control status and System sensor status",
},
{
"deviceID":"Number: System assigned ID for the device",
"status":"String/Number: Device status. Please refer to System device control status and System sensor status",
},...
]
}

cURL example: curl -d '{"cmd":"getDeviceStatusRequest","bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


getScheduleRequest

Get all schedule of a Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request{
"cmd":"getScheduleRequest",
"bsID":Number: System assigned ID for the Base Station.,
"clientName":"String: Client Name"
}
Response {
"bsID":"Number: System assigned ID for the Base Station",
"scheduleList":
[
{
"id":"Number: System assigned ID for the schedule",
"bs_id":"Number: System assigned ID for the base station, used to indicate the schedule is associated with the base station",
"name":"String: Schedule name",
"type":"Number: Schedule type in number. 1 -> Run once at specific action_date and action_time only; 2 -> Run at specific action_time repeatedly",
"action_date":"Date: The specific date of running the action",
"action_time":"Time: The specific time of running the action",
"sun":"Number: Enable / disable the schedule on Sunday. 0 -> Disabled; 1 -> Enabled.",
"mon":"Number: Enable / disable the schedule on Monday. 0 -> Disabled; 1 -> Enabled.",
"tue":"Number: Enable / disable the schedule on Tuesday. 0 -> Disabled; 1 -> Enabled.",
"wed":"Number: Enable / disable the schedule on Wednesday. 0 -> Disabled; 1 -> Enabled.",
"thu":"Number: Enable / disable the schedule on Thursday. 0 -> Disabled; 1 -> Enabled.",
"fri":"Number: Enable / disable the schedule on Friday. 0 -> Disabled; 1 -> Enabled.",
"sat":"Number: Enable / disable the schedule on Saturday. 0 -> Disabled; 1 -> Enabled.",
"control_list":<,br/> [
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},...
]
},
{
"id":"Number: System assigned ID for the schedule",
"bs_id":"Number: System assigned ID for the base station, used to indicate the schedule is associated with the base station",
"name":"String: Schedule name",
"type":"Number: Schedule type in number. 1 -> Run once at specific action_date and action_time only; 2 -> Run at specific action_time repeatedly",
"action_date":"Date: The specific date of running the action",
"action_time":"Time: The specific time of running the action",
"sun":"Number: Enable / disable the schedule on Sunday. 0 -> Disabled; 1 -> Enabled.",
"mon":"Number: Enable / disable the schedule on Monday. 0 -> Disabled; 1 -> Enabled.",
"tue":"Number: Enable / disable the schedule on Tuesday. 0 -> Disabled; 1 -> Enabled.",
"wed":"Number: Enable / disable the schedule on Wednesday. 0 -> Disabled; 1 -> Enabled.",
"thu":"Number: Enable / disable the schedule on Thursday. 0 -> Disabled; 1 -> Enabled.",
"fri":"Number: Enable / disable the schedule on Friday. 0 -> Disabled; 1 -> Enabled.",
"sat":"Number: Enable / disable the schedule on Saturday. 0 -> Disabled; 1 -> Enabled.",
"control_list":<,br/> [
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},...
]
},...
]
}

cURL example: curl -d '{"cmd":"getScheduleRequest","bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


setScheduleRequest

Set a new schedule or update an existing schedule of a Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request {
"cmd":"setScheduleRequest",
"clientName":"String: Client Name",
"bsID":Number: System assigned ID for the Base Station.
"scheduleID":"Number: 0 -> Set a new schedule; other positive number -> System assigned ID for the schedule to be updated",
"id":"Number: System assigned ID for the schedule",
"bs_id":"Number: System assigned ID for the base station, used to indicate the schedule is associated with the base station",
"name":"String: Schedule name",
"type":"Number: Schedule type in number. 1 -> Run once at specific action_date and action_time only; 2 -> Run at specific action_time repeatedly",
"action_date":"Date: The specific date of running the action",
"action_time":"Time: The specific time of running the action",
"sun":"Number: Enable / disable the schedule on Sunday. 0 -> Disabled; 1 -> Enabled.",
"mon":"Number: Enable / disable the schedule on Monday. 0 -> Disabled; 1 -> Enabled.",
"tue":"Number: Enable / disable the schedule on Tuesday. 0 -> Disabled; 1 -> Enabled.",
"wed":"Number: Enable / disable the schedule on Wednesday. 0 -> Disabled; 1 -> Enabled.",
"thu":"Number: Enable / disable the schedule on Thursday. 0 -> Disabled; 1 -> Enabled.",
"fri":"Number: Enable / disable the schedule on Friday. 0 -> Disabled; 1 -> Enabled.",
"sat":"Number: Enable / disable the schedule on Saturday. 0 -> Disabled; 1 -> Enabled.",
"control_list":<,br/> [
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},
{
"device_id":"Number: System assigned ID for the App to identify the device",
"status":"String/Number: Device schedule control status. Please refer to System device schedule control status",
},...
]
}
Response {
"result":"String: Result: success/fail",
}

cURL example: curl -d '{"cmd":"setScheduleRequest","scheduleID":0,"bsID":61,"name":"Test scheduler","type":2,"action_date":"2021-05-14","action_time":"13:30:00","sun":0,"mon":1,"tue":1,"wed":1,"thu":1,"fri":1,"sat":0,"controlList":[{"deviceID":19,"status":102},{"deviceID":50,"status":102}],"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


deleteScheduleRequest

Delete a schedule of Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request {
"cmd":"deleteScheduleRequest",
"clientName":"String: Client Name",
"bsID":Number: System assigned ID for the Base Station.
"scheduleID":Number: System assigned ID for the schedule to be deleted.
}
Response {
"result":"String: Result: success/fail",
}

cURL example: curl -d '{"cmd":"deleteScheduleRequest","scheduleID":324,"bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


updateScheduleToBSRequest

Update the schedule settings from server to Base Station. Back to top

HTTP MethodPOST
HeaderAccept: application/json
Content-Type: application/json
Request {
"cmd":"updateScheduleToBSRequest",
"clientName":"String: Client Name",
"bsID":Number: System assigned ID for the Base Station.
}
Response {
"result":"String: Result: success/fail",
}

cURL example: curl -d '{"cmd":"updateScheduleToBSRequest","bsID":61,"clientName":"local_test"}' -H "Content-Type: application/json" -X POST https://api.cgcloud.co/v1.0/


System device type code number

Number to identify different device types in the system. Back to top

Device TypeCode
ON/OFF Lighting0
ON/OFF Switch1
Dimmer2
Curtain Controller3
IR Controller4
Thermostat12
IR AC Controller19
Motion Sensor20
Door Sensor21
CO2 Sensor24
Temperature Sensor26
Humitity Sensor27
Light Sensor28

System device control status

JSON format keys and status values defined for system devices. Back to top

KeyValueSupported Device Type
poweron
off
ON/OFF Lighting
ON/OFF Switch
Dimmer
Thermostat
IR AC Controller
level0-100Dimmer
curtainopen
close
Curtain Controller
irir code index 0-59IR Controller
temperature16-30Thermostat
IR AC Controller
fanhi
mi
lo
Thermostat
IR AC Controller
modefan
dry
cool
IR AC Controller

System sensor status

JSON format keys and status values defined for system sensors. Back to top

KeyValueSupported Device Type
motiontriggered
normal
Motion Sensor
contactclosed
opened
Door Sensor
temperature-10-50Temperature Sensor
humidity10-99Humitity Sensor
light0-200000Light Sensor
co20-10000CO2 Sensor

System device control status

Back to top

Schedule Control StatusCodeSupported Device Type
Dim level0-100Dimmer
Toggle101ON/OFF Lighting
ON/OFF Switch
Dimmer
Thermostat
IR AC Controller
ON102ON/OFF Lighting
ON/OFF Switch
Dimmer
Thermostat
IR AC Controller
OFF103ON/OFF Lighting
ON/OFF Switch
Dimmer
Thermostat
IR AC Controller
Blind Open116Curtain Controller
Blind Close114Curtain Controller

END