mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-01-25 14:55:55 +01:00
[avmfritz] Added warning if temperature command cannot be converted to Celsius (#9778)
Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
parent
e651aa6d03
commit
7e28fbb3c5
@ -367,8 +367,15 @@ public abstract class AVMFritzBaseThingHandler extends BaseThingHandler implemen
|
|||||||
if (command instanceof DecimalType) {
|
if (command instanceof DecimalType) {
|
||||||
temperature = normalizeCelsius(((DecimalType) command).toBigDecimal());
|
temperature = normalizeCelsius(((DecimalType) command).toBigDecimal());
|
||||||
} else if (command instanceof QuantityType) {
|
} else if (command instanceof QuantityType) {
|
||||||
temperature = normalizeCelsius(
|
@SuppressWarnings("unchecked")
|
||||||
((QuantityType<Temperature>) command).toUnit(SIUnits.CELSIUS).toBigDecimal());
|
QuantityType<Temperature> convertedCommand = ((QuantityType<Temperature>) command)
|
||||||
|
.toUnit(SIUnits.CELSIUS);
|
||||||
|
if (convertedCommand != null) {
|
||||||
|
temperature = normalizeCelsius(convertedCommand.toBigDecimal());
|
||||||
|
} else {
|
||||||
|
logger.warn("Unable to convert unit from '{}' to '{}'. Skipping command.",
|
||||||
|
((QuantityType<?>) command).getUnit(), SIUnits.CELSIUS);
|
||||||
|
}
|
||||||
} else if (command instanceof IncreaseDecreaseType) {
|
} else if (command instanceof IncreaseDecreaseType) {
|
||||||
temperature = state.getHkr().getTsoll();
|
temperature = state.getHkr().getTsoll();
|
||||||
if (IncreaseDecreaseType.INCREASE.equals(command)) {
|
if (IncreaseDecreaseType.INCREASE.equals(command)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user