From b023e5ac47f8b42b17e51e1c4eeff2c19ace6955 Mon Sep 17 00:00:00 2001 From: Holger Friedrich Date: Sun, 26 Feb 2023 12:19:15 +0100 Subject: [PATCH] [knx] Fix DPT 3.007 (Control Dimming) for non -control channels (#14504) Signed-off-by: Holger Friedrich Also-by: Jan N. Klug --- .../openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java | 3 ++- .../binding/knx/internal/handler/DeviceThingHandler.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java index 66a5ae475..db902650a 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/dpt/KNXCoreTypeMapper.java @@ -888,7 +888,7 @@ public class KNXCoreTypeMapper implements KNXTypeMapper { DPTXlator3BitControlled translator3BitControlled = (DPTXlator3BitControlled) translator; if (translator3BitControlled.getStepCode() == 0) { logger.debug("toType: KNX DPT_Control_Dimming: break received."); - return UnDefType.UNDEF; + return UnDefType.NULL; } switch (subNumber) { case 7: @@ -897,6 +897,7 @@ public class KNXCoreTypeMapper implements KNXTypeMapper { case 8: return translator3BitControlled.getControlBit() ? UpDownType.DOWN : UpDownType.UP; } + break; case 18: DPTXlatorSceneControl translatorSceneControl = (DPTXlatorSceneControl) translator; int decimalValue = translatorSceneControl.getSceneNumber(); diff --git a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java index aecce6bce..68d5c74b7 100644 --- a/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java +++ b/bundles/org.openhab.binding.knx/src/main/java/org/openhab/binding/knx/internal/handler/DeviceThingHandler.java @@ -413,7 +413,7 @@ public class DeviceThingHandler extends AbstractKNXThingHandler { } } } else { - if (type instanceof State) { + if (type instanceof State && !(type instanceof UnDefType)) { updateState(channelUID, (State) type); } }