You can call this operation to query device groups by tags.

Limits

If you specify multiple tags, this operation returns a list of devices that match all the specified tags.

getThingsWithTags(params)

Table 1. Request parameters
Parameter Type Description
params dict The parameter object. For more information, see the table Parameter descriptions of params.
Table 2. Parameter descriptions of params
Parameter Type Description
payload List The array of tag information. The array consists of {<tag name>:<tag value>} key-value pairs.
Table 3. Response parameters
Parameter Type Description
return dict If the call is successful, the property values of the device are returned. Otherwise, the error message reported by the device driver is returned.

Sample requests

The following example queries devices that have the tag location: master bedroom.

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

lesdk = lecoresdk.IoTData()

def handler(event, context):
  get_params = {"payload": [{"location":"master bedroom"}]}
  res = lesdk.getThingsWithTags(get_params)
  print(res)
  for device in res:
    print("device_%s: PK=%s DN=%s" % (res.index(device) + 1, device['productKey'], device['deviceName']))
  return 'OK'