[miio] allow all quantitytypes and units (#9959)

Signed-off-by: Marcel Verpaalen <marcel@verpaalen.com>
This commit is contained in:
Marcel
2021-01-26 05:14:10 +01:00
committed by GitHub
parent c77d3b93f2
commit cc00fd78ee

View File

@@ -595,11 +595,14 @@ public class MiIoBasicHandler extends MiIoAbstractHandler {
logger.debug("'{}' channel '{}' has unit '{}' with symbol '{}'.", getThing().getUID(), logger.debug("'{}' channel '{}' has unit '{}' with symbol '{}'.", getThing().getUID(),
basicChannel.getChannel(), basicChannel.getUnit(), unit); basicChannel.getChannel(), basicChannel.getUnit(), unit);
updateState(basicChannel.getChannel(), new QuantityType<>(val.getAsBigDecimal(), unit)); updateState(basicChannel.getChannel(), new QuantityType<>(val.getAsBigDecimal(), unit));
return;
} else { } else {
logger.debug("Unit '{}' used by '{}' channel '{}' is not found.. using default unit.", logger.debug(
getThing().getUID(), basicChannel.getUnit(), basicChannel.getChannel()); "Unit '{}' used by '{}' channel '{}' is not found in conversion table... Trying anyway to submit as the update.",
basicChannel.getUnit(), getThing().getUID(), basicChannel.getChannel());
updateState(basicChannel.getChannel(),
new QuantityType<>(val.getAsBigDecimal().toPlainString() + " " + basicChannel.getUnit()));
} }
return;
} }
// if no unit is provided or unit not found use default units, these units have so far been seen for miio // if no unit is provided or unit not found use default units, these units have so far been seen for miio
// devices // devices