bind
描述
给一键执行绑定自动化条件
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
dpId | string | 功能点 ID,需搭配 dpValue 一同使用 | 是 |
dpValue | string | 功能点值,需搭配 dpId 一同使用 | 是 |
ruleId | string | 需要绑定的场景 ID 列表,在 dpId 等于 dpValue 时,会触发执行当前规则 ID 对应绑定的联动 | 是 |
devId | string | 设备 ID,默认从默认设备环境中取 | 否 |
gid | string | 家庭 ID,不填默认使用当前 App 家庭 ID | 否 |
返回参数
参数 | 数据类型 | 说明 |
---|---|---|
associativeEntityId | AssociativeEntityId 类型 | 格式为 dpId#dpValue` |
associativeEntityValue | AssociativeEntityValue 类型 | 关联的规则 id |
bindId | number | 绑定 id,一般用来解绑 |
bizDomain | string | 业务域,一键执行固定为 wirelessSwitchBindScene |
id | number | 数据 ID |
ownerId | string | 家庭 ID |
sourceEntityId | string | 设备 ID |
triggerRuleId | string | 规则 ID |
请求示例
import { SmartTapToRunAbility } from '@ray-js/panel-sdk';
const TapToRun = new SmartTapToRunAbility();
TapToRun.bind({
dpId: '1',
dpValue: 'double_click',
ruleId: 'some rule id',
})
.then((response) => {
console.log(response);
})
.catch();
console.log('=== result: ', result);
️🚫 注意,返回示例仅供参考,其包含字段大于返回参数定义范围,请勿使用除本文返回参数定义以外的返回数据,否则可能会导致程序异常。
返回示例
{
"associativeEntityId": "3#long_press",
"associativeEntityValue": "some rule id",
"bindId": 123,
"bizDomain": "wirelessSwitchBindScene",
"id": 123,
"ownerId": "some owner id",
"property": "{\"bindRuleIds\":\"some rule id\"}",
"sourceEntityId": "some device id",
"triggerRuleId": "some rule id"
}
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。
unbind
描述
解绑一键执行规则
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
bindId | string | 解绑 ID | 是,可通过已绑定的一键执行列表中的 bindId 获取 |
gid | string | 家庭 ID | 否,默认从当前家庭中取 |
返回参数
参数 | 数据类型 | 说明 |
---|---|---|
result | boolean | 解绑是否成功 |
请求示例
import { SmartTapToRunAbility } from '@ray-js/panel-sdk';
const TapToRun = new SmartTapToRunAbility();
TapToRun.unbind({ bindId: 'some bind id' })
.then((response) => {
console.log(response);
})
.catch();
console.log('=== result: ', result);
返回示例
true
trigger
描述
手动触发一键执行,由云端执行
请求参数
参数 | 数据类型 | 说明 | 是否必填 |
---|---|---|---|
ruleId | string | 规则 ID,可通过已绑定的一键执行列表中的 triggerRuleId 获取 | 是 |
返回参数
参数 | 数据类型 | 说明 |
---|---|---|
result | boolean | 执行是否成功 |
请求示例
import { SmartTapToRunAbility } from '@ray-js/panel-sdk';
const TapToRun = new SmartTapToRunAbility();
TapToRun.trigger({ ruleId: 'some rule id' })
.then((response) => {
console.log(response);
})
.catch();
console.log('=== result: ', result);
返回示例
true
👉 立即免费领取开发资源,体验涂鸦 MiniApp 小程序开发。