设备查询

更新时间:2023-01-12 07:14:57下载pdf

设备管理 API 接口

请求方式 API 描述
GET /v1.0/iot-02/building/device/secondary-menus 查询二级菜单
GET /v1.0/iot-02/building/devices 获取设备列表
GET /v1.0/iot-02/building/device-running-detail 获取设备运行详情
GET /v1.0/iot-02/building/device-detail 获取设备详情
GET /v1.0/iot-02/building/device/tendency-types 获取设备支持的趋势图指标列表
GET /v1.0/iot-02/building/device/tendency 获取设备某个指标的趋势图
POST /v1.0/iot-02/building/device/actions/update-name 更改设备名称

查询二级菜单

功能描述

查询二级菜单。

接口地址

GET /v1.0/iot-02/building/device/secondary-menus

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。 true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

[
  {
    "code": "String //品类",
    "name": "String //品类名称",
    "order": "int //次序"
  }
]

请求示例

{
  "projectId": "1424615984265764***"
}

响应示例

{
    "result": [
        {
            "code": "zm",
            "name": "照明系统",
            "order": 1
        },
        {
            "code": "lryxt",
            "name": "冷热源系统",
            "order": 2
        },
        {
            "code": "spfxt",
            "name": "送排风系统",
            "order": 3
        }
    ],
    "success": true,
    "t": 1662708298644,
    "tid": "8252c477301011edaf4dfa23c521f7ba"
}

获取设备列表

功能描述

获取设备列表。

接口地址

GET /v1.0/iot-02/building/devices

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID true
topCategories String[] body 一级品类列表 false
categories String[] body 二级品类列表 false
categoryCodes String[] body 三级品类列表 false
page int body 页数 false
pageSize int body 页面数量 false
deviceStatus String[] body 设备状态筛选列表 false
deviceTypes int[] body 设备类型 false
roomId String body 房间ID false
deviceName String body 设备名称 false
online boolean body 在线状态:离线,在线 true

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

{
  "total": "int",
  "list": [
    {
      "deviceSaasId": "String //设备SaaS唯一ID",
      "deviceId": "String //设备ID,和硬件设备一一对应,由于设备重新绑定点位,导致在这里不唯一",
      "deviceName": "String //设备名称",
      "deviceType": "String //设备类型,详见DeviceTypeEnum",
      "deviceTypeValue": "int //设备类型,详见DeviceTypeEnum",
      "topCategory": "String //产品所属大级分类。      详见 ProductCategoryEnum 的类型说明",
      "capability": "String //设备能力 /分割",
      "devicePower": "double //设备功率",
      "deviceStatus": "String //设备状态,详见DeviceAlarmTypeEnum",
      "alarmDpValue": "String //报警的dpValue",
      "deviceStatuses": "String[] //设备状态,详见AlarmTypeEnum",
      "installTime": "long //设备安装时间",
      "activeTime": "long //设备活跃时间",
      "productId": "String //设备品类(产品)ID",
      "roomId": "String //设备所属房间ID",
      "roomName": "String //设备所属房间名称",
      "pointId": "String //设备所在点位ID",
      "ownerId": "String //所属设备家庭组ID",
      "switchInfo": [
        {
          "deviceId": "String //智能开关设备ID",
          "dpCode": "String //智能开关设备通道"
        }
      ],
      "properties": [
        {
          "dpId": "String //DP点ID",
          "dpCode": "String //DP点代码",
          "dpName": "String //DP点名称",
          "dpValue": "String //DP当前值",
          "property": {
            "range": "String[] //描述属性值的取值范围"
          },
          "propertyDetail": {},
          "mode": "String //mode模式 例如 ro,rw  1.4.3新增",
          "dpFrom": "String //dp来源"
        }
      ],
      "masterGroupJoinStatus": "int //主群组加入状态,0表示未加入,1表示已加入,2未加入群组的非照明设备",
      "currentBrightness": "int //设备所属房间的亮度阈值",
      "supportGroup": "boolean //是否支持群组",
      "switchStatus": "boolean //开关状态",
      "switchDpCode": "String //开关dpCode",
      "colourValue": "String //颜色值",
      "brightPercentValue": "String //亮度百分比值",
      "pointDeviceType": "int //点位图上设备类型",
      "switchCount": "int",
      "dpFrom": "String",
      "devicePurpose": {
        "id": "String //id",
        "name": "String //名称",
        "code": "String //code"
      },
      "industryPurpose": {
        "id": "String //id",
        "name": "String //名称",
        "code": "String //code"
      },
      "x": "String //点位x轴坐标",
      "y": "String //点位y轴坐标",
      "category": "String //产品所属二级分类",
      "categoryCode": "String //产品所属三级分类",
      "vasType": "String //增值服务      设备类型逻辑"
    }
  ]
}

