Skip to content

Commit

Permalink
[tplinksmarthome] support QuantityType commands (#17946)
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Fiddian-Green <[email protected]>
  • Loading branch information
andrewfg authored Dec 21, 2024
1 parent 108067a commit 56d447f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 56d447f

Please sign in to comment.