mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-10 23:22:02 +01:00
[openwebnet] Do not store dimmer brightness if already 0 (#14822)
Fixes #14785 Signed-off-by: Massimo Valla <mvcode00@gmail.com>
This commit is contained in:
parent
cb4d232328
commit
02fd67f6ce
@ -194,13 +194,16 @@ public class OpenWebNetLightingHandler extends OpenWebNetThingHandler {
|
||||
private void dimLightTo(int percent, Command command) {
|
||||
logger.debug(" DIM dimLightTo({}) bri={} briBeforeOff={}", percent, brightness, brightnessBeforeOff);
|
||||
int newBrightness = percent;
|
||||
if (newBrightness == UNKNOWN_STATE) {
|
||||
// we do not know last brightness -> set dimmer to 100%
|
||||
if (newBrightness == UNKNOWN_STATE) { // we do not know last brightness -> set dimmer to 100%
|
||||
newBrightness = 100;
|
||||
} else if (newBrightness <= 0) {
|
||||
newBrightness = 0;
|
||||
brightnessBeforeOff = brightness;
|
||||
logger.debug(" DIM saved bri before sending bri=0 command to device");
|
||||
if (brightness == 0) {
|
||||
logger.debug(" DIM bri already 0: no need to save it");
|
||||
} else {
|
||||
brightnessBeforeOff = brightness;
|
||||
logger.debug(" DIM saved briBeforeOff={} before sending bri=0 command to device",
|
||||
brightnessBeforeOff);
|
||||
}
|
||||
} else if (newBrightness > 100) {
|
||||
newBrightness = 100;
|
||||
}
|
||||
@ -280,8 +283,7 @@ public class OpenWebNetLightingHandler extends OpenWebNetThingHandler {
|
||||
return;
|
||||
} else {
|
||||
// otherwise we interpret this ON event as the requestStatus response event with
|
||||
// level=1
|
||||
// so we proceed to call updateBrightnessState()
|
||||
// level=1 so we proceed to call updateBrightnessState()
|
||||
logger.debug(" $BRI 'ON' is the requestStatus response level");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user