All Products
Search
Document Center

Marketplace:Set Devices Property

Last Updated:Apr 07, 2025

Important

DISCLAIMER

Please note that all content presented on this page is provided by Tuya (HK) Limited. Alibaba Cloud makes no representations and warranties, explicit or implied, as to the authenticity or accuracy of any such content, nor makes any guarantee to the condition, quality, durability, performance, reliability, merchantability or fitness for a particular purpose, or non-infringement of any products and/or services made available by Tuya (HK) Limited. 

Call this interface to batch set device attribute values.

Instructions for use

When the TSL function defines the data type as float or double, the corresponding parameter value (even if the value is an integer) carries at least one decimal place. For example, 10.0, 11.1.

Request Parameters

Name

Type

Required

Sample Values

Description

Action

String

Yes

SetDevicesProperty

System defined parameters. Value: SetDevicesProperty.

DeviceName.N

RepeatList

Yes

Light

List of device names to set property values. The number of device names ranges from 1 to 100.

Items

String

Yes

{"Switch":1,"Color":"blue"}

The attribute information to be set. The data format is JSON. Each attribute information is given Identifier and Attribute value (key:value) composition, multiple attributes separated by commas. For example, set two properties of a smart light:

  • The identifier is Switch the switch property of the data type is Bool , the setting value is 1 (On).

  • The identifier is Color the light color property of the data type String , the setting value is blue . The JSON format of the attribute information to be set is as follows: Items={"Switch":1,"Color":"blue"}

ProductKey

String

Yes

A1BwAGV * * * *

The product to which the device for which you want to set the property value belongs ProductKey .

Note: When calling an API, in addition to the API-specific request parameters described in this topic, you must also pass in the common request parameters. For more information about common request parameters, see Common parameters.

Return Data

Name

Type

Sample Values

Description

Code

String

Iot.system.SystemException

The error code returned when the call fails. For more information, see Error codes.

ErrorMessage

String

System Exception

Error information returned when the call fails.

RequestID

String

E55E50B7-40EE-4B6B-8BBE-D3ED55CCF565

The unique identifier generated for this request.

Success

Boolean

True

Indicates whether the call succeeded.

  • True : The call succeeded.

  • False : The call failed.

Example

  • Request Example

curl 'https://si-d6e8d812acb848958054.tuyacloud.com:8686/?Action=SetDevicesProperty&SignatureNonce=50f8bd97342f4414bdffbce9503b3f9b&AccessKeyId=xMr9wgwXQLhv5AUa65o03mcD&DeviceName.1=myTestDevice&SignatureMethod=HMAC-SHA1&Items=%7B%22rain%22%3A3%7D&Timestamp=2024-11-19T10%3A15%3A23Z&ProductKey=k1ymv1DuLfE&Signature=lp3WdUaJABpJbOK0BnUt7e6PKLI%3D'
  • Normal Return Example

{
  "RequestId": "2E19BDAF-0FD0-4608-9F41-82D230CFEE38",
  "Success": true
}