请求示例

{
  "pageSize": "数量",
  "online": "在线状态:-离线;-在线",
  "categories": "二级品类列表",
  "page": "页数",
  "projectId": "项目id",
  "topCategories": "一级品类列表",
  "categoryCodes": "三级品类列表",
  "deviceName": "设备名称",
  "roomId": "房间id",
  "deviceStatus": "设备状态筛选列表"
}

响应示例

{
    "result": {
        "list": [
            {
                "capability": "cable",
                "category": "gpsxt",
                "category_code": "gpsxt_8c_4",
                "current_brightness": 0,
                "device_id": "vdevo163722119778504",
                "device_name": "污水井(双泵)-vdevo",
                "device_power": 0,
                "device_saas_id": "sa32108759772376064",
                "device_status": "normal",
                "device_statuses": [
                    "normal"
                ],
                "device_type": "other",
                "device_type_value": -1,
                "install_time": 1637221198107,
                "master_group_join_status": 2,
                "owner_id": "38696291",
                "point_id": "1496296555412570121",
                "product_id": "khmasinj4tbc3qen",
                "properties": [
                    {
                        "dp_code": "pump",
                        "dp_id": "1",
                        "dp_name": "水泵开关1",
                        "dp_value": "false",
                        "mode": "rw",
                        "property": {
                            "range": []
                        },
                        "property_detail": {
                            "type": "bool"
                        }
                    },
                    {
                        "dp_code": "fault",
                        "dp_id": "7",
                        "dp_name": "污水井故障告警",
                        "dp_value": "0",
                        "mode": "ro",
                        "property": {
                            "range": []
                        },
                        "property_detail": {
                            "label": [
                                "fault",
                                "pump_alarm_1",
                                "pump_alarm_2",
                                "water_low",
                                "water_low_max",
                                "water_high",
                                "water_high_max"
                            ],
                            "maxlen": 7,
                            "type": "bitmap"
                        }
                    }
                ],
                "room_id": "1424637504585277440",
                "room_name": "8楼",
                "switch_dp_code": "switch",
                "switch_info": [],
                "switch_status": true,
                "top_category": "qt"
            } ],
        "total": 9
    },
    "success": true,
    "t": 1662708352045,
    "tid": "a22a2a8b301011edaf4dfa23c521f7ba"
}

获取设备运行详情

功能描述

获取设备运行详情。

接口地址

GET /v1.0/iot-02/building/device-running-detail

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false
deviceSaasId String body 设备ID false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

