智能小程序 Ray 开发面板 SDK —— 智能设备模型通用能力一键执行 SDK 汇总(三)

bind

描述

给一键执行绑定自动化条件

请求参数

参数数据类型说明是否必填
dpIdstring功能点 ID,需搭配 dpValue 一同使用
dpValuestring功能点值,需搭配 dpId 一同使用
ruleIdstring需要绑定的场景 ID 列表,在 dpId 等于 dpValue 时,会触发执行当前规则 ID 对应绑定的联动
devIdstring设备 ID,默认从默认设备环境中取
gidstring家庭 ID,不填默认使用当前 App 家庭 ID

返回参数

参数数据类型说明
associativeEntityIdAssociativeEntityId 类型格式为 dpId#dpValue`
associativeEntityValueAssociativeEntityValue 类型关联的规则 id
bindIdnumber绑定 id,一般用来解绑
bizDomainstring业务域,一键执行固定为 wirelessSwitchBindScene
idnumber数据 ID
ownerIdstring家庭 ID
sourceEntityIdstring设备 ID
triggerRuleIdstring规则 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

描述

解绑一键执行规则

请求参数

参数数据类型说明是否必填
bindIdstring解绑 ID是,可通过已绑定的一键执行列表中的 bindId 获取
gidstring家庭 ID否,默认从当前家庭中取

返回参数

参数数据类型说明
resultboolean解绑是否成功

请求示例

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

描述

手动触发一键执行,由云端执行

请求参数

参数数据类型说明是否必填
ruleIdstring规则 ID,可通过已绑定的一键执行列表中的 triggerRuleId 获取

返回参数

参数数据类型说明
resultboolean执行是否成功

请求示例

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 小程序开发。  

  • 8
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

IoT砖家涂拉拉

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值