Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for passing decimal hue values to Silvercrest smart led string #6765

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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