diff --git a/CODEOWNERS b/CODEOWNERS index 159554ddd7c1c..28b70366058e7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -119,6 +119,7 @@ /bundles/org.openhab.binding.milight/ @davidgraeff /bundles/org.openhab.binding.minecraft/ @ibaton /bundles/org.openhab.binding.modbus/ @ssalonen +/bundles/org.openhab.binding.modbus.sunspec/ @mrbig /bundles/org.openhab.binding.mqtt/ @davidgraeff /bundles/org.openhab.binding.mqtt.generic/ @davidgraeff /bundles/org.openhab.binding.mqtt.homeassistant/ @davidgraeff @@ -192,7 +193,6 @@ /bundles/org.openhab.binding.sonyprojector/ @lolodomo /bundles/org.openhab.binding.spotify/ @Hilbrand /bundles/org.openhab.binding.squeezebox/ @digitaldan @mhilbush -/bundles/org.openhab.binding.modbus.sunspec/ @mrbig /bundles/org.openhab.binding.synopanalyzer/ @clinique /bundles/org.openhab.binding.systeminfo/ @svilenvul /bundles/org.openhab.binding.tado/ @dfrommi diff --git a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/handler/AbstractSunSpecHandler.java b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/handler/AbstractSunSpecHandler.java index b963eec02a6cf..1a9fd8dc879a1 100644 --- a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/handler/AbstractSunSpecHandler.java +++ b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/handler/AbstractSunSpecHandler.java @@ -497,7 +497,7 @@ protected State getScaled(Optional value, Short scaleFactor, U * @return the scaled value as a DecimalType */ protected State getScaled(Number value, Short scaleFactor, Unit unit) { - if (scaleFactor == 1) { + if (scaleFactor == 0) { return new QuantityType<>(value.longValue(), unit); } return new QuantityType<>(BigDecimal.valueOf(value.longValue(), scaleFactor * -1), unit); diff --git a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/AbstractBaseParser.java b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/AbstractBaseParser.java index 877aba47c0001..0385cdf1a831a 100644 --- a/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/AbstractBaseParser.java +++ b/bundles/org.openhab.binding.modbus.sunspec/src/main/java/org/openhab/binding/modbus/sunspec/internal/parser/AbstractBaseParser.java @@ -85,7 +85,7 @@ protected Integer extractUInt16(ModbusRegisterArray raw, int index, int def) { * @return the parsed value or empty if the field is not implemented */ protected Optional extractOptionalAcc32(ModbusRegisterArray raw, int index) { - return ModbusBitUtilities.extractStateFromRegisters(raw, index, ValueType.UINT32).map(DecimalType::longValue) + return ModbusBitUtilities.extractStateFromRegisters(raw, index, ValueType.INT32).map(DecimalType::longValue) .filter(value -> value != 0); } @@ -121,6 +121,6 @@ protected Optional extractOptionalSunSSF(ModbusRegisterArray raw, int ind * @return the parsed value or 1 if the field is not implemented */ protected Short extractSunSSF(ModbusRegisterArray raw, int index) { - return extractOptionalSunSSF(raw, index).orElse((short) 1); + return extractOptionalSunSSF(raw, index).orElse((short) 0); } }