All Products
Search
Document Center

Marketplace:Device Expected Attribute Value

Last Updated:Mar 25, 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. 

The cloud can call the SetDeviceDesiredProperty interface to set the desired attribute value to control the device. After setting the device's desired property values in the cloud, if the device is online, the device property status will be updated in real time; if the device is offline, the expected attribute value is cached in the cloud. After the device is online, the expected attribute value is obtained and the attribute status is updated. This article describes the data format for the expected property value of the device.

Equipment Online when the device is online, set the expected property value of the device on the cloud, and the cloud will directly deliver it to the device. Topic and data format (downlink):

Data Format (Downstream)

Request and response topics

JSON

●Request Topic: /sys/${ProductID}/${HardwareID}/thing/service/property/set ●Response Topic: /sys/${ProductID}/${HardwareID}/thing/service/property/set_reply

Request data format:

{
    "id": "123",
    "version": "1.0",
    "params": {
        "temperature": "30.5"
    },
    "method": "thing.service.property.set"
}

Response data format: ●Successful return example

{
    "code": 200,
    "data": {},
    "id": "123",
    "message": "success",
    "version": "1.0"
}

Parameter description:

Parameters

Type

Description

ID

String

The message ID is a String type number. The value range is 0 to 4294967295, and each message ID is unique in the current device.

Version

String

The protocol version number. Currently, the only value of the protocol version number is 1.0.

Params

Object

Property to set parameters. Set the property as in the example above: {"temperature": "30.5"} .

Method

String

The request method. For example: thing.service.property.set

Response data format:

Parameters

Type

Description

ID

String

The message ID is a String type number. The value range is 0 to 4294967295, and each message ID is unique in the current device.

Code

Integer

Result status code, specific reference Common codes on devices.

Data

Object

When the request is successful, the returned data is fixed to be empty.

Message

String

Returns the result information. If the request is successful, return success.

Version

String

The protocol version number, which corresponds to the request parameter version same.

Get the expected property value Upstream (JSON). The device requests the cloud to obtain the expected value of the device attribute. ●Request Topic: /sys/${ProductID}/${HardwareID}/thing/property/desired/get . ●Response Topic: /sys/${ProductID}/${HardwareID}/thing/property/desired/get_reply . Request data format:

{
    "id" : "123",
    "version":"1.0",
    "sys":{
      "ack":0
  },
    "params" : [
        "power",
        "temperature"
    ],
    "method":"thing.property.desired.get"
}

Response data format:

{
    "id":"123",
    "code":200,
    "data":{
        "power": {
            "value": "on",
            "version": 2
        }
    }
}

Table 1. Request parameter description

Parameters

Type

Description

ID

String

Message ID number. A number of the String type. The value range is from 0 to 4294967295, and each message ID is unique in the current device.

Version

String

The protocol version number. Currently, the only value of the protocol version number is 1.0.

SYS

Object

The parameter of the extended function, which contains each function field.

ACK

Integer

SYS indicates whether to return response data. ●1: The cloud returns response data. ●0: The cloud does not return response data.

Params

List

A list of attribute identifiers to obtain the expected value. The identifiers for two properties are listed in the example:

Method

String

Request method, valuething.property.desired.get .

Table 2. Return parameter descriptions

Parameters

Type

Description

ID

String

Message ID number. A number of the String type. The value range is from 0 to 4294967295, and each message ID is unique in the current device.

Code

Integer

Result information, specific reference Common codes on devices.

Data

Object

Expected value information returned. In the example, the expected value data of the attribute power is returned, including the expected value. value and current expected version version .

Table 3. data

Parameters

Type

Description

Key

String

The key is the identifier of the property. power in the example.

Value

Object

Expected property value.

Version

Integer

The version of the current expected property value.

Clear Expected Attribute Value Upstream (JSON). The device clears the desired attribute value of the cloud device. ●Request Topic: /sys/${ProductID}/${HardwareID}/thing/property/desired/delete . ●Response Topic: /sys/${ProductID}/${HardwareID}/thing/property/desired/delete_reply . Request data format:

{
    "id": "123",
    "version": "1.0",
    "sys":{
      "ack":0
  },
    "params": {
        "power": {
            "version": 1
        },
        "temperature": { }
    },
    "method":"thing.property.desired.delete"  
}

Response data format:

{
    "id": "123",
    "code": 200,
    "data": { }
}

Table 4. Request parameter description

Parameters

Type

Description

ID

String

Message ID number. A number of the String type. The value range is from 0 to 4294967295, and each message ID is unique in the current device.

Version

String

The protocol version number. Currently, the only value of the protocol version number is 1.0.

SYS

Object

The parameter of the extended function, which contains each function field.

ACK

Integer

SYS indicates whether to return response data. ●1: The cloud returns response data. ●0: The cloud does not return response data.

Params

Object

List of attribute information to clear the expected value. The incoming data contains the identifier and expected version of the property version .

Method

String

Request method, value thing.property.desired.delete .

Table 5. params

Parameters

Type

Description

Key

String

The key is the identifier of the property. As in the example, two property identifiers, power and temperature, are listed.

Version

Integer

The version number of the desired property value to remove.

Table 6. Return parameter description

Parameters

Type

Description

ID

String

Message ID number. A number of the String type. The value range is from 0 to 4294967295, and each message ID is unique in the current device.

Code

Integer

Result information, specific reference Common codes on devices.

Data

Object

Returns data. When the expected attribute value is cleared, the returned data is empty.