MySensors Serial Gateway - UNINITIALIZED - HANDLER_INITIALIZING_ERROR

I have a new problem regarding the mysensors serial gateway.

I have started with a fresh install of Openhab, and have found the documents detailing how to install an up to date java 8 version confusing and out of date. With that said, I’m not sure my java is working properly which may be causing this problem.

I have installed the mysensors binding via the paperUI marketplace, and after adding the serial gateway and configuring it, it says UNINITIALIZED - HANDLER_INITIALIZING_ERROR.

The logs in karafe gives:

18:08:16.675 [ERROR] [rnal.common.AbstractInvocationHandler] - An error occurred while calling method 'ThingHandler.initialize()' on 'org.openhab.binding.mysensors.handler.MySensorsBridgeHandler@1ae7e8b': null
java.lang.NullPointerException: null
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.loadCacheFile(MySensorsBridgeHandler.java:172) [225:org.openhab.binding.mysensors:2.3.0.201803141156]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:79) [225:org.openhab.binding.mysensors:2.3.0.201803141156]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]
18:08:16.893 [ERROR] [home.core.thing.internal.ThingManager] - Exception occurred while initializing handler of thing 'mysensors:bridge-ser:7e41fb40': null
java.lang.NullPointerException: null
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.loadCacheFile(MySensorsBridgeHandler.java:172) [225:org.openhab.binding.mysensors:2.3.0.201803141156]
        at org.openhab.binding.mysensors.handler.MySensorsBridgeHandler.initialize(MySensorsBridgeHandler.java:79) [225:org.openhab.binding.mysensors:2.3.0.201803141156]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:?]
        at org.eclipse.smarthome.core.internal.common.AbstractInvocationHandler.invokeDirect(AbstractInvocationHandler.java:153) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at org.eclipse.smarthome.core.internal.common.Invocation.call(Invocation.java:53) [109:org.eclipse.smarthome.core:0.10.0.b1]
        at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:?]
        at java.lang.Thread.run(Thread.java:748) [?:?]

Can anyone help me to debug this problem?

I can confirm that when using the command:

screen /dev/ttyUSB0 115200

I can see the debug information coming from the gateway:

0;255;3;0;9;0 MCO:BGN:INIT GW,CP=RNNGA---,VER=2.2.0
0;255;3;0;9;4 TSM:INIT
0;255;3;0;9;6 TSF:WUR:MS=0
0;255;3;0;9;14 TSM:INIT:TSP OK
0;255;3;0;9;17 TSM:INIT:GW MODE
0;255;3;0;9;20 TSM:READY:ID=0,PAR=0,DIS=0
0;255;3;0;9;23 MCO:REG:NOT NEEDED
0;255;3;0;14;Gateway startup complete.
0;255;0;0;18;2.2.0
0;255;3;0;9;28 MCO:BGN:STP
0;255;3;0;9;34 MCO:BGN:INIT OK,TSP=1

And when I operate a sensor node:

0;255;3;0;9;141450 TSF:MSG:READ,102-102-0,s=1,c=1,t=38,pt=7,l=5,sg=0:3.4
102;1;1;0;38;3.4
0;255;3;0;9;141457 TSF:MSG:READ,102-102-0,s=255,c=3,t=0,pt=1,l=1,sg=0:102
102;255;3;0;0;102
0;255;3;0;9;141470 TSF:MSG:READ,102-102-0,s=2,c=1,t=16,pt=1,l=1,sg=0:1
102;2;1;0;16;1

However, if I use the command:

cat /dev/ttyUSB0

I get nothing.

Still bashing my head against this, and nothing seems to be working :frowning:

I should have mentioned that I have upgraded from a Raspberry Pi 3 to a Raspberry Pi 3b+… hence the reinstall.

On what serial port is your mysensor gateway?
have you added openhab user to the dialout group?

Yes I think so, it is /ttyUSB0

I used the command:

sudo adduser -a -G openhab dialout

image

Show me:
lsusb

lsusb gives:

Bus 001 Device 013: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 005: ID 0424:7800 Standard Microsystems Corp. 
Bus 001 Device 003: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 002: ID 0424:2514 Standard Microsystems Corp. USB 2.0 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

sudo lshw

command not found

image

Ok, let me sleep on this. I tried to use this binding with mqtt but it was breaking my existing mqtt.
So I didn’t try the serial. Did you read the thread for this binding?

I have looked at the thread, and lots of others.

Thanks for taking the time to look, I’ll carry on trying some things :+1:

There is some guidance about the serial port on linux in the serial binding docs:

https://docs.openhab.org/addons/bindings/serial1/readme.html#linux-users

Good luck

i have the same issue, i’m using openhab 2.4 and mysensors binding 2.3.

everything was working good, once i’ve installed mqtt binding, mysensors gave the nullpointer exception

moved to mysensors 2.4 snapshot, nothing changed.

if I try to remove the mqtt binding to revert to previous situation, then mysensors faults:

2019-07-03 09:52:56.178 [ERROR] [org.openhab.binding.mysensors       ] - FrameworkEvent ERROR - org.openhab.binding.mysensors
org.osgi.framework.BundleException: Could not resolve module: 
org.openhab.binding.mysensors [271]
Unresolved requirement: Import-Package: org.eclipse.jdt.annotation; resolution:="optional"
Unresolved requirement: Import-Package: org.eclipse.smarthome.io.transport.mqtt

i think there is an incompatibility between mqtt libraries and mysensors in oh 2.4