openhab/org.openhab.binding.zigbee

Displaying zigbee nodes in CLI does fail with NullPointerException

yuergen opened this issue · 6 comments

Outline

Displaying the nodes in the ZigBee network does fail with a NullPointerException.

My understanding from a different bug report (or forum post, I cannot find it anymore) is that this might be caused by the ZigBee binding's XML files. Attaching the files here does not work, however I have uploaded them to a gist: (https://gist.github.com/yuergen/4d24abd372f037da0b9c1d4594fc0d60)

Configuration

Configuration Description
Coordinator used Smabit AV2010/10 / Ember
openHAB version 3.2.0M3
Hardware x86-64, i3-4160T
Memory 8GB, 78% available
Java version openjdk 11.0.12 2021-07-20 LTS, zulu11-jre-headless
Devices EgWohnzimmerTischlampe 001788010452280f \ EgWohnzimmerStehlampe 001788010859cca0 \ EgWohnzimmerStehlampeSofa 001788010856df32 \ EgWohnzimmerSchrlampe1 00178801085d5e00 \ EgWohnzimmerSchrlampe2 00178801085d5dc2 \ EgGarderobeLampe 0017880104501cd0 \ gaGaragenbeleuchtung b4e3f9fffe266c30 \ UgLagerraumLampe 0017880103374736 \ UgWaschkuecheLampe 00178801045023c1 \ Ember Coordinatorzigbee:coordinator_ember:013E70B9

Logs

2021-10-17 17:54:05.586 [ERROR] [b.core.io.console.ConsoleInterpreter] - An error occurred while executing the console command.
java.lang.NullPointerException: null
        at com.zsmartsystems.zigbee.ZigBeeDeviceType.getByValue(ZigBeeDeviceType.java:648) ~[?:?]
        at com.zsmartsystems.zigbee.console.ZigBeeConsoleNodeListCommand.printNode(ZigBeeConsoleNodeListCommand.java:96) ~[?:?]
        at com.zsmartsystems.zigbee.console.ZigBeeConsoleNodeListCommand.process(ZigBeeConsoleNodeListCommand.java:71) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.handleZigbeeCommand(ZigBeeConsoleCommandExtension.java:149) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.handleCommand(ZigBeeConsoleCommandExtension.java:117) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.execute(ZigBeeConsoleCommandExtension.java:89) ~[?:?]
        at org.openhab.core.io.console.ConsoleInterpreter.execute(ConsoleInterpreter.java:55) [bundleFile:?]
        at org.openhab.core.io.console.karaf.internal.CommandWrapper.execute(CommandWrapper.java:78) [bundleFile:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [bundleFile:4.3.3]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:4.3.3]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]

The zigbee node command also fails except for node 0 (the coordinator):

openhab> zigbee node 0                                                                                                                                                                                           
IEEE Address     : 000D6F000DB9EFE3
Network Address  : 0
Node Descriptor  : NodeDescriptor [apsFlags=0, bufferSize=82, complexDescriptorAvailable=false, manufacturerCode=ABCD, logicalType=COORDINATOR, serverCapabilities=[PRIMARY_TRUST_CENTER, NETWORK_MANAGER], incomingTransferSize=128, outgoingTransferSize=128, userDescriptorAvailable=false, frequencyBands=[FREQ_2400_MHZ], macCapabilities=[ALTERNATIVE_PAN, FULL_FUNCTION_DEVICE, MAINS_POWER, RECEIVER_ON_WHEN_IDLE], extendedEndpointListAvailable=false, extendedSimpleDescriptorListAvailable=false, stackCompliance=21]
Power Descriptor : PowerDescriptor [currentPowerMode=RECEIVER_ON_IDLE, availablePowerSources=[MAINS], currentPowerSource=MAINS, powerLevel=FULL]
Associations     : []
Endpoints        : 
Neighbors:
NeighborTable [extendedPanId=37296339126E6B7E, extendedAddress=0017880104501CD0, networkAddress=37273, deviceType=ROUTER, rxOnWhenIdle=RX_ON, relationship=SIBLING, permitJoining=UNKNOWN, depth=15, lqi=254]
NeighborTable [extendedPanId=37296339126E6B7E, extendedAddress=0017880103374736, networkAddress=64327, deviceType=ROUTER, rxOnWhenIdle=RX_ON, relationship=SIBLING, permitJoining=UNKNOWN, depth=15, lqi=255]
NeighborTable [extendedPanId=37296339126E6B7E, extendedAddress=001788010452280F, networkAddress=2676, deviceType=ROUTER, rxOnWhenIdle=RX_ON, relationship=SIBLING, permitJoining=UNKNOWN, depth=15, lqi=247]
NeighborTable [extendedPanId=37296339126E6B7E, extendedAddress=00178801045023C1, networkAddress=32647, deviceType=ROUTER, rxOnWhenIdle=RX_ON, relationship=SIBLING, permitJoining=UNKNOWN, depth=15, lqi=254]
Routes:
RoutingTable [destinationAddress=33935, status=DISCOVERY_UNDERWAY, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=0]
RoutingTable [destinationAddress=32647, status=ACTIVE, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=32647]
RoutingTable [destinationAddress=2676, status=ACTIVE, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=2676]
RoutingTable [destinationAddress=37273, status=ACTIVE, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=37273]
RoutingTable [destinationAddress=64327, status=ACTIVE, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=64327]
RoutingTable [destinationAddress=0, status=INACTIVE, memoryConstrained=false, manyToOne=false, routeRecordRequired=false, nextHopAddress=0]

