steand / optolink

optolink adapter to vitotronic for openhab2
GNU Lesser General Public License v3.0
12 stars 19 forks source link

Problem on raspberry pi Jessie #4

Closed Torschen closed 7 years ago

Torschen commented 7 years ago

Hi, I like to monitor and control our Viessmann heating using openhab2 and this adapter.

I downloaded optolink-bin-1.0.0-RC1.zip and nupacked it on an Raspberry Pi 3 running Jessie I get the following error:

./start_debug.sh

16:56:49.384 [main] INFO de.myandres.optolink.Config - 6 Things are parsed 16:56:49.387 [main] DEBUG d.m.optolink.OptolinkInterface - Open TTY /dev/ttyUSB0 ... Experimental: JNI_OnLoad called. Stable Library

Native lib Version = RXTX-2.1-7 Java lib Version = RXTX-2.1-7 16:56:49.451 [main] ERROR de.myandres.optolink.Main main - Something is wrong not init gnu.io.NoSuchPortException: null at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218) ~[optolink-jar-with-dependencies.jar:na] at de.myandres.optolink.OptolinkInterface.(OptolinkInterface.java:44) ~[optolink-jar-with-dependencies.jar:na] at de.myandres.optolink.Main.main(Main.java:39) ~[optolink-jar-with-dependencies.jar:na] Exception in thread "main" java.lang.NullPointerException at de.myandres.optolink.Main.main(Main.java:46)

Does anyone have similar issues? I don't know what gnu.io.NoSuchPortException: null is supposed to mean.

I don't have problems communicating with the heating system using vcontrold.

Thanks for any help!

steand commented 7 years ago

Hello @Torschen,

Please look at the rights of the device and user. It must look like: rpi /dev $ ls -la ttyA* crw-rw---T 1 root dialout 204, 64 Mär 12 20:56 ttyAMA0 pi@rpi /dev $

pi@rpi /dev $ id uid=1000(pi) gid=1000(pi) Gruppen=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video),46(plugdev),60(games),100(users),105(netdev),999(input),1002(spi),1003(gpio)

The Group rights must be dialout. (eq. in my case)

Regards Stefan

Torschen commented 7 years ago

Hi Stefan,

thanks a lot for your help. I checked the rights and group and they were the same as yours (besides the sticky bit but it did not make any changes). I still get the same error. I switched to FHEM for the moment but would like to come back to OH2. I therefore appreciate your idea for an optolink 2.0 version. I would be available for testing.

Thanks

steand commented 7 years ago

I havn't a PI 3 and no USB adapter. So could test it. I have checked the code again and it must work. My feeling is, that the RXTX didn't find the device /dev/ttyUSB0. -> gnu.io.NoSuchPortException: null Mybe the Article helps.

also you can check the rxtx installation. it must look like:

pi@rpi ~ $ dpkg -s librxtx-java
Package: librxtx-java
Status: install ok installed
Priority: optional
Section: java
Installed-Size: 890
Maintainer: Debian Java maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Architecture: armhf
Source: rxtx
Version: 2.2pre2-11
Provides: lib-rxtx-java
Depends: libc6 (>= 2.13-28)
Conflicts: lib-rxtx-java
Description: Full Java CommAPI implementation
 RXTX is a full implementation of the Java CommAPI from Sun. It
 contains  native libraries providing serial and parallel
 communication for the Java Development Toolkit.
Homepage: http://www.rxtx.org
chrostek commented 7 years ago

I have the same problem. Original Optolink USB Adapter, RPi1. Tried jessie and wheezy ... same error on both:

18:37:24.945 [main] DEBUG d.m.optolink.OptolinkInterface <init> - Open TTY /dev/ttyUSB0 ...
Stable Library

Native lib Version = RXTX-2.2pre2
Java lib Version   = RXTX-2.1-7
WARNING:  RXTX Version mismatch
    Jar version = RXTX-2.1-7
    native lib Version = RXTX-2.2pre2
18:37:25.161 [main] ERROR de.myandres.optolink.Main main - Something is wrong not init
gnu.io.NoSuchPortException: null
    at gnu.io.CommPortIdentifier.getPortIdentifier(CommPortIdentifier.java:218) ~[optolink-jar-with-dependencies.jar:na]
    at de.myandres.optolink.OptolinkInterface.<init>(OptolinkInterface.java:44) ~[optolink-jar-with-dependencies.jar:na]
    at de.myandres.optolink.Main.main(Main.java:39) ~[optolink-jar-with-dependencies.jar:na]
Exception in thread "main" java.lang.NullPointerException
    at de.myandres.optolink.Main.main(Main.java:46)
dpkg -s librxtx-java

Package: librxtx-java
Status: install ok installed
Priority: optional
Section: java
Installed-Size: 890
Maintainer: Debian Java maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Architecture: armhf
Source: rxtx
Version: 2.2pre2-11
Provides: lib-rxtx-java
Depends: libc6 (>= 2.13-28)
Conflicts: lib-rxtx-java
Description: Full Java CommAPI implementation
 RXTX is a full implementation of the Java CommAPI from Sun. It
 contains  native libraries providing serial and parallel
 communication for the Java Development Toolkit.
Homepage: http://www.rxtx.org

tried oracle-java7-jdk and oracle-java8-jdk

I'm working as root, so i don't think that rights could be a problem. also tried to symlink /dev/ttyUSB0 to /dev/ttyS0 (some people recommend this with USB adapters) ... no luck ...

Original openv works ... so the interface must be okay any further ideas?

chrostek commented 7 years ago

omg ... solution is too simple ... in your start*.sh files you also have defined the port:

prog_arg="${prog_arg} -Dgnu.io.rxtx.SerialPorts=/dev/ttyAMA0"

changing it here to solves the problem ...

Torschen commented 7 years ago

I can confirm that also for me changing "/dev/ttyAMA0" to "/dev/ttyUSB0" in the start-up file solves the problem with the USB optolink adapter. Thanks for all the help. Maybe the information that the start-up files have to be edited if an USB adapter is used can be added to the installation instructions.