我有以下代码:
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"
答案 0 :(得分: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
...