{
  "device": {
    "deviceSaasId": "String //设备SaaS唯一ID",
    "deviceId": "String //设备ID,和硬件设备一一对应,由于设备重新绑定点位,导致在这里不唯一",
    "deviceName": "String //设备名称",
    "deviceType": "String //设备类型,详见DeviceTypeEnum",
    "deviceTypeValue": "int //设备类型,详见DeviceTypeEnum",
    "topCategory": "String //产品所属大级分类。详见 ProductCategoryEnum 的类型说明",
    "capability": "String //设备能力 /分割",
    "devicePower": "double //设备功率",
    "deviceStatus": "String //设备状态,详见DeviceAlarmTypeEnum",
    "alarmDpValue": "String //报警的dpValue",
    "deviceStatuses": "String[] //设备状态,详见AlarmTypeEnum",
    "installTime": "long //设备安装时间",
    "activeTime": "long //设备活跃时间",
    "productId": "String //设备品类(产品)ID",
    "roomId": "String //设备所属房间ID",
    "roomName": "String //设备所属房间名称",
    "pointId": "String //设备所在点位ID",
    "ownerId": "String //所属设备家庭组ID",
    "switchInfo": [
      {
        "deviceId": "String //智能开关设备ID",
        "dpCode": "String //智能开关设备通道"
      }
    ],
    "properties": [
      {
        "dpId": "String //DP点ID",
        "dpCode": "String //DP点代码",
        "dpName": "String //DP点名称",
        "dpValue": "String //DP当前值",
        "property": {
          "range": "String[] //描述属性值的取值范围"
        },
        "propertyDetail": {},
        "mode": "String //mode模式 例如 ro,rw  1.4.3新增",
        "dpFrom": "String //dp来源"
      }
    ],
    "masterGroupJoinStatus": "int //主群组加入状态,0表示未加入,1表示已加入,2未加入群组的非照明设备",
    "currentBrightness": "int //设备所属房间的亮度阈值",
    "supportGroup": "boolean //是否支持群组",
    "switchStatus": "boolean //开关状态",
    "switchDpCode": "String //开关dpCode",
    "colourValue": "String //颜色值",
    "brightPercentValue": "String //亮度百分比值",
    "pointDeviceType": "int //点位图上设备类型",
    "switchCount": "int",
    "dpFrom": "String",
    "devicePurpose": {
      "id": "String //id",
      "name": "String //名称",
      "code": "String //code"
    },
    "industryPurpose": {
      "id": "String //id",
      "name": "String //名称",
      "code": "String //名称"
    },
    "x": "String //点位x轴坐标",
    "y": "String //点位y轴坐标",
    "category": "String //产品所属二级分类",
    "categoryCode": "String //产品所属三级分类",
    "vasType": "String //增值服务      设备类型逻辑"
  },
  "operationData": {
    "cumulates": [
      {
        "dpId": "String //DP点ID",
        "dpCode": "String //DP点代码",
        "dpName": "String //DP点名称",
        "needClean": "boolean //是否需要清除",
        "dpValue": "String //DP值",
        "unit": "String //单位",
        "value": {
          "cumulateType": "String //累计值类型",
          "cumulateName": "String //累计值名称",
          "cumulateValue": "String //累计值",
          "unit": "String //单位,如:小时"
        }
      }
    ],
    "tendency": {
      "dpId": "String //DP点ID",
      "dpCode": "String //DP点代码",
      "dpName": "String //DP点名称",
      "unit": "String //单位",
      "values": [
        {
          "timestamp": "String //时间戳",
          "index": "int //下标",
          "value": "String //DP值",
          "unit": "String //单位"
        }
      ]
    }
  }
}

请求示例

{
    "projectId":"1424615984265764***",
    "deviceSaasId":"sa32108760059423***"
}

响应示例

{
    "result": {
        "device": {
            "category": "ktxt",
            "category_code": "ktxt_8c_2",
            "current_brightness": 0,
            "device_id": "vdevo163722119881***",
            "device_name": "设备A",
            "device_power": 0,
            "device_saas_id": "sa32108760059423***",
            "device_status": "normal",
            "device_statuses": [
                "normal"
            ],
            "device_type": "other",
            "device_type_value": -1,
            "install_time": 1637221199201,
            "owner_id": "38696291",
            "point_device_type": -1,
            "point_id": "1554371132805677059",
            "product_id": "ucd1j2d6masys2jq",
            "properties": [
            ],
            "room_id": "1424637349790294016",
            "switch_dp_code": "switch",
            "switch_info": [],
            "switch_status": true,
            "top_category": "qt"
        },
        "operation_data": {
            "cumulates": [
                {
                    "dp_code": "runtime_today",
                    "dp_name": "今日开启时长",
                    "dp_value": "15.57",
                    "need_clean": false,
                    "unit": "h"
                },
                {
                    "dp_code": "runtime_all",
                    "dp_name": "累计运行时长",
                    "dp_value": "3046.60",
                    "need_clean": false,
                    "unit": "h"
                },
                {
                    "dp_code": "first_filter_switch",
                    "dp_name": "初效过滤网累计使用时长",
                    "dp_value": "0.00",
                    "need_clean": true,
                    "unit": "h"
                },
                {
                    "dp_code": "fan_filter_switch",
                    "dp_name": "风机滤网累计使用时长",
                    "dp_value": "0.00",
                    "need_clean": true,
                    "unit": "h"
                }
            ],
            "tendency": {
                "dp_id": "null",
                "unit": "",
                "values": [
                    {
                        "index": 10,
                        "timestamp": "2022-09-09 10:00",
                        "value": "0.00"
                    },
                    {
                        "index": 1,
                        "timestamp": "2022-09-09 01:00",
                        "value": "0.00"
                    },
                    {
                        "index": 12,
                        "timestamp": "2022-09-09 12:00",
                        "value": "0.00"
                    },
                    {
                        "index": 0,
                        "timestamp": "2022-09-09 00:00",
                        "value": "0.00"
                    },
                    {
                        "index": 11,
                        "timestamp": "2022-09-09 11:00",
                        "value": "0.00"
                    },
                    {
                        "index": 3,
                        "timestamp": "2022-09-09 03:00",
                        "value": "0.00"
                    },
                    {
                        "index": 14,
                        "timestamp": "2022-09-09 14:00",
                        "value": "0.00"
                    },
                    {
                        "index": 2,
                        "timestamp": "2022-09-09 02:00",
                        "value": "0.00"
                    },
                    {
                        "index": 13,
                        "timestamp": "2022-09-09 13:00",
                        "value": "0.00"
                    }
                ]
            }
        }
    },
    "success": true,
    "t": 1662708591072,
    "tid": "308b5c71301111edaf4dfa23c521f7ba"
}

