[fronius] Fix DecimalType constructor change (#12371)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
parent
094cb7f12d
commit
2cce90f83d
|
@ -12,8 +12,6 @@
|
||||||
*/
|
*/
|
||||||
package org.openhab.binding.fronius.internal.handler;
|
package org.openhab.binding.fronius.internal.handler;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
import org.eclipse.jdt.annotation.NonNull;
|
import org.eclipse.jdt.annotation.NonNull;
|
||||||
import org.openhab.binding.fronius.internal.FroniusBridgeConfiguration;
|
import org.openhab.binding.fronius.internal.FroniusBridgeConfiguration;
|
||||||
import org.openhab.binding.fronius.internal.FroniusCommunicationException;
|
import org.openhab.binding.fronius.internal.FroniusCommunicationException;
|
||||||
|
@ -109,18 +107,14 @@ public abstract class FroniusBaseThingHandler extends BaseThingHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
State state = null;
|
State state = null;
|
||||||
if (value instanceof BigDecimal) {
|
if (value instanceof QuantityType) {
|
||||||
state = new DecimalType((BigDecimal) value);
|
state = (QuantityType) value;
|
||||||
} else if (value instanceof Integer) {
|
} else if (value instanceof Number) {
|
||||||
state = new DecimalType(BigDecimal.valueOf(((Integer) value).longValue()));
|
state = new DecimalType((Number) value);
|
||||||
} else if (value instanceof Double) {
|
|
||||||
state = new DecimalType((double) value);
|
|
||||||
} else if (value instanceof ValueUnit) {
|
} else if (value instanceof ValueUnit) {
|
||||||
state = new DecimalType(((ValueUnit) value).getValue());
|
state = new DecimalType(((ValueUnit) value).getValue());
|
||||||
} else if (value instanceof String) {
|
} else if (value instanceof String) {
|
||||||
state = new StringType((String) value);
|
state = new StringType((String) value);
|
||||||
} else if (value instanceof QuantityType) {
|
|
||||||
state = (QuantityType) value;
|
|
||||||
} else {
|
} else {
|
||||||
logger.warn("Update channel {}: Unsupported value type {}", channelId, value.getClass().getSimpleName());
|
logger.warn("Update channel {}: Unsupported value type {}", channelId, value.getClass().getSimpleName());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue