Skip to content

Commit

Permalink
openhab#9 Turn off LED when brightness is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
magx2 committed Apr 9, 2019
1 parent 916bc62 commit bcc343c
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,14 @@ protected void handlePercentCommand(final ChannelUID channelUID, final PercentTy

private void sendNewLedValue(final ChannelUID channelUID, int channelId, final HSBType hsbType) throws ApiException {
final String rgb = HsbTypeConverter.INSTANCE.convert(hsbType);
final int colorBrightness = hsbType.getSaturation().intValue();
final int brightness = hsbType.getBrightness().intValue();
final int colorBrightness;
if (brightness > 0) {
colorBrightness = hsbType.getSaturation().intValue();
} else {
logger.trace("Set colorBrightness to 0% because brightness is 0%");
colorBrightness = 0;
}
logger.trace("Changing RGB to {}, color brightness {}%, brightness {}%", rgb, colorBrightness, brightness);
final ChannelExecuteActionRequest action = new ChannelExecuteActionRequest()
.action(SET_RGBW_PARAMETERS)
Expand Down

0 comments on commit bcc343c

Please sign in to comment.