device.capability.list(查询可用能力)
device.capability.list:查询可用能力
要点:https://openapi.lechange.cn/openapi/v2/device.capability.list · 见 错误码
查询可用能力,含取值说明。按设备查(这台现在能干什么)或按型号查(还没有设备时评估)。本接口不按权限裁清单。
请求参数
| 参数名 | 参数类型 | 是否必填 | 默认值 | 合法值 | 参数说明 |
|---|---|---|---|---|---|
token | String | 是 | 管理员、子用户或子账号 accessToken | ||
deviceId | String | 条件 | 按设备查时传。与 productId 至少传一个 | ||
productId | String | 条件 | 按型号查时传。与 deviceId 至少传一个 | ||
channelId | String | 否 | 通道号,IPC 常见 "0"。不要传 -1 | 只在按设备查时有意义。不传 = 查设备级。传 = 该通道通道级 外加 设备级 | |
lang | String | 否 | 应用站点默认 | 如 zh-CN | 展示文案语言 |
incloudTsl | Boolean | 否 | false | true / false | 为 true 时,叶子 property/service/event 附带绑定 ident/ref 的 tsl 元数据 |
都传 deviceId 与 productId 时以设备为准;型号不一致返回 DV2009。
请求示例
{
"id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
"system": {
"ver": "1.0",
"appId": "lcdxxxxxxxxx",
"sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
"time": 1706511734,
"nonce": "f5a1ae2d-c09c-4d39-a744-83a5c2c653c2"
},
"params": {
"token": "<yourAccessToken>",
"deviceId": "TESTIPC000012345",
"channelId": "0"
}
}
响应字段
| 参数名 | 参数类型 | 参数说明 |
|---|---|---|
deviceId | String | 回显。按型号查时不返回 |
channelId | String | 回显;未传则不返回 |
productId | String | 型号。按设备查时由平台解析回显 |
bindType | String | 型号绑定类型 |
capabilities | Array | 可用能力清单 |
capabilities[].capabilityId | String | 一组能力的 id。仅作响应字段,不要拿去发 get / set / invoke / 查告警;请用下面的整段 propertyId / serviceId / eventId |
capabilities[].name | String | 展示名 |
capabilities[].scope | String | device 设备 / channel 通道 / all 两者都有 |
capabilities[].properties | Array | 配置 / 状态项;无则为 [] |
capabilities[].properties[].propertyId | String | 整段 propertyId |
capabilities[].properties[].name | String | 展示名 |
capabilities[].properties[].desc | String | 说明。空则不返回 |
capabilities[].properties[].accessMode | String | r 只读 / w 只写 / rw 可读写。含 w 才允许 set |
capabilities[].properties[].defaultData | 同点位 | 默认值。无则不返回。开关为 int 0/1 |
capabilities[].properties[].dataType | Object | 取值说明 |
capabilities[].properties[].dataType.type | String | int / float / enum / text / struct / array。公开不出现 bool |
capabilities[].properties[].dataType.specs.range | Array | [下限, 上限],仅数值类型 |
capabilities[].properties[].dataType.specs.list | Array | 枚举项。每项含 value 与 desc |
capabilities[].properties[].tsl | Object | 仅 incloudTsl=true 时出现;含绑定 ident/ref 等 |
capabilities[].services | Array | 一次性动作;无则为 [] |
capabilities[].services[].serviceId | String | 整段 serviceId |
capabilities[].services[].name | String | 展示名 |
capabilities[].services[].inputData | Array | 入参。field 为调用 key。无入参为 [] |
capabilities[].services[].outputData | Array | 出参。无出参为 [] |
capabilities[].services[].timeoutMs | Int | 建议超时 |
capabilities[].services[].tsl | Object | 仅 incloudTsl=true 时出现 |
capabilities[].events | Array | 上报事件;无则为 [] |
capabilities[].events[].eventId | String | 整段 eventId;查询报文里的 msgType 即此值 |
capabilities[].events[].name | String | 展示名 |
capabilities[].events[].outputData | Array | 事件字段。没有则为 [] |
capabilities[].events[].tsl | Object | 仅 incloudTsl=true 时出现 |
struct 子项 key 为 field。某型号实际档位可能是目录子集。
响应示例
{
"id": "d5c287b4-5b2f-4f03-baf5-8032c5c354af",
"result": {
"code": "0",
"msg": "Operation is successful",
"data": {
"deviceId": "TESTIPC000012345",
"channelId": "0",
"productId": "56WGTET2",
"bindType": "paas",
"capabilities": [
{
"capabilityId": "detection.motion",
"name": "动检",
"scope": "channel",
"properties": [
{
"propertyId": "detection.motion.enabled",
"name": "移动检测",
"accessMode": "rw",
"defaultData": 0,
"dataType": {
"type": "int",
"specs": {
"range": [0, 1]
}
}
},
{
"propertyId": "detection.motion.sensitivity",
"name": "灵敏度",
"accessMode": "rw",
"dataType": {
"type": "enum",
"specs": {
"list": [
{ "value": "1", "desc": "低" },
{ "value": "3", "desc": "中" },
{ "value": "5", "desc": "高" }
]
}
}
}
],
"services": [],
"events": [
{
"eventId": "detection.motion.detected",
"name": "移动检测报警",
"outputData": []
}
]
},
{
"capabilityId": "ptz.aim",
"name": "云台瞄准",
"scope": "channel",
"properties": [],
"services": [
{
"serviceId": "ptz.aim.relative",
"name": "按速度转动",
"inputData": [
{
"field": "horizontal",
"name": "水平速度",
"dataType": { "type": "text" }
},
{
"field": "vertical",
"name": "垂直速度",
"dataType": { "type": "text" }
},
{
"field": "zoom",
"name": "变倍",
"dataType": { "type": "text" }
},
{
"field": "duration",
"name": "持续时间",
"dataType": { "type": "int" }
}
],
"outputData": [],
"timeoutMs": 10000
}
],
"events": []
}
]
}
}
}
错误码
本接口可能返回下列码;完整分组见 错误码。
网关与鉴权(SN / TK / OP)
| 错误码 | 错误码说明 | 下一步 |
|---|---|---|
SN1001 | 签名异常 | 按 签名 核对 sign |
TK1002 | token 无效或过期 | 重新获取 token |
OP1002 | 缺少必填参数 | 补必填字段 |
OP1003 | 参数不合法 | 按本页参数表核对 |
OP1039 | 分钟级限流 | 等到下一分钟再试 |
OP1040 | 调用超限 | 降低频率 |
DV1007 | 设备离线或超时 | 等设备上线 |
能力清单(DV20xx)
| 错误码 | 错误码说明 | 下一步 |
|---|---|---|
DV2007 | channelId 与 scope 不符 | 通道级必传,设备级不传 |
DV2009 | productId 与设备实际型号不一致 | 去掉 productId 或改成实际型号 |
DV2012 | 设备不存在 | 核对序列号 |
说明
按设备查(传 deviceId)须设备已绑定,否则 DV2013;按型号查(仅 productId)只验 token。管理员:绑定或被分享设备可查;子用户:自己绑定;子账号:已授权设备。本接口不按权限裁清单。