Skip to content

Commit 2ee6144

Browse files
authored
DVCSMP-3664 Fix NPE in zigbee metering plug (#11345)
1 parent 83c35be commit 2ee6144

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

devicetypes/smartthings/zigbee-metering-plug.src/zigbee-metering-plug.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,13 @@ def parse(String description) {
8585

8686
attrData.each {
8787
def map = [:]
88-
if (it.clusterInt == zigbee.SIMPLE_METERING_CLUSTER && it.attrInt == ATTRIBUTE_HISTORICAL_CONSUMPTION) {
88+
if (it.value && it.clusterInt == zigbee.SIMPLE_METERING_CLUSTER && it.attrInt == ATTRIBUTE_HISTORICAL_CONSUMPTION) {
8989
log.debug "power"
9090
map.name = "power"
9191
map.value = zigbee.convertHexToInt(it.value)/powerDiv
9292
map.unit = "W"
9393
}
94-
else if (it.clusterInt == zigbee.SIMPLE_METERING_CLUSTER && it.attrInt == ATTRIBUTE_READING_INFO_SET) {
94+
else if (it.value && it.clusterInt == zigbee.SIMPLE_METERING_CLUSTER && it.attrInt == ATTRIBUTE_READING_INFO_SET) {
9595
log.debug "energy"
9696
map.name = "energy"
9797
map.value = zigbee.convertHexToInt(it.value)/energyDiv

0 commit comments

Comments
 (0)