Skip to content

Commit a928c4a

Browse files
committed
[shelly] Fix Pro RGBWW PM colorFull White option turning the light off
The rgb:0 component has no white parameter, so selecting "white" on the colorFull channel sent rgb=0,0,0 with a dropped white value, switching the light off instead of producing white. Mix full RGB (255,255,255) instead for this component, and recognize that combination when reporting the current colorFull state back. Signed-off-by: Markus Michels <markus7017@gmail.com>
1 parent 7ef3347 commit a928c4a

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

bundles/org.openhab.binding.shelly/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1755,8 +1755,9 @@ In `rgbcct` or `rgbx2light` profile, the RGB component is exposed as the color c
17551755
| | autoOff | Number | r/w | Sets a timer to turn the device OFF after every ON command; in seconds |
17561756
| | timerActive | Switch | yes | ON: An auto-on/off timer is active |
17571757
| color | hsb | HSB | r/w | Represents the color picker (HSBType) |
1758-
| | full | String | r/w | Set Red / Green / Blue / Yellow mode and switch mode |
1759-
| | | | r/w | Valid settings: "red", "green", "blue", "yellow" or "r,g,b" |
1758+
| | full | String | r/w | Set Red / Green / Blue / Yellow / White mode and switch mode |
1759+
| | | | r/w | Valid settings: "red", "green", "blue", "yellow", "white" or "r,g,b" |
1760+
| | | | r/w | "white" sets RGB to 255,255,255 (no separate white output) |
17601761
| | red | Dimmer | r/w | Red brightness: 0..100% (control only the red channel) |
17611762
| | green | Dimmer | r/w | Green brightness: 0..100% (control only the green channel) |
17621763
| | blue | Dimmer | r/w | Blue brightness: 0..100% (control only the blue channel) |

bundles/org.openhab.binding.shelly/src/main/java/org/openhab/binding/shelly/internal/handler/ShellyLightHandler.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,11 @@ private boolean handleFullColor(ShellyColorUtils col, Command command) throws Il
304304
} else if (color.equals(SHELLY_COLOR_YELLOW)) {
305305
col.setRGBW(SHELLY_MAX_COLOR, SHELLY_MAX_COLOR, 0, 0);
306306
} else if (color.equals(SHELLY_COLOR_WHITE)) {
307-
col.setRGBW(0, 0, 0, SHELLY_MAX_COLOR);
307+
if (profile.isProRgbwwPm) { // RGB component has no white output, mix full RGB instead
308+
col.setRGBW(SHELLY_MAX_COLOR, SHELLY_MAX_COLOR, SHELLY_MAX_COLOR, 0);
309+
} else {
310+
col.setRGBW(0, 0, 0, SHELLY_MAX_COLOR);
311+
}
308312
col.setMode(SHELLY_MODE_WHITE);
309313
} else {
310314
throw new IllegalArgumentException("Invalid full color selection: " + color);
@@ -474,6 +478,8 @@ private void setFullColor(String colorGroup, ShellyColorUtils col) {
474478
updateChannel(colorGroup, CHANNEL_COLOR_FULL, new StringType(SHELLY_COLOR_BLUE));
475479
} else if ((col.red == 0) && (col.green == 0) && (col.blue == 0) && (col.white == SHELLY_MAX_COLOR)) {
476480
updateChannel(colorGroup, CHANNEL_COLOR_FULL, new StringType(SHELLY_COLOR_WHITE));
481+
} else if ((col.red == SHELLY_MAX_COLOR) && (col.green == SHELLY_MAX_COLOR) && (col.blue == SHELLY_MAX_COLOR)) {
482+
updateChannel(colorGroup, CHANNEL_COLOR_FULL, new StringType(SHELLY_COLOR_WHITE));
477483
}
478484
}
479485

0 commit comments

Comments
 (0)