Skip to content

Commit

Permalink
[deconz] fix on-off issue with color lights(#7868)
Browse files Browse the repository at this point in the history
Signed-off-by: Jan N. Klug <[email protected]>
  • Loading branch information
J-N-K authored Jun 6, 2020
1 parent 4ed1124 commit 53eb5be
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,18 @@ private void valueUpdated(String channelId, LightState newState) {
}
break;
case CHANNEL_COLOR:
double @Nullable [] xy = newState.xy;
Integer hue = newState.hue;
Integer sat = newState.sat;
if (hue != null && sat != null && bri != null) {
updateState(channelId,
new HSBType(new DecimalType(hue / HUE_FACTOR), toPercentType(sat), toPercentType(bri)));
} else if (xy != null && xy.length == 2) {
updateState(channelId, HSBType.fromXY((float) xy[0], (float) xy[1]));
if (on != null && on == false) {
updateState(channelId, OnOffType.OFF);
} else {
double @Nullable [] xy = newState.xy;
Integer hue = newState.hue;
Integer sat = newState.sat;
if (hue != null && sat != null && bri != null) {
updateState(channelId,
new HSBType(new DecimalType(hue / HUE_FACTOR), toPercentType(sat), toPercentType(bri)));
} else if (xy != null && xy.length == 2) {
updateState(channelId, HSBType.fromXY((float) xy[0], (float) xy[1]));
}
}
break;
case CHANNEL_BRIGHTNESS:
Expand Down

0 comments on commit 53eb5be

Please sign in to comment.