zsmartsystems / com.zsmartsystems.zigbee.sniffer

ZigBee sniffer using Ember NCP and routing packets to Wireshark for display
Eclipse Public License 1.0
32 stars 17 forks source link

Null Exception Error #34

Open erikellis13 opened 6 months ago

erikellis13 commented 6 months ago

I'm very new to this, so I'm assuming this is something I'm doing incorrectly. Using a Raspberry Pi4 with Ubuntu 23.10

I've used both the precompiled jar, and my own using MAVEN. The output is the same

java -jar com.zsmartsystems.zigbee.sniffer-1.0.2.jar -port /dev/ttyUSB0  -baud 115200 -flow hardware Z-Smart Systems Ember Packet Sniffer

I'm getting this as a return.

Exception in thread "main" java.lang.NullPointerException: Cannot invoke "String.startsWith(String)" because "number" is null at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.parseDecimalOrHexInt(ZigBeeSniffer.java:400) at com.zsmartsystems.zigbee.sniffer.ZigBeeSniffer.main(ZigBeeSniffer.java:141)

cdjackson commented 6 months ago

From the log it seems that the baud rate is not set, but it does look ok on the command line from what you've posted. I've bumped a few dependencies, and also default the baud to 115k2, so please try the compiling with the latest source and see if that makes any difference.

erikellis13 commented 6 months ago

Using the new compiled .jar. I received this error Z-Smart Systems Ember Packet Sniffer NCP initialisation starting... SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. Opened serial port /dev/ttyUSB1 at 115200 Unable to communicate with Ember NCP Unable to initialise NCP

This took me down a rabbit hole which resolved into the I had to add a SLF4J Dependency. The following is extremely long. I apologize.


<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
    <version>1.7.32</version> <!-- Adjust version as needed -->
</dependency>

And a Logging Dependency

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.4.14</version> <!-- Adjust version as needed -->
</dependency>

And a Logback XML

<configuration>
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="debug">
        <appender-ref ref="STDOUT" />
    </root>
</configuration>

I recompiled, and got this response.

10:24:16.157 [main] DEBUG org.scijava.nativelib.NativeLibraryUtil -- platform specific path is natives/linux_arm64/
10:24:16.157 [main] DEBUG org.scijava.nativelib.BaseJniExtractor -- mappedLib is libjssc.so
10:24:16.159 [main] DEBUG org.scijava.nativelib.BaseJniExtractor -- URL is jar:file:/home/zbox/Documents/Zigbee/com.zsmartsystems.zigbee.sniffer-1.0.3.jar!/natives/linux_arm64/libjssc.so
10:24:16.160 [main] DEBUG org.scijava.nativelib.BaseJniExtractor -- URL path is file:/home/zbox/Documents/Zigbee/com.zsmartsystems.zigbee.sniffer-1.0.3.jar!/natives/linux_arm64/libjssc.so
10:24:16.162 [main] DEBUG org.scijava.nativelib.BaseJniExtractor -- Extracting 'jar:file:/home/zbox/Documents/Zigbee/com.zsmartsystems.zigbee.sniffer-1.0.3.jar!/natives/linux_arm64/libjssc.so' to '/tmp/nativelib-loader_12173001559516390573/libjssc.so'
10:24:16.227 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH: Connect
10:24:16.227 [AshReceiveParserThread] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshReceiveParserThread thread started
10:24:16.231 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH: Reconnect
10:24:16.239 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- --> TX ASH frame: AshFrameRst []
10:24:16.479 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH TX EZSP: EzspVersionRequest [networkId=0, desiredProtocolVersion=4]
10:24:19.450 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH: Reconnect
10:24:19.451 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- --> TX ASH frame: AshFrameRst []
10:24:22.653 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH: Reconnect
10:24:22.654 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- --> TX ASH frame: AshFrameRst []
10:24:25.855 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- ASH: Reconnect
10:24:25.856 [AshTimer-thread-1] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- --> TX ASH frame: AshFrameRst []
10:24:26.483 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- Sending EZSP transaction timed out after 10 seconds
10:24:26.484 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.EmberNcp -- No response from ezspVersion command
10:24:26.485 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp -- EZSP Dongle: Version returned null. ASH/EZSP not initialised.
Unable to communicate with Ember NCP
10:24:26.486 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp -- EZSP Dongle: Shutdown
10:24:26.487 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshFrameHandler close.
10:24:26.489 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp -- Ember: Link State change to false, initialised=false, networkStateUp=false
10:24:26.490 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.ZigBeeDongleEzsp -- Ember: Link State change to false ignored.
10:24:26.492 [AshReceiveParserThread] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshReceiveParserThread exited.
10:24:26.493 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshFrameHandler parser thread terminated.
10:24:26.494 [AshReceiveProcessorThread] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshFrameHandler InterruptedException processing EZSP frame
10:24:26.495 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshFrameHandler processor thread terminated.
10:24:26.496 [main] DEBUG com.zsmartsystems.zigbee.dongle.ember.internal.ash.AshFrameHandler -- AshFrameHandler close complete.
10:24:26.504 [main] INFO com.zsmartsystems.zigbee.serial.ZigBeeSerialPort -- Serial port '/dev/ttyUSB0' closed.
Unable to initialise NCP

I couldn't find a way to resolve this error. I am using a Nortek HUSBZB-1 my drivers have been updated and Ubuntu is seeing it. However it seems as though ASH is timing out due to non-response from the dongle.

Again I apologize for the length of this thread

cdjackson commented 6 months ago

Thanks. And this is a short debug log compared to some I see, so no problem at all (better more than less in most cases).

It's been a while since I've worked with someone using the HUSBZB-1 so I can't remember the firmware. Are you using the firmware that came with it or is it updated? I'm wondering if 115k2 is correct - you could try 38400 for the baud rate instead maybe.

erikellis13 commented 6 months ago

I had to check the baud rate on the Nortek HUSBZB-1,it was 57600. Once I updated the .java file and recompiled the new jar. Seems to be working. Is this what its supposed to look like?

Opened serial port /dev/ttyUSB2 at 57600 Ember NCP version : 5.4.1.0 Ember NCP EUI : 000D6F0018753189 NCP initialisation complete... Wireshark destination : XXXXXXX Logging on channel : 15 No device ID set. Last 16 bits of device EUID will be used. No NCP data received for 30 seconds. Restarting NCP! NCP shutting down...

cdjackson commented 6 months ago

Yes, this looks fine, but it seems no zigbee data is received.

You should be able to change the baud rate on the command line - it works fine here and I know for others. I'm not sure why this doesn't work for you - if you're able to try and debug that it would be useful (it's much easier than having to recompile)