Skip to content

Commit

Permalink
[deconz] Fix color conversion (#16769)
Browse files Browse the repository at this point in the history
After core changes to ColorUtil the Y part can no longer be used as brightness.

Signed-off-by: Jan N. Klug <github@klug.nrw>
  • Loading branch information
J-N-K authored May 17, 2024
1 parent c8ba71f commit 7715bd2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,12 @@ public void handleCommand(ChannelUID channelUID, Command command) {
} else {
double[] xy = ColorUtil.hsbToXY(hsbCommand);
newLightState.xy = new double[] { xy[0], xy[1] };
newLightState.bri = (int) (xy[2] * BRIGHTNESS_MAX);
newLightState.bri = Util.fromPercentType(hsbCommand.getBrightness());
}
} else if (command instanceof PercentType) {
newLightState.bri = Util.fromPercentType((PercentType) command);
} else if (command instanceof DecimalType) {
newLightState.bri = ((DecimalType) command).intValue();
} else if (command instanceof PercentType percentCommand) {
newLightState.bri = Util.fromPercentType(percentCommand);
} else if (command instanceof DecimalType decimalCommand) {
newLightState.bri = decimalCommand.intValue();
} else {
return;
}
Expand Down

0 comments on commit 7715bd2

Please sign in to comment.