diff --git a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java index 00975e55d2c1a..9a88d4d9d3b67 100644 --- a/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java +++ b/bundles/org.openhab.binding.hue/src/main/java/org/openhab/binding/hue/internal/handler/Clip2ThingHandler.java @@ -98,6 +98,8 @@ public class Clip2ThingHandler extends BaseThingHandler { private static final Duration DYNAMICS_ACTIVE_WINDOW = Duration.ofSeconds(10); + private static final String LK_WISER_MODEL_ID = "LK Dimmer"; + private final Logger logger = LoggerFactory.getLogger(Clip2ThingHandler.class); /** @@ -402,6 +404,7 @@ public void handleCommand(ChannelUID channelUID, Command commandParam) { case CHANNEL_2_SWITCH: putResource = Objects.nonNull(putResource) ? putResource : new Resource(lightResourceType); putResource.setOnOff(command); + applyDeviceSpecificWorkArounds(command, putResource); break; case CHANNEL_2_COLOR_XY_ONLY: @@ -414,6 +417,7 @@ public void handleCommand(ChannelUID channelUID, Command commandParam) { case CHANNEL_2_ON_OFF_ONLY: putResource = new Resource(lightResourceType).setOnOff(command); + applyDeviceSpecificWorkArounds(command, putResource); break; case CHANNEL_2_TEMPERATURE_ENABLED: @@ -514,6 +518,23 @@ public void handleCommand(ChannelUID channelUID, Command commandParam) { } } + /** + * Apply device specific work-arounds needed for given command. + * + * @param command the handled command. + * @param putResource the resource that will be adjusted if needed. + */ + private void applyDeviceSpecificWorkArounds(Command command, Resource putResource) { + if (command == OnOffType.OFF) { + String modelId = thing.getProperties().get(Thing.PROPERTY_MODEL_ID); + if (LK_WISER_MODEL_ID.equals(modelId)) { + // Apply transition time as a workaround for LK Wiser Dimmer firmware bug. + // Additional details here: https://techblog.vindvejr.dk/?p=455 + putResource.setDynamicsDuration(Duration.ZERO); + } + } + } + /** * Handle a 'dynamics' command for the given channel ID for the given dynamics duration. *