[infrastructure] move infered nullness warnings to error and update EEA (#8949)
Signed-off-by: Jan N. Klug <jan.n.klug@rub.de>
This commit is contained in:
@@ -252,10 +252,12 @@ public class SmartMeterHandler extends BaseThingHandler {
|
||||
Channel channel = this.thing.getChannel(channelId.getId());
|
||||
if (channel != null) {
|
||||
String obis = channel.getProperties().get(SmartMeterBindingConstants.CHANNEL_PROPERTY_OBIS);
|
||||
MeterValue<?> value = this.smlDevice.getMeterValue(obis);
|
||||
if (value != null) {
|
||||
State state = getStateForObisValue(value, channel);
|
||||
updateState(channel.getUID(), state);
|
||||
if (obis != null) {
|
||||
MeterValue<?> value = this.smlDevice.getMeterValue(obis);
|
||||
if (value != null) {
|
||||
State state = getStateForObisValue(value, channel);
|
||||
updateState(channel.getUID(), state);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,28 +67,30 @@ public enum Conformity {
|
||||
// Negate if this channel has the unit "Watt" and the negate bit is set. Read from all other
|
||||
// channels the state and check if there is a negate bit.
|
||||
String channelObis = channel.getProperties().get(SmartMeterBindingConstants.CHANNEL_PROPERTY_OBIS);
|
||||
MeterValue<?> value = device.getMeterValue(channelObis);
|
||||
if (value != null && SmartHomeUnits.WATT.isCompatible(value.getUnit())) {
|
||||
for (String obis : device.getObisCodes()) {
|
||||
try {
|
||||
MeterValue<?> otherValue = device.getMeterValue(obis);
|
||||
ObisCode obisCode = ObisCode.from(obis);
|
||||
if (otherValue != null) {
|
||||
if (obisCode.matches((byte) 0x60, (byte) 0x05, (byte) 0x05)) {
|
||||
// we found status status obis 96.5.5
|
||||
if (NegateHandler.isNegateSet(otherValue.getValue(), 5)) {
|
||||
return currentState.negate();
|
||||
}
|
||||
} else if (obisCode.matches((byte) 0x01, (byte) 0x08, (byte) 0x00)) {
|
||||
// check obis 1.8.0 for status if status has negate bit set.
|
||||
String status = otherValue.getStatus();
|
||||
if (status != null && NegateHandler.isNegateSet(status, 5)) {
|
||||
return currentState.negate();
|
||||
if (channelObis != null) {
|
||||
MeterValue<?> value = device.getMeterValue(channelObis);
|
||||
if (value != null && SmartHomeUnits.WATT.isCompatible(value.getUnit())) {
|
||||
for (String obis : device.getObisCodes()) {
|
||||
try {
|
||||
MeterValue<?> otherValue = device.getMeterValue(obis);
|
||||
ObisCode obisCode = ObisCode.from(obis);
|
||||
if (otherValue != null) {
|
||||
if (obisCode.matches((byte) 0x60, (byte) 0x05, (byte) 0x05)) {
|
||||
// we found status status obis 96.5.5
|
||||
if (NegateHandler.isNegateSet(otherValue.getValue(), 5)) {
|
||||
return currentState.negate();
|
||||
}
|
||||
} else if (obisCode.matches((byte) 0x01, (byte) 0x08, (byte) 0x00)) {
|
||||
// check obis 1.8.0 for status if status has negate bit set.
|
||||
String status = otherValue.getStatus();
|
||||
if (status != null && NegateHandler.isNegateSet(status, 5)) {
|
||||
return currentState.negate();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to check negate status for obis {}", obis, e);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warn("Failed to check negate status for obis {}", obis, e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user