Skip to content

Commit

Permalink
fix: Fix colour glitches for Lidl HG06467 (#6765)
Browse files Browse the repository at this point in the history
Co-authored-by: peter <peter@caseboat.nl>
  • Loading branch information
pierrebateau and peter authored Dec 25, 2023
1 parent 53fe338 commit 0a382df
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/lib/legacy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7998,12 +7998,10 @@ const toZigbee2 = {

if (h) {
// The device expects 0-359
if (h >= 360) {
h = 359;
}
hsb.h = make4sizedString(h.toString(16));
// The device expects a round number, otherwise everything breaks
hsb.h = make4sizedString(utils.numberWithinRange(utils.precisionRound(h, 0), 0, 359).toString(16));
} else if (state.color && state.color.h) {
hsb.h = make4sizedString(state.color.h.toString(16));
hsb.h = make4sizedString(utils.numberWithinRange(utils.precisionRound(state.color.h, 0), 0, 359).toString(16));
}

// Device expects 0-1000, saturation normally is 0-100 so we expect that from the user
Expand Down

0 comments on commit 0a382df

Please sign in to comment.