use the percent functions from node-hue-api

This commit is contained in:
madmod
2015-06-27 17:48:47 -06:00
parent 805758395e
commit 0491f9b71a
+4 -11
View File
@@ -60,22 +60,15 @@ var execute = function(api, device, characteristic, value) {
} }
} }
else if (characteristic === "hue") { else if (characteristic === "hue") {
value = value/360; value = value*182.5487;
value = value*65535;
value = Math.round(value); value = Math.round(value);
state.hue(value); state.hue(value);
} }
else if (characteristic === "brightness") { else if (characteristic === "brightness") {
value = value/100; state.brightness(value);
value = value*255;
value = Math.round(value);
state.bri(value);
} }
else if (characteristic === "saturation") { else if (characteristic === "saturation") {
value = value/100; state.saturation(value);
value = value*255;
value = Math.round(value);
state.sat(value);
} }
api.setLightState(device.id, state, function(err, lights) { api.setLightState(device.id, state, function(err, lights) {
if (!err) { if (!err) {
@@ -227,7 +220,7 @@ PhilipsHueAccessory.prototype = {
supportBonjour: false, supportBonjour: false,
manfDescription: "Adjust Saturation of Light", manfDescription: "Adjust Saturation of Light",
designedMinValue: 0, designedMinValue: 0,
designedMaxValue: 255, designedMaxValue: 100,
designedMinStep: 1, designedMinStep: 1,
unit: "%" unit: "%"
} }