openhab> zigbee node 2676
An unexpected error occurred during execution.
openhab> zigbee node 30727
An unexpected error occurred during execution.
openhab> zigbee node 32647
An unexpected error occurred during execution.
openhab> zigbee node 33935 
An unexpected error occurred during execution.
openhab> zigbee node 37273
An unexpected error occurred during execution.
openhab> zigbee node 48739
An unexpected error occurred during execution.
openhab> zigbee node 64327
An unexpected error occurred during execution.
openhab>   

The openhab log file does contain the following stack trace for all the commands from the CLI:

2021-10-17 20:55:47.748 [ERROR] [b.core.io.console.ConsoleInterpreter] - An error occurred while executing the console command.      
java.lang.NullPointerException: null                                                                                                                                                                             
        at com.zsmartsystems.zigbee.ZigBeeDeviceType.getByValue(ZigBeeDeviceType.java:648) ~[?:?]
        at com.zsmartsystems.zigbee.console.ZigBeeConsoleDescribeNodeCommand.outputEndpoint(ZigBeeConsoleDescribeNodeCommand.java:90) ~[?:?]
        at com.zsmartsystems.zigbee.console.ZigBeeConsoleDescribeNodeCommand.process(ZigBeeConsoleDescribeNodeCommand.java:74) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.handleZigbeeCommand(ZigBeeConsoleCommandExtension.java:149) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.handleCommand(ZigBeeConsoleCommandExtension.java:117) ~[?:?]
        at org.openhab.binding.zigbee.console.internal.ZigBeeConsoleCommandExtension.execute(ZigBeeConsoleCommandExtension.java:89) ~[?:?]
        at org.openhab.core.io.console.ConsoleInterpreter.execute(ConsoleInterpreter.java:55) [bundleFile:?]
        at org.openhab.core.io.console.karaf.internal.CommandWrapper.execute(CommandWrapper.java:78) [bundleFile:?]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:68) [bundleFile:4.3.3]
        at org.apache.karaf.shell.impl.console.osgi.secured.SecuredCommand.execute(SecuredCommand.java:86) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:599) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:526) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:415) [bundleFile:4.3.3]
        at org.apache.felix.gogo.runtime.Pipe.doCall(Pipe.java:416) [bundleFile:4.3.3]          
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:229) [bundleFile:4.3.3]            
        at org.apache.felix.gogo.runtime.Pipe.call(Pipe.java:59) [bundleFile:4.3.3]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]                                                                                                                 
        at java.lang.Thread.run(Thread.java:829) [?:?]                             

This issue is not related to openHAB - it's part of the zigbee library so I'll close this here.

Thank you for the clarification. The information is right in the stack trace. I should have seen it there. Do you mind if I report this against the ZigBee library?

Do you mind if I report this against the ZigBee library?

No - this is fine, but I have already fixed these two issues. If you find more instances of this then by all means feel free to open an issue in the library issue list.

Just for clarity, this is caused by devices using non standard device types - or at least types that are not defined in the library and the library just needs to be tolerant of this.

Creating issues for problems that are already fixes does make zero sense. Thank you for the information.

If the fixed libraries will be included into openhab 3.2.0 M4, I would test this in about another week once it is released.

The milestone 3.2.0 M4 build does solve this issue. The release notes state that Z-Smart Systems library has been upgraded to 1.4.1. I can now use the zigbee node command without any exceptions. 😄