移块上云插件文档
    正在准备搜索索引...

    设备组管理

    索引

    属性

    injectName: "deviceGroup" = 'deviceGroup'

    方法

    • 添加设备组

      参数

      • options: {
            address?: string;
            complete: () => void;
            contactPhoneList?: string;
            coordinate?: string;
            coordinateSystem?: string;
            description?: string;
            extend?: string;
            fail: (res: Error) => void;
            fid?: string;
            manager?: string;
            managerType?: string;
            name: string;
            parentId?: string;
            success: (res: ResponseData) => void;
        }
        • 可选address?: string

          地址

        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • 可选contactPhoneList?: string

          联系人

        • 可选coordinate?: string

          经纬度

        • 可选coordinateSystem?: string

          坐标系

        • 可选description?: string

          说明

        • 可选extend?: string

          扩展字段

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选fid?: string

          家庭id

        • 可选manager?: string

          管理员

        • 可选managerType?: string

          管理员类型

        • name: string

          分组名称

        • 可选parentId?: string

          父设备组ID

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.addDeviceGroup({
      fid:'',
      name:'',
      address:'',
      coordinate:'',
      coordinateSystem:'',
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 添加设备到设备组中

      参数

      • options: {
            complete: () => void;
            dgid: string;
            fail: (res: Error) => void;
            list: DeviceGroupListItem[];
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dgid: string

          设备组 id

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • list: DeviceGroupListItem[]

          设备 list

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.addDeviceToGroup({
      dgid:'',
      list:[{"dk": "string", "pk": "string"}],
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 批量控制 cacheTime(number)-非必填-缓存时间,单位为秒,缓存时间范围 1-7776000 秒,启用缓存时必须设置缓存时间 data(string)-必填-控制设备的命令,当类型为透传时,命令最大长度为 4096 dataFormat(number)-非必填-数据类型 1:Hex 2:Text(当 type 为透传时,需要指定 dataFormat) deviceList(对象数组)-必填-设备列表([{deviceKey,gatewayDeviceKey(网关设备dk),gatewayProductKey(网关产品pk),productKey}]) isCache(number)-非必填-是否启用缓存 1:启用 2:不启用,默认不启用 isCover(number)-非必填-是否覆盖之前发送的相同的命令 1:覆盖 2:不覆盖,默认不覆盖,启用缓存时此参数有效 qos(number)-非必填-QoS等级设置,参数值范围 0、1,默认为1 QoS 0:最多一次,开销最小,适用于实时非关键数据(如传感器实时值) QoS 1:至少一次,不丢失但可能重复,适用于不允许丢失的场景(如设备控制、告警) QoS 2:恰好一次,最高可靠,仅用于核心业务(如金融、订单),需权衡性能开销。 type(number)-必填-类型 1:透传 2:属性 3:服务

      参数

      • options: {
            cacheTime?: number;
            complete: () => void;
            data: string;
            dataFormat?: DeviceGroupDataFormat;
            deviceList: DeviceGroupListItem[];
            fail: (res: Error) => void;
            isCache?: DeviceGroupIsCache;
            isCover?: DeviceGroupIsCover;
            qos?: number;
            success: (res: ResponseData) => void;
            type: DeviceGroupType;
        }
        • 可选cacheTime?: number

          缓存时间,单位为秒,缓存时间范围 1-7776000 秒,启用缓存时必须设置缓存时间

        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • data: string

          控制设备的命令,当类型为透传时,命令最大长度为 4096

        • 可选dataFormat?: DeviceGroupDataFormat

          数据类型 1:Hex 2:Text(当 type 为透传时,需要指定 dataFormat)

        • deviceList: DeviceGroupListItem[]

          TODO 设备列表([{deviceKey,gatewayDeviceKey(网关设备dk),gatewayProductKey(网关产品pk),productKey}])

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选isCache?: DeviceGroupIsCache

          是否启用缓存,默认不启用

        • 可选isCover?: DeviceGroupIsCover

          是否覆盖之前发送的相同的命令 1:覆盖 2:不覆盖,默认不覆盖,启用缓存时此参数有效

        • 可选qos?: number

          QoS等级设置,参数值范围 0、1,默认为1

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

        • type: DeviceGroupType

          类型

      返回 void

    • 删除设备组

      参数

      • options: {
            complete: () => void;
            dgid: string;
            fail: (res: Error) => void;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dgid: string

          设备组 id

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.deleteDeviceGroup({
      dgid:'',
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 移除设备组中的设备

      参数

      • options: {
            complete: () => void;
            dgid: string;
            fail: (res: Error) => void;
            list: DeviceGroupListItem[];
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dgid: string

          设备组 id

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • list: DeviceGroupListItem[]

          设备 list

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.deleteDeviceToGroup({
      dgid:'',
      list:[{"dk": "string", "pk": "string"}],
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 查询设备组详情

      参数

      • options: {
            complete: () => void;
            dgid: string;
            fail: (res: Error) => void;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dgid: string

          设备组 id

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.deviceGroupInfo({
      dgid:'',
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 查询设备组列表

      参数

      • options: {
            address?: string;
            complete: () => void;
            contactPhoneList?: string;
            description?: string;
            dgid?: string;
            extend?: string;
            fail: (res: Error) => void;
            manager?: string;
            managerType?: string;
            name: string;
            page?: number;
            pageSize?: string;
            parentId?: string;
            success: (res: ResponseData) => void;
        }
        • 可选address?: string

          地址

        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • 可选contactPhoneList?: string

          联系人

        • 可选description?: string

          说明

        • 可选dgid?: string

          设备组ID

        • 可选extend?: string

          扩展字段

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选manager?: string

          管理员

        • 可选managerType?: string

          管理员类型

        • name: string

          分组名称

        • 可选page?: number

          当前页,默认为第 1 页

        • 可选pageSize?: string

          页大小,默认为 10 条

        • 可选parentId?: string

          父设备组ID

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.deviceGroupList({
      page: 1,
      pageSize: 10,
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 根据设备查询设备组列表

      参数

      • options: {
            complete: () => void;
            dk: string;
            fail: (res: Error) => void;
            pk: string;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dk: string

          设备 deviceKey

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • pk: string

          设备 productKey

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.getDeviceGroupList({
      dk: '',
      pk: '',
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 查询不在设备组内的设备列表

      参数

      • options: {
            complete: () => void;
            dgid: string;
            fail: (res: Error) => void;
            fid?: string;
            page?: number;
            pageSize?: string;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • dgid: string

          设备组 id

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选fid?: string

          父设备组ID

        • 可选page?: number

          当前页,默认为第 1 页

        • 可选pageSize?: string

          页大小,默认为 10 条

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.getDeviceListByNotInDeviceGroup({
      fid:'',
      dgid:'',
      page:1,
      pageSize:10,
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 查询家庭设备组列表

      参数

      • options: {
            complete: () => void;
            fail: (res: Error) => void;
            fid: string;
            page?: number;
            pageSize?: string;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • fid: string

          家庭 id

        • 可选page?: number

          当前页,默认为第 1 页

        • 可选pageSize?: string

          页大小,默认为 10 条

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.getFamilyGroupList({
      fid:'',
      page:1,
      pageSize:10,
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 查询设备组中的设备列表

      参数

      • options: {
            complete: () => void;
            deviceGroupName?: string;
            dgid?: string;
            dkList?: string;
            fail: (res: Error) => void;
            page?: number;
            pageSize?: string;
            pk?: string;
            success: (res: ResponseData) => void;
        }
        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • 可选deviceGroupName?: string

          设备组名称

        • 可选dgid?: string

          设备组 ID

        • 可选dkList?: string

          dk 列表,多个 dk 使用英文逗号分隔

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选page?: number

          当前页,默认为第 1 页

        • 可选pageSize?: string

          页大小,默认为 10 条

        • 可选pk?: string

          产品 pk

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.getGroupDeviceList({
      deviceGroupName:'',
      dgid:'',
      dkList:'',
      pk:'',
      page:1,
      page:10,
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })
    • 修改设备组

      参数

      • options: {
            address?: string;
            complete: () => void;
            contactPhoneList?: string;
            coordinate?: string;
            coordinateSystem?: string;
            description?: string;
            dgid: string;
            extend?: string;
            fail: (res: Error) => void;
            manager?: string;
            managerType?: string;
            name: string;
            page?: number;
            pageSize?: string;
            parentId?: string;
            success: (res: ResponseData) => void;
        }
        • 可选address?: string

          地址

        • complete: () => void

          接口调用结束的回调函数(调用成功、失败都会执行)

        • 可选contactPhoneList?: string

          联系人

        • 可选coordinate?: string

          经纬度

        • 可选coordinateSystem?: string

          坐标系

        • 可选description?: string

          说明

        • dgid: string

          设备组 ID

        • 可选extend?: string

          扩展字段

        • fail: (res: Error) => void

          接口调用失败的回调函数

        • 可选manager?: string

          管理员

        • 可选managerType?: string

          组管理员类型

        • name: string

          设备组名称

        • 可选page?: number

          当前页,默认为第 1 页

        • 可选pageSize?: string

          页大小,默认为 10 条

        • 可选parentId?: string

          父设备组ID

        • success: (res: ResponseData) => void

          接口调用成功的回调函数

      返回 void

      const plugin = requirePlugin('quecPlugin')
      plugin.deviceGroup.setDeviceGroup({
      dgid:'',
      address:'',
      coordinate:'',
      coordinateSystem:'',
      success (res) {
      console.log(res)
      },
      fail (res) {
      console.log(JSON.stringify(res))
      }
      })