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

6 篇文章 0 订阅
5 篇文章 0 订阅

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"})
     */
    @report
    openTimerSettingPageWithOptions(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
      }
    )
  ;
};

文档:
在这里插入图片描述


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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值