Skip to content

Commit

Permalink
Merge pull request #50 from slavvka/tgq_category
Browse files Browse the repository at this point in the history
Fixed setting brightness for tgq category
  • Loading branch information
Hanh94 authored Jun 29, 2021
2 parents 7aae3e2 + b97d8df commit c243321
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/light_accessory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit c243321

Please sign in to comment.