Sets the value of a property for a specified device.


Table 1. Request parameters
Parameter Type Description
params dict The request parameter object. For more information, see the table Parameter descriptions of params.
Table 2. Parameter descriptions of params
Parameter Type Description
productKey String The key of the product to which the device belongs. It is a unique identifier issued by IoT Platform for the product.
deviceName String The name of the device. The device name is generated when the device is created.
payload dict

The property identifiers and the property values to be set.

Log on to the IoT Platform console. On the Define Feature tab of the product details page, click TSL Model to view the identifier of each service.

Table 3. Response parameters
Parameter Type Description
return dict If the call is successful, true is returned. Otherwise, the error message reported by the driver is returned.

Sample requests

The following example sets the LightSwitch property value of the LightDev device to 0. The value 0 indicates the device is switched off.

# -*- coding: utf-8 -*-
import lecoresdk

lesdk = lecoresdk.IoTData()

def handler(event, context):
  set_params = {"productKey": "a1ZJTVs****", # Please replace it with your Product Key.
                "deviceName": "LightDev",    # Please replace it with your Device Name.
                "payload": {"LightSwitch":0}}# The property defined in the Product TSL.
  res = lesdk.setThingProperties(set_params)
  return 'OK'