设备配网接口

获取设备入网bindKey

  • 接口intent:query.device.bindKey
  • 接口描述:本接口主要用于网关设备配网,需要结合设备配网SDK来执行。
  • 请求参数:
名称 类型 是否必须 描述
positionId String 位置id,为空取默认位置
connectType String 默认为lumi
  • 请求示例:
{
    "intent": "query.device.bindKey",
    "data": {
        "positionId": "real2.768799734306242560",
        "connectType": "lumi"
    }
}
  • 响应参数:
名称 类型 描述
bindKey String 入网凭证获取,有效时间10分钟(16位字符串[0-9a-zA-Z])
  • 响应示例:
{
    "code": 0,
    "message": "Success",
    "requestId": "",
    "result": {
        "bindKey": "lumioJuiDuNm9rpj"
    }
}

查询设备入网状态

  • 接口intent:query.device.bind
  • 接口描述:本接口与“query.device.bindKey”搭配使用,用于查询网关设备的实际入网状态。
  • 请求参数:
名称 类型 是否必须 描述
bindKey String 入网凭证获取,有效时间10分钟(16位字符串[0-9a-zA-Z])
  • 请求示例:
{
    "intent": "query.device.bind",
    "data": {
        "bindKey": "lumiuK68vu9IYBAB"
    }
}
  • 返回参数
名称 类型 描述
code Int 0:入网成功;1:绑定中,2:非法设备
parentDid String 网关id
firmwareVersion String 网关固件版本
createTime String 创建时间
updateTime String 入网时间
model String 物模型
modelType Int 1:可挂子设备的网关;2:不可挂子设备的网关;3:子设备
subInfos Array(Object) 网关下子设备详细信息
state int 设备状态 0-离线 1-在线
timeZone String 时区

subInfos说明:

名称 类型 描述
did String 子设备id
createTime String 创建时间
updateTime String 入网时间
model String 物模型
modelType Int 1:可挂子设备的网关;2:不可挂子设备的网关;3:子设备
state int 在线状态:0-离线 1-在线
firmwareVersion String 固件版本号
timeZone String 时区
  • 响应示例:
{
    "code": 0,
    "message": "Success",
    "requestId": "",
    "result": {
        "code": 0,
        "parentDid": "virtual2.13107395143333",
        "createTime": 1619489728008,
        "subInfos": [
            {
                "createTime": 1619489743705,
                "timeZone": "GMT+09:00",
                "model": "lumi.airrtc.tcpecn01",
                "updateTime": 1619489743705,
                "modelType": 3,
                "state": 1,
                "did": "virtual2.44788360390062"
            },
            {
                "createTime": 1619489752884,
                "timeZone": "GMT+09:00",
                "model": "lumi.ctrl_ct.es1",
                "updateTime": 1619489752884,
                "modelType": 3,
                "state": 1,
                "did": "virtual2.40035874561345"
            }
        ],
        "timeZone": "GMT+09:00",
        "model": "lumi.gateway.acn01",
        "updateTime": 1619489728008,
        "modelType": 1,
        "state": 1
    }
}

开启网关添加子设备模式

  • 接口intent:write.device.openConnect
  • 接口描述:本接口主要用于子设备配网,开启指定网关设备的添加子设备模式。
  • 请求参数
名称 类型 是否必须 描述
did String 网关设备id
  • 请求示例
{
    "intent": "write.device.openConnect",
    "data": {
        "did": "virtual2.59214901702075"
    }
}
  • 返回参数:无
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "requestId": "",
    "result": ""
}

关闭网关添加子设备模式

  • 接口intent:write.device.closeConnect
  • 接口描述:本接口与“write.device.openConnect”搭配使用,用于关闭网关设备的添加子设备模式。
  • 请求参数
名称 类型 是否必须 描述
did String 网关设备id
  • 请求示例
{
    "intent": "write.device.closeConnect",
    "data": {
        "did": "virtual2.59214901702075"
    }
}
  • 返回参数:无
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "requestId": "",
    "result": ""
}

查询支持子设备入网的网关列表

  • 接口intent:query.device.supportGateway
  • 接口描述:由于每个网关支持的子设备类型不同,可通过此接口查询指定子设备支持的网关列表。用于子设备配网
  • 请求参数
名称 类型 是否必须 描述
model String 子设备物模型
  • 请求参数
{
    "intent": "query.device.supportGateway",
    "data": {
        "model": "lumi.ctrl_ln1.aq1"
    }
}
  • 返回参数
名称 类型 描述
model String 网关物模型
deviceName String 网关名称
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "msgDetails": null,
    "requestId": 5278.138.16239230111747455,
    "result": [
        {
            "model": "lumi.gateway.acn01",
            "deviceName": "网关 M1S(国内版)"
        },
        {
            "model": "lumi.gateway.iragl5",
            "deviceName": "网关 M2 (国内版)"
        }
    ]
}

通过位置查询支持子设备入网的网关列表

  • 接口intent:query.position.supportGateway
  • 接口描述:通过此接口可查询指定位置下该子设备支持的网关列表,用于子设备配网

  • 请求参数

名称 类型 是否必须 描述
positionId String 位置Id,为空取默认位置
model String 子设备物模型
pageSize String 每页查询数,默认30
pageNum String 页码,默认为1
  • 请求参数
{
    "intent": "query.position.supportGateway",
    "data": {
        "positionId": "real1.768799734012641280",
        "model": "lumi.ctrl_ln1.aq1",
        "pageNum": "1",
        "pageSize": "3"
    }
}
  • 返回参数
名称 类型 描述
count Integer 查询总数量
gateways Array(Object) 查询支持子设备入网的网关列表

gateways说明

名称 类型 描述
model String 网关物模型
state String 网关状态,0-离线,1-在线,当网关状态为离线时,无法添加子设备
deviceName String 网关名称
parentId String 网关id
  • 返回示例
{
    "code": 0,
    "message": "Success",
    "msgDetails": null,
    "requestId": 5278.138.16239211117747455,
    "result": {
        "gateways": [
            {
                "model": "lumi.gateway.aqhm01",
                "state": 1,
                "deviceName": "Hub-1",
                "parentId": "virtual2.03022099714910"
            },
            {
                "model": "lumi.acpartner.aq1",
                "state": 1,
                "deviceName": "Air Conditioning Controller-2",
                "parentId": "virtual2.70319255630325"
            },
            {
                "model": "lumi.acpartner.aq1",
                "state": 1,
                "deviceName": "Air Conditioning Controller-1",
                "parentId": "virtual2.53946223162278"
            }
        ],
        "count": 3
    }
}
Copyright © 2023 深圳绿米联创科技有限公司 all right reserved,powered by Gitbook文档修改时间: 2024-02-21 09:55:50

results matching ""

    No results matching ""