From 0491f9b71ad8b8bf264f6291e14e5269680cb618 Mon Sep 17 00:00:00 2001 From: madmod Date: Sat, 27 Jun 2015 17:48:47 -0600 Subject: [PATCH] use the percent functions from node-hue-api --- platforms/PhilipsHue.js | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/platforms/PhilipsHue.js b/platforms/PhilipsHue.js index 7913f80..9467dd4 100644 --- a/platforms/PhilipsHue.js +++ b/platforms/PhilipsHue.js @@ -60,22 +60,15 @@ var execute = function(api, device, characteristic, value) { } } else if (characteristic === "hue") { - value = value/360; - value = value*65535; + value = value*182.5487; value = Math.round(value); state.hue(value); } else if (characteristic === "brightness") { - value = value/100; - value = value*255; - value = Math.round(value); - state.bri(value); + state.brightness(value); } else if (characteristic === "saturation") { - value = value/100; - value = value*255; - value = Math.round(value); - state.sat(value); + state.saturation(value); } api.setLightState(device.id, state, function(err, lights) { if (!err) { @@ -227,7 +220,7 @@ PhilipsHueAccessory.prototype = { supportBonjour: false, manfDescription: "Adjust Saturation of Light", designedMinValue: 0, - designedMaxValue: 255, + designedMaxValue: 100, designedMinStep: 1, unit: "%" }