diff --git a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/monitoring/AbstractGetPowerQualityProfileHandler.java b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/monitoring/AbstractGetPowerQualityProfileHandler.java index 411fe49af69..57aab0a37c4 100644 --- a/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/monitoring/AbstractGetPowerQualityProfileHandler.java +++ b/osgp/protocol-adapter-dlms/osgp-protocol-adapter-dlms/src/main/java/org/opensmartgridplatform/adapter/protocol/dlms/domain/commands/monitoring/AbstractGetPowerQualityProfileHandler.java @@ -494,11 +494,20 @@ private ProfileEntryValueDto makeGsmDiagnosticProfileEntryValueDto( try { if (selectableObject.attributeIndex == GsmDiagnosticAttribute.CELL_INFO.attributeId()) { if (selectableObject.dataIndex == DATA_INDEX_SIGNAL_QUALITY) { - final int value = this.dlmsHelper.readLong(dataObject, "Read signal quality").intValue(); + final Long signalQualityLong = + this.dlmsHelper.readLong(dataObject, "Read signal quality"); + if (signalQualityLong == null) { + return notKnownProfileEntryValue(); + } + final int value = signalQualityLong.intValue(); final SignalQualityDto signalQuality = SignalQualityDto.fromIndexValue(value); return new ProfileEntryValueDto(signalQuality.value()); } else if (selectableObject.dataIndex == DATA_INDEX_BER) { - final int value = this.dlmsHelper.readLong(dataObject, "Read ber").intValue(); + final Long berLong = this.dlmsHelper.readLong(dataObject, "Read ber"); + if (berLong == null) { + return notKnownProfileEntryValue(); + } + final int value = berLong.intValue(); return new ProfileEntryValueDto(value); } } @@ -510,6 +519,10 @@ private ProfileEntryValueDto makeGsmDiagnosticProfileEntryValueDto( return new ProfileEntryValueDto(debugInfo); } + private static ProfileEntryValueDto notKnownProfileEntryValue() { + return new ProfileEntryValueDto(99); + } + private ProfileEntryValueDto createNumericProfileEntryValueDto( final DataObject dataObject, final SelectableObject selectableObject) { try {