admin 管理员组

文章数量: 888526

Conmi的正确答案——米家定时模块的使用以及showOnTimerType、showOffTimerType、showPeriodTimerType、identify的陷阱

miot版本:10068
npm版本:8.11.0
编写时间:2022-12-19 09:04:43


米家定时界面代码:

    /*** 打开时间设置页面(米家APP实现)* @since 10032 ,SDKLevel 10032 开始提供使用* @param {object} options 配置信息* @param {string} options.onMethod 配置定时开启的 method 名,同上面openTimerSettingPageWithVariousTypeParams的参数onMethod* @param {string} options.onParam 配置定时开启的 参数,同上面openTimerSettingPageWithVariousTypeParams的参数onParam* @param {string} options.offMethod 配置定时关闭的 method 名,同上面openTimerSettingPageWithVariousTypeParams的参数offMethod* @param {string} options.offParam 配置定时关闭的 参数,同上面openTimerSettingPageWithVariousTypeParams的参数offParam* @param {string} options.timerTitle 定时列表页自定义标题* @param {string} options.displayName 配置场景日志显示的名称* @param {string} options.identify 自定义定时Identifier* @param {string} options.onTimerTips 定时列表页面、设置时间页面 打开副标题(默认:开启时间)* @param {string} options.offTimerTips 定时列表页面、设置时间页面 关闭时间副标题(默认:关闭时间)* @param {string} options.listTimerTips 定时列表页面 定时时间段副标题(默认:开启时段)* @param {boolean} options.bothTimerMustBeSet 是否强制要求设置时间段? true: 强制设置时间段(默认:false)如果设置true,忽略下面三个参数* @param {boolean} options.showOnTimerType 是否可以创建:定时开启? true: 可以,false:不可以(默认:true)* @param {boolean} options.showOffTimerType 是否可以创建:定时关闭? true: 可以,false:不可以(默认:true)* @param {boolean} options.showPeriodTimerType 是否可以创建:时间段定时? true: 可以,false:不可以(默认:true)* @param {string} options.did 设备did,可为空,@since 10045* 注意:showOnTimerType、showOffTimerType、showPeriodTimerType三个参数至少有一个为true,才有效,否则三个中任意都会被忽略掉* @example* Service.scene.openTimerSettingPageWithOptions({onMethod:"power_on", onParam: "on", offMethod: "power_off", offParam: "off", displayName:"设置xxx定时",identify:"plug_usb_countdowm"})*/@reportopenTimerSettingPageWithOptions(options) {}

触发8000元复测代码:

/*** 打开时间设置界面*/
const openTimerSettingPageWithOptions = () => {Service.scene.openTimerSettingPageWithOptions({did: Device.deviceID,onMethod: "set_properties",onParam: [{did: Device.deviceID,siid: 2,piid: 1,value: true}],offMethod: "set_properties",offParam: [{did: Device.deviceID,siid: 2,piid: 1,value: false}],timerTitle: PluginStrings.scheduled,displayName: `${ Device.name }-${ PluginStrings.scheduled }`,// 必须使用设备ID作为关联键,米家文档在提出问题后仍未修改,避免使用写死的同一ID导致云端数据混乱// 等情况(因为米家的示例代码与可以接触的代码都未阐述实现方式、用法以及注意事项),为了避免你那8000元的复测费用的产生,// 务必使用设备ID作为识别码(但不排除他们进行隐形收费去修改不公开的实现方式导致新的问题)identify: `${ Device.deviceID }`,onTimerTips: PluginStrings.scheduledOnTimerTips,offTimerTips: PluginStrings.scheduledOffTimerTips,listTimerTips: PluginStrings.scheduledListTimerTips,bothTimerMustBeSet: false,// 【即便存在文档中所说的默认值也要设置】showOnTimerType: true,// 【即便存在文档中所说的默认值也要设置】showOffTimerType: true,// 【即便存在文档中所说的默认值也要设置】showPeriodTimerType: true});
};

文档:


附上米家工单敷衍回答以及不解决就直接关闭工单:
(后来过了很久才有重新打开功能,可想而知该系统启用几年来他们都是怎样处理问题的)

本文标签: Conmi的正确答案米家定时模块的使用以及showOnTimerTypeshowOffTimerTypeshowPeriodTimerTypeidentify的陷阱