Device Control

Last Updated on : 2021-09-18 08:41:16download

You can call the following APIs to control your devices.

API operation

Request method API endpoint Description
POST /v1.0/illumination/devices/{deviceId}/dps Control a single device
POST /v1.0/illumination/devices/dps/multidev Control multiple devices
POST /v1.0/illumination/devices/dps/group Control device groups

Control a single device

API description

Control a single device.

API endpoint

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

Request parameter

Name Type Location Description Required
projectId String body Project ID Yes
deviceId String url Device ID Yes
dpCode String body DP code Yes
dpValue String body DP value Yes

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the request is successful.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Parameter of result

{ "message": "Indicate whether the request is successful", "action": "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.

API endpoint

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

Request parameter

Name Type Location Description Required
projectId String body Project ID Yes
deviceIds String[] body A list of device IDs Yes
dpCode String body DP code Yes
dpValue String body DP value Yes

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the request is successful.
  • true: succeeded.
  • false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Parameter of result

{ "message": "Indicate whether the request is successful", "action": "Action" }

Sample request

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

Sample response

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

Control device groups

API description

Control device groups.

API endpoint

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

Request parameter

Name Type Location Description Required
projectId String body Project ID Yes
roomId String body Room ID Yes
dpCode String body DP code Yes
dpValue String body DP value Yes

Return parameter

Name Type Description
code Integer Response code. For more information, see the error code section. It is empty when the operation succeeded.
success Boolean Indicate whether the request is successful.
true: succeeded.
false: failed.
msg String The error message that is returned if the request fails. It is empty if the request is successful.
t Long The returned 13-bit timestamp.
result Object The request result.

Parameter of result

{ "message": "Indicate whether the request is successful", "action": "Action" }

Sample request

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

Sample response

{ "message": "SUCCESS", "action": "Control the device group" }

Error code

The following are common service exceptions for this API. For more exception errors, see Error Code.

Error code Description
500 The error message is returned because a system error has occurred.
1106 The error message is returned because you are not authorized to make the API request.