Template Recommendation

Last Updated on : 2023-01-17 03:42:44download

Recommend built-in system templates, including some dynamic templates.

Request method API Description
GET /v1.0/iot-02/smart/template-generate/t1 Generate a dynamic template for auto on/off scenes
GET /v1.0/iot-02/smart/template-generate/t2 Generate a dynamic template for brightness adjustment scenes

Template for auto on/off scenes

Functional description

Generate a dynamic template for auto on/off scenes of devices.

API endpoint

GET /v1.0/iot-02/smart/template-generate/t1

Request parameters

Parameter Type Parameter type Description Required
roomId String body The ID of the specified space. Yes
pid String body The product ID. No
deviceName String body The device name. No
devicePurpose String body The device purpose. No
anyMatch boolean body true: Match any condition to run a smart scene
false: Match all conditions to run a smart scene
No
switchLed boolean body true: on
false: off
Yes

Return parameters

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

Description of result

String // The ID of the generated scene linkage

Sample request

{
  "devicePurpose": "atmosphereLighting",
  "pid": "sosdczdl",
  "switchLed": true,
  "deviceName": "xxxxxx",
  "anyMatch": true
}

Sample response

FmMICDM7JtFuUIBC

Template for brightness adjustment scenes

Functional description

Generate a dynamic template for brightness adjustment scenes.

API endpoint

GET /v1.0/iot-02/smart/template-generate/t2

Request parameters

Parameter Type Parameter type Description Required
roomId String body The ID of the specified space. Yes
pid String body The product ID. No
deviceName String body The device name. No
devicePurpose String body The device purpose. No
anyMatch boolean body true: Match any condition to run a smart scene
false: Match all conditions to run a smart scene
No
brightValue int body The brightness value. Yes

Return parameters

Same as above.

Sample request

{
  "brightValue": 500,
  "pid": "sosdczdl",
  "deviceName": "xxxxxxxx",
  "anyMatch": true
}

Error codes

The following table lists common error codes for the API calls. For more information, see Global Error Codes.

Error code Description
500 A system error has occurred while processing your request.
1106 The error message is returned because you are unauthorized to make the API request.