0

我有以下代码:

cType: types.ROTATION_SPEED_CTYPE,
    onUpdate: function(value) { console.log("Change:",value); execute("Fan", "Fan Speed", value); },
    perms: ["pw","pr","ev"],
    format: "float",
    initialValue: 100,
    supportEvents: false,
    supportBonjour: false,
    manfDescription: "Change the speed  of the fan",
    designedMinValue: 0,
    designedMaxValue: 99,
    designedMinStep: 33,
    unit: "percentage"

我如何根据不同的“值”执行不同的脚本,特别是在“onUpdate”上

4

1 回答 1

0

再往上,有一个功能

var execute = function(accessory,characteristic,value){ 
    console.log("executed accessory: " + accessory + ", and characteristic: " + characteristic + ", with value: " +  value + "."); }

附件将具有“风扇”,特性将具有“风扇速度”,值将具有值 (0 - 99)。

把这样的东西放在它的位置;

var execute = function(accessory,characteristic,value) {

   if(value >= 30) {
    ...
   } else 
    ...
于 2015-06-22T13:52:26.773 回答