Device Control

Last Updated on : 2024-08-28 06:27:49download

You can call the following APIs to control your devices.

API list

Request method API endpoint Description
POST /v1.0/illumination/devices/{deviceId}/dps Controls a single device.
POST /v1.0/illumination/devices/dps/multidev Controls multiple devices.
POST /v1.0/illumination/devices/dps/group Controls a device group.
POST /v1.0/cloud/illume/device/send/query-state-cmd Reports data point (DP) status.

Control a single device

API description

Control a single device based on its ID.

API endpoint

POST /v1.0/illumination/devices/{deviceId}/dps

Request parameters

Parameter Data type Parameter type Description Required
projectId String Body The project ID. Yes
deviceId String URL The device ID. Yes
dpCode String Body The DP code. Yes
dpValue String Body The DP value. Yes

Response parameters

Parameter Type Description
code Integer The response code. It is empty if the request succeeds. For more information, see Error codes.
success Boolean Indicates whether the request succeeds. Valid values:
  • true: succeeded
  • false: failed
msg String The error message. It is empty if the request succeeds.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "message": "Indicates whether the request succeeds.",
  "action": "The action."
}

Sample request

{
  "dpValue": "The DP value.",
  "dpCode": "The DP code.",
  "projectId": "The project ID.",
  "deviceId": "The device ID."
}

Sample response

{
 "message": "SUCCESS",
 "action": "Control a single device."
}

Control multiple devices

API description

Control multiple devices based on a list of device IDs.

API endpoint

POST /v1.0/illumination/devices/dps/multidev

Request parameters

Parameter Data type Parameter type Description Required
projectId String Body The project ID. Yes
deviceIds String[] Body The list of device IDs. Yes
dpCode String Body The DP code. Yes
dpValue String Body The DP value. Yes

Response parameters

Parameter Type Description
code Integer The response code. It is empty if the request succeeds. For more information, see Error codes.
success Boolean Indicates whether the request succeeds. Valid values:
  • true: succeeded
  • false: failed
msg String The error message. It is empty if the request succeeds.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "message": "Indicates whether the request succeeds.",
  "action": "The action."
 }

Sample request

{
  "dpValue": "",
  "workMode": "",
  "dpCode": "",
  "projectId": ""
}

Sample response

{
  "message": "SUCCESS",
  "action": "Control multiple devices."
}

Control a device group

API description

Control a device group.

API endpoint

POST /v1.0/illumination/devices/dps/group

Request parameters

Parameter Data type Parameter type Description Required
projectId String Body The project ID. Yes
roomId String Body The room ID. Yes
dpCode String Body The DP code. Yes
dpValue String Body The DP value. Yes

Response parameters

Parameter Type Description
code Integer The response code. It is empty if the request succeeds. For more information, see Error codes.
success Boolean Indicates whether the request succeeds. Valid values:
  • true: succeeded
  • false: failed
msg String The error message. It is empty if the request succeeds.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  "message": "Indicates whether the request succeeds.",
  "action": "The action."
}

Sample request

{
  "dpValue": "",
  "workMode": "",
  "dpCode": "",
  "projectId": "",
  "roomId": ""
}

Sample response

{
  "message": "SUCCESS",
  "action": "Control a device group."
}

Report DP status

API description

Enable the specified device to proactively report DP status.

API endpoint

POST /v1.0/cloud/illume/device/send/query-state-cmd

Request parameters

Parameter Data type Parameter type Description Required
deviceId String Body The device ID. Yes
dpCodes List Body The list of DP codes. No

Response parameters

Parameter Type Description
code Integer The response code. It is empty if the request succeeds. For more information, see Error codes.
success Boolean Indicates whether the request succeeds. Valid values:
  • true: succeeded
  • false: failed
msg String The error message. It is empty if the request succeeds.
t Long The returned 13-digit timestamp.
result Object The returned result.

Description of result

{
  true/false
}

Sample request

{
  "deviceId": "",
  "dpCodes": [
    "add_ele",
    "runtime"
  ]
}

Sample response

{
  "result": true,
  "success": true,
  "t": 1717673899783,
  "tid": "d9517952c7579d3d"
}


Error codes

The following table lists the error codes that might be returned when you call these APIs. For more information, see Global Error Codes.

Error code Description
500 A system error occurred.
1106 No permission.