Skip to content

Commit

Permalink
Possible fix for issue #149 "Brightness does not match"
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Pinhasov authored and milo526 committed Mar 25, 2021
1 parent 4814bf5 commit c950e1f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/accessories/characteristics/brightness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ export class BrightnessCharacteristic extends TuyaWebCharacteristic {
) {
stateValue = Number(data.color.brightness);
} else if (data?.brightness) {
stateValue = Math.round((Number(data.brightness) / 255) * 100);
if (Number(data.brightness) > 100) {
stateValue = Math.round((Number(data.brightness) / 1000) * 100)
} else {
stateValue = Number(data.brightness)
}
}

if (stateValue) {
Expand Down

0 comments on commit c950e1f

Please sign in to comment.