条件API
ty.device.createCondition
创建条件
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| type | string | 是 | 条件类型 | |
| condition | string | 否 | 条件内容 | |
| index | number | 否 | 索引 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
object.success 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| type | string | 条件类型 | 
| condition | string | 条件内容 | 
| index | number | 索引 | 
object.fail 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| errorMsg | string | 插件错误信息 | 
| errorCode | string | 错误码 | 
| innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } | 
ty.device.editCondition
编辑条件
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| type | string | 是 | 条件类型 | |
| condition | string | 否 | 条件内容 | |
| index | number | 否 | 索引 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
object.success 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| type | string | 条件类型 | 
| condition | string | 条件内容 | 
| index | number | 索引 | 
object.fail 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| errorMsg | string | 插件错误信息 | 
| errorCode | string | 错误码 | 
| innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } | 
动作API
ty.device.createAction
创建自动化动作
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| createType | string | 是 | 动作类型:device,smart,remind,delay device:设备 smart:操作某个智能(执行智能、开关自动化) remind:提醒 delay:延时 | |
| smartType | string | 是 | 智能类型:scene,auto scene:一键执行 auto:自动化 | |
| actionArray | array | 是 | 当前场景动作列表 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
object.success 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| actionArray | array | 动作列表 | 
object.fail 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| errorMsg | string | 插件错误信息 | 
| errorCode | string | 错误码 | 
| innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } | 
👉 立即开发。
ty.device.editAction
编辑场景动作
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| editIndex | string | 是 | 当前编辑的 actionIndex | |
| smartType | string | 是 | 智能类型 | |
| actionArray | SceneAction[] | 是 | 动作列表 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
SceneAction
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| id | string | - | 条件 ID | |
| ruleId | string | - | 场景 ID | |
| orderNum | number | - | 场景 ID | |
| entityId | string | - | ✔ | 条件为设备类型时,表示设备 ID | 
| entityName | string | - | 设备名称 | |
| actionExecutor | string | - | ✔ | 动作类型。枚举:ruleTrigger、ruleEnable、ruleDisable、appPushTrigger、mobileVoiceSend、smsSend、deviceGroupDpIssue、irIssue、dpIssue、delay、irIssueVii、toggle、dpStep | 
| executorProperty | Record<string, {}> | - | 动作执行信息 | |
| extraProperty | Record<string, {}> | - | 动作额外信息 | |
| isDevOnline | boolean | - | 设备是否在线 | |
| devDelMark | boolean | - | 条件为设备类型时,表示设备是否被移除 | |
| deleteDevIcon | string | - | 条件为设备类型时,表示设备被删除时的图标 | |
| devIcon | string | - | 条件为设备类型时,设备的图标 | |
| actionStrategy | string | - | 动作的策略 | |
| extraPanelInfo | ExtraPanelInfo | - | 面板信息(小程序或者RN面板) | |
| pid | string | - | 设备产品 ID | |
| productId | string | - | 设备产品 ID | |
| productPic | string | - | 条件为设备类型时,表示设备产品图片 | |
| defaultIconUrl | string | - | 条件默认图标 | |
| actionDisplayNew | Record<string, {}> | - | 动作展示信息 | |
| status | boolean | - | 执行状态 | |
| relationGroup | Record<string, {}> | - | 批量控制设备的数据 | 
object.success 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| actionArray | array | 动作列表 | 
object.fail 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| errorMsg | string | 插件错误信息 | 
| errorCode | string | 错误码 | 
| innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } | 
ty.device.saveSceneAction
保存场景动作数据
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| deviceId | string | 是 | 设备 id | |
| taskPosition | number | 是 | 动作的索引位置 | |
| actionExecutor | string | 否 | 动作执行器 | |
| executorProperty | any | 是 | 动作执行信息 | |
| extraProperty | any | 是 | 动作额外信息 | |
| actionDisplayNew | any | 是 | 动作展示信息 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
场景功能页API
ty.device.openSceneCreate
跳转创建场景页面
引入
需在基础库
>=2.15.3版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| devId | string | 否 | 设备 id (Android端在App 5.10.0及以上版本支持) | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
ty.device.openCreateScene
跳转创建场景页面 注意:当前Android端仅支持 Zigbee 本地场景。
引入
需在基础库
>=2.15.3版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| devId | string | 否 | 设备 id(Android端在App 5.10.0及以上版本支持) | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
ty.device.openSceneEdit
跳转编辑场景页面
引入
``
需在基础库
>=2.15.3版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| devId | string | 否 | 设备 id (Android端在App 5.10.0及以上版本支持) | |
| sceneId | string | 否 | 场景 id (Android端在App 5.10.0及以上版本支持) | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
请求示例
openSceneEdit({devId: "devId"sceneId: "sceneId"
}).then(() => {console.log('调用成功打开创建场景页面');
});
openSceneCreate
跳转创建场景页面
引入
import { openSceneCreate } from '@ray-js/ray';@ray-js/ray 需在
>=1.4.23版本才可使用
功能依赖最新版本
开发者工具,开发者工具无法模拟使用,需要打包后或真机调试使用。
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| devId | string | 否 | 设备 id | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
请求示例
openSceneCreate({devId: "devId"
}).then(() => {console.log('调用成功打开创建场景页面');
});
其他API
ty.device.showSceneDialog
展示场景的风格弹窗
需引入
DeviceKit,且在>=2.5.4版本才可使用
参数
Object object
| 属性 | 类型 | 默认值 | 必填 | 说明 | 
|---|---|---|---|---|
| smartType | string | 否 | 智能类型:scene,auto scene:一键执行 auto:自动化 | |
| color | string | 否 | 颜色 | |
| icon | string | 否 | 图标 | |
| image | string | 否 | 图片 | |
| complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | |
| success | function | 否 | 接口调用成功的回调函数 | |
| fail | function | 否 | 接口调用失败的回调函数 | 
object.success 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| color | string | 颜色 | 
| icon | string | 图标 | 
| image | string | 图片 | 
object.fail 回调参数
参数
Object res
| 属性 | 类型 | 说明 | 
|---|---|---|
| errorMsg | string | 插件错误信息 | 
| errorCode | string | 错误码 | 
| innerError | object | 插件外部依赖错误信息 {errorMsg: string, errorCode: string } | 
👉 立即开发。