Fix Global off blocks lights turning on (#11797)

Signed-off-by: Matthew Skinner <matt@pcmus.com>
This commit is contained in:
Matthew Skinner 2021-12-16 18:58:51 +11:00 committed by GitHub
parent e54dec524b
commit 82df34131c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -139,6 +139,10 @@ public class WLedHandler extends BaseThingHandler {
break; break;
case CHANNEL_MASTER_CONTROLS: case CHANNEL_MASTER_CONTROLS:
if (command instanceof OnOffType) { if (command instanceof OnOffType) {
if (OnOffType.ON.equals(command)) {
// global may be off, but we don't want to switch global off and affect other segments
localApi.setGlobalOn(true);
}
localApi.setMasterOn(OnOffType.ON.equals(command), config.segmentIndex); localApi.setMasterOn(OnOffType.ON.equals(command), config.segmentIndex);
} else if (command instanceof IncreaseDecreaseType) { } else if (command instanceof IncreaseDecreaseType) {
if (IncreaseDecreaseType.INCREASE.equals(command)) { if (IncreaseDecreaseType.INCREASE.equals(command)) {
@ -159,6 +163,7 @@ public class WLedHandler extends BaseThingHandler {
localApi.setMasterOn(false, config.segmentIndex); localApi.setMasterOn(false, config.segmentIndex);
return; return;
} }
localApi.setGlobalOn(true);
primaryColor = (HSBType) command; primaryColor = (HSBType) command;
if (primaryColor.getSaturation().intValue() < config.saturationThreshold && hasWhite) { if (primaryColor.getSaturation().intValue() < config.saturationThreshold && hasWhite) {
localApi.setWhiteOnly((PercentType) command, config.segmentIndex); localApi.setWhiteOnly((PercentType) command, config.segmentIndex);