publishSigMeshMultiDps
mesh 群组控制(仅用于单设备面板中的群控,如 PIR 传感器面板)
引入
import { publishSigMeshMultiDps } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.4.0
版本才可使用
请求参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
groupId | string | 是 | groupId 群组 id | |
localId | string | 是 | localId 群组本地标识 | |
dps | Record<string, any> | 是 | dp 信息 示例: dps: {"1" : true} | |
pcc | string | 是 | pcc mesh 设备品类 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
publishCommands
发送 标准 dp
引入
import { publishCommands } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.1.6
版本才可使用
请求参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备 id | |
dps | Record<dpCode, any> | 是 | dps | |
mode | number | 是 | 下发通道类型 0: 局域网 1: 网络 2: 自动 | |
pipelines | Array<number> | 是 | 下发通道的优先级 LAN = 0, // LAN MQTT = 1, // MQTT HTTP = 2, // Http BLE = 3, // Single Point Bluetooth SIGMesh = 4, // Sig Mesh BLEMesh = 5, // Thing Private Mesh BLEBeacon = 6, // Beacon | |
options | Object | 是 | 预留下发逻辑配置标记,后续可以拓展,例如下发声音,下发操作后续动作等等 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
返回结果
- success
Boolean boolean
- fail
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
请求示例
publishCommands({
deviceId: 'vdevo169477319679442',
dps: {
switch_led: false,
},
mode: 1,
pipelines: [0, 1, 2, 3, 4, 5, 6],
options: {},
success: res => {
console.log(res);
},
fail: error => {
console.log(error);
},
});
返回示例
true
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
queryDps
查询 dps
引入
import { queryDps } from '@ray-js/ray';
需引入
DeviceKit
,且在>=1.2.6
版本才可使用
请求参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备 id | |
dpIds | string[] | 是 | dpIds 数组 | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
返回结果
- success
类型: any
- fail
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
请求示例
queryDps({
deviceId: 'vdevo169477319679442',
// @ts-ignore
dpIds: ['1'],
success: res => {
console.log(res);
},
fail: error => {
console.log(error);
},
});
返回示例
true
getDpDataByMesh
获取 mesh 子设备的 dp 数据
引入
import { getDpDataByMesh } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.4.0
版本才可使用。
请求参数
Object object
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | 设备模型 设备 id | |
dpIds | string[] | 是 | dpId | |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
success | function | 否 | 接口调用成功的回调函数 | |
fail | function | 否 | 接口调用失败的回调函数 |
返回结果
- success
类型: any
- fail
属性 | 类型 | 说明 |
---|---|---|
errorMsg | string | 插件错误信息 |
errorCode | string | 错误码 |
innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } |
请求示例
getDpDataByMesh({
deviceId: 'vdevo169477319679442',
// @ts-ignore
dpIds: ['1'],
success: res => {
console.log(res);
},
fail: error => {
console.log(error);
},
});
返回示例
true
onDpDataChange
监听 dp 点变更
引入
import { onDpDataChange } from '@ray-js/ray';
需引入
DeviceKit
,且在>=1.2.6
版本才可使用
请求参数
Function Callback
dp 点变更的回调函数
回调结果
属性 | 类型 | 默认值 | 必填 | 说明 |
---|---|---|---|---|
deviceId | string | 是 | dps 对应的设备 id | |
dps | Object | 是 | dps 变化的数据 | |
gwId | string | 否 | 子设备对应的网关设备 id,可以根据此进行网关面板的状态刷新 | |
options | any | 否 | options 预留的标记位,后续可以区分来源等 |
请求示例
onDpDataChange((res)=>{
console.log(res);
})
返回示例
{
deviceId: "vdevo169477319679442",
dps: {
1: true
},
gwId: ''
}
offDpDataChange
取消监听:dp 点变更
引入
import { offDpDataChange } from '@ray-js/ray';
需引入
DeviceKit
,且在>=2.1.6
版本才可使用
请求参数
Function Callback
取消监听:dp 点变更的回调函数
返回结果
无
请求示例
offDpDataChange(() => {});
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。