[remoteopenhab] Accept Decimal state for items of type Number with a dimension (#9151)

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2020-11-28 06:30:24 +01:00 committed by GitHub
parent a3835ebdc6
commit 7130886d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -463,9 +463,13 @@ public class RemoteopenhabBridgeHandler extends BaseBridgeHandler
}
} else if (acceptedItemType.startsWith(CoreItemFactory.NUMBER + ":")) {
// Item type Number with dimension
if (checkStateType(itemName, stateType, "Quantity")) {
if (stateType == null || "Quantity".equals(stateType)) {
List<Class<? extends State>> stateTypes = Collections.singletonList(QuantityType.class);
channelState = TypeParser.parseState(stateTypes, state);
} else if ("Decimal".equals(stateType)) {
channelState = new DecimalType(state);
} else {
logger.debug("Unexpected value type {} for item {}", stateType, itemName);
}
} else {
switch (acceptedItemType) {