Skip to content

获取子设备列表

主设备下,可连接一个或多个子设备,通过该接口获取所有子设备信息。

https://agri-dl.holdingbyte.com/api/device/{{device_id}}/subdevices/

请求方法

GET

请求参数

返回数据

字段类型说明
agri_idstring内部id
the_typeint设备类型,详情

数据示例:

json
[
    {
        "agri_id": "d-1000-yczqcwxdjptw-1-00",
        "the_type": 2001,
        "the_type_display": "温度传感器"
    },
    {
        "agri_id": "d-1000-yczqcwxdjptw-1-01",
        "the_type": 2002,
        "the_type_display": "湿度传感器"
    },
    {
        "agri_id": "d-1000-yczqcwxdjptw-2-00",
        "the_type": 2013,
        "the_type_display": "光照度传感器"
    },
    {
        "agri_id": "d-1000-yczqcwxdjptw-3-00",
        "the_type": 2005,
        "the_type_display": "大气压传感器"
    }
]

示例代码

python

import requests
import json

device_id = "861714053848887"
# 请求token
token = "hvduasqoqnbtscaiumzsgpjewxkrgupq"


url = f"https://agri-dl.holdingbyte.com/api/device/{device_id}/subdevices/"

payload = {}
headers = {
  'token': token,
  'Content-Type': 'application/json'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)