mirror of
https://github.com/mtan93/homebridge.git
synced 2026-03-08 05:31:55 +00:00
use the percent functions from node-hue-api
This commit is contained in:
@@ -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: "%"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user