获取设备详情

功能描述

获取单个设备的详细信息。

接口地址

GET /v1.0/iot-02/building/device-detail

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false
deviceSaasId String body 设备ID false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

参照设备列表。

请求示例

{
  "deviceSaasId": "设备ID",
  "projectId": "项目ID"
}

响应示例
参照设备列表。

获取设备支持的趋势图指标列表

功能描述

获取设备支持的趋势图指标列表。

接口地址

GET /v1.0/iot-02/building/device/tendency-types

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false
deviceId String body 设备ID false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

{
  "tendencies": [
    {
      "dpId": "String //DP点ID",
      "dpCode": "String //DP点代码",
      "dpName": "String //DP点名称",
      "unit": "String //单位",
      "values": [
        {
          "timestamp": "String //时间戳",
          "index": "int //下标",
          "value": "String //DP值",
          "unit": "String //单位"
        }
      ]
    }
  ]
}

请求示例

{
    "projectId":"1424615984265764***",
    "deviceId":"vdevo163722119881***"
}

响应示例

{
    "result": {
        "tendencies": [
            {
                "dp_code": "fre_conversion_return",
                "dp_id": "5",
                "dp_name": "送风机变频器频率反馈",
                "unit": "%"
            },
            {
                "dp_code": "switch_state",
                "dp_id": "6",
                "dp_name": "送风机运行状态",
                "unit": ""
            },
            {
                "dp_code": "hum_valve_return",
                "dp_id": "9",
                "dp_name": "加湿阀调节反馈",
                "unit": "%"
            },
            {
                "dp_code": "water_valve_return",
                "dp_id": "11",
                "dp_name": "水阀开度调节反馈",
                "unit": "%"
            },
            {
                "dp_code": "ai_freshair_valve_return",
                "dp_id": "13",
                "dp_name": "新风阀开度调节反馈",
                "unit": "%"
            },
            {
                "dp_code": "temp_fresh",
                "dp_id": "14",
                "dp_name": "新风温度检测",
                "unit": "℃"
            },
            {
                "dp_code": "humidity_fresh",
                "dp_id": "15",
                "dp_name": "新风湿度检测",
                "unit": "%"
            },
            {
                "dp_code": "antifreeze",
                "dp_id": "16",
                "dp_name": "防冻开关检测",
                "unit": ""
            },
            {
                "dp_code": "first_filter_switch",
                "dp_id": "17",
                "dp_name": "初效过滤网报警",
                "unit": ""
            },
            {
                "dp_code": "fan_filter_switch",
                "dp_id": "18",
                "dp_name": "风机滤网报警",
                "unit": ""
            },
            {
                "dp_code": "supply_temp",
                "dp_id": "20",
                "dp_name": "送风温度",
                "unit": "℃"
            },
            {
                "dp_code": "humidity_supply",
                "dp_id": "21",
                "dp_name": "送风湿度",
                "unit": "%"
            },
            {
                "dp_code": "ico2_ndoor_value",
                "dp_id": "22",
                "dp_name": "CO2检测",
                "unit": "ppm"
            },
            {
                "dp_code": "voc_indoor_value",
                "dp_id": "23",
                "dp_name": "室内VOC",
                "unit": "ppm"
            },
            {
                "dp_code": "switch",
                "dp_id": "1",
                "dp_name": "开关",
                "unit": ""
            },
            {
                "dp_code": "temp_set",
                "dp_id": "2",
                "dp_name": "温度设置",
                "unit": "℃"
            },
            {
                "dp_code": "eco2_set",
                "dp_id": "3",
                "dp_name": "CO2检测值设定",
                "unit": "ppm"
            },
            {
                "dp_code": "frequency_conversion",
                "dp_id": "4",
                "dp_name": "送风机变频频率",
                "unit": "%"
            },
            {
                "dp_code": "hum_valve_value",
                "dp_id": "8",
                "dp_name": "加湿阀调节",
                "unit": "%"
            },
            {
                "dp_code": "water_valve_value",
                "dp_id": "10",
                "dp_name": "水阀开度调节",
                "unit": "%"
            },
            {
                "dp_code": "freshair_valve_value",
                "dp_id": "12",
                "dp_name": "新风阀开度调节",
                "unit": "%"
            }
        ]
    },
    "success": true,
    "t": 1662708811310,
    "tid": "b4068ad6301111edaf4dfa23c521f7ba"
}

