diff --git a/lib/light_accessory.js b/lib/light_accessory.js index 7a71b8cb..c90f8192 100644 --- a/lib/light_accessory.js +++ b/lib/light_accessory.js @@ -99,7 +99,7 @@ getAccessoryCharacteristic(name) { } }) .on('set', (value, callback) => { - //Switching colors will trigger both hue and saturation to avoid the color command being sent repeatedly. + //Switching colors will trigger both hue and saturation to avoid the color command being sent repeatedly. //So the saturation is saved and is sent with the hue if (name == Characteristic.Saturation) { this.setCachedState(name, value); @@ -138,7 +138,7 @@ getAccessoryCharacteristic(name) { { var percentage; percentage = Math.floor((this.function_dp_range.bright_range.max - this.function_dp_range.bright_range.min) * value / 100 + this.function_dp_range.bright_range.min); // value 0~100 - if (this.workMode.value == 'white') { + if (!this.workMode || this.workMode.value === 'white') { code = this.brightValue.code; value = percentage; } else {