From 684b77d6a88fb5a465accae78a702201f4affff7 Mon Sep 17 00:00:00 2001 From: Andrew Fiddian-Green Date: Sat, 21 Dec 2024 10:48:27 +0000 Subject: [PATCH] [tplinksmarthome] support QuantityType commands Signed-off-by: Andrew Fiddian-Green --- .../tplinksmarthome/internal/device/BulbDevice.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bundles/org.openhab.binding.tplinksmarthome/src/main/java/org/openhab/binding/tplinksmarthome/internal/device/BulbDevice.java b/bundles/org.openhab.binding.tplinksmarthome/src/main/java/org/openhab/binding/tplinksmarthome/internal/device/BulbDevice.java index 97643eef1b59b..8ccd76cfc86e3 100644 --- a/bundles/org.openhab.binding.tplinksmarthome/src/main/java/org/openhab/binding/tplinksmarthome/internal/device/BulbDevice.java +++ b/bundles/org.openhab.binding.tplinksmarthome/src/main/java/org/openhab/binding/tplinksmarthome/internal/device/BulbDevice.java @@ -68,6 +68,13 @@ public boolean handleCommand(final ChannelUID channelUid, final Command command) response = handleOnOffType(channelId, onOffCommand, transitionPeriod); } else if (command instanceof HSBType hsbCommand && CHANNEL_COLOR.equals(channelId)) { response = handleHSBType(channelId, hsbCommand, transitionPeriod); + } else if (command instanceof QuantityType genericQuantity + && CHANNEL_COLOR_TEMPERATURE_ABS.equals(channelId)) { + QuantityType kelvinQuantity = genericQuantity.toInvertibleUnit(Units.KELVIN); + if (kelvinQuantity == null) { + return false; + } + response = handleDecimalType(channelId, new DecimalType(kelvinQuantity.intValue()), transitionPeriod); } else if (command instanceof DecimalType decimalCommand) { response = handleDecimalType(channelId, decimalCommand, transitionPeriod); } else {