获取设备某个指标的趋势图

功能描述

获取设备某个指标的趋势图。

接口地址

GET /v1.0/iot-02/building/device/tendency

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false
deviceId String body 设备ID false
dpId String body DP ID false
dpCode String body DP code false
dpName String body DP name false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

{
  "tendency": {
    "dpId": "String //DP点ID",
    "dpCode": "String //DP点代码",
    "dpName": "String //DP点名称",
    "unit": "String //单位",
    "values": [
      {
        "timestamp": "String //时间戳",
        "index": "int //下标",
        "value": "String //DP值",
        "unit": "String //单位"
      }
    ]
  }
}

请求示例

{
    "projectId":"1424615984265764***",
    "deviceId":"vdevo163722119881***",
    "dpId": "5"
}

响应示例

{
    "result": {
        "tendency": {
            "dp_id": "null",
            "unit": "",
            "values": [
                {
                    "index": 10,
                    "timestamp": "2022-09-09 10:00",
                    "value": "0.00"
                },
                {
                    "index": 1,
                    "timestamp": "2022-09-09 01:00",
                    "value": "0.00"
                },
                {
                    "index": 12,
                    "timestamp": "2022-09-09 12:00",
                    "value": "0.00"
                },
                {
                    "index": 0,
                    "timestamp": "2022-09-09 00:00",
                    "value": "0.00"
                },
                {
                    "index": 11,
                    "timestamp": "2022-09-09 11:00",
                    "value": "0.00"
                },
                {
                    "index": 3,
                    "timestamp": "2022-09-09 03:00",
                    "value": "0.00"
                },
                {
                    "index": 14,
                    "timestamp": "2022-09-09 14:00",
                    "value": "0.00"
                },
                {
                    "index": 2,
                    "timestamp": "2022-09-09 02:00",
                    "value": "0.00"
                },
                {
                    "index": 13,
                    "timestamp": "2022-09-09 13:00",
                    "value": "0.00"
                },
                {
                    "index": 5,
                    "timestamp": "2022-09-09 05:00",
                    "value": "0.00"
                },
                {
                    "index": 4,
                    "timestamp": "2022-09-09 04:00",
                    "value": "0.00"
                },
                {
                    "index": 15,
                    "timestamp": "2022-09-09 15:00",
                    "value": "0.00"
                },
                {
                    "index": 7,
                    "timestamp": "2022-09-09 07:00",
                    "value": "0.00"
                },
                {
                    "index": 6,
                    "timestamp": "2022-09-09 06:00",
                    "value": "0.00"
                },
                {
                    "index": 9,
                    "timestamp": "2022-09-09 09:00",
                    "value": "0.00"
                },
                {
                    "index": 8,
                    "timestamp": "2022-09-09 08:00",
                    "value": "0.00"
                }
            ]
        }
    },
    "success": true,
    "t": 1662708871291,
    "tid": "d7d20c4c301111edaf4dfa23c521f7ba"
}

更改设备名称

功能描述

更改设备名称。

接口地址

POST /v1.0/iot-02/building/device/actions/update-name

请求参数

参数名 类型 参数类型 说明 是否必需
projectId String body 项目ID false
deviceSaasId String body 设备saasId false
deviceName String body 设备名称 false

返回参数

参数名 类型 说明
code Integer 响应码(详情见错误码章节),成功时为空
success Boolean 是否成功。true:成功,false:失败
msg String 请求失败的信息,成功时为空
t Long 返回时间戳,13 位
result Object 返回结果

result 参数说明

boolean{}

请求示例

{
    "projectId":"1424615984265764***",
    "deviceSaasId":"sa32108760059423***",
    "deviceName": "设备A"
}

响应示例

boolean{}

错误码

以下为该接口常见的业务异常。更多的异常错误,请参见全局错误码。

错误码 说明
500 系统错误