Thanks for the original post here - very helpful. This helped me get my serial ports up and running on my Mac with an M1 processor. I’ve been putting off upgrading from 2.5 for ages now because I couldn’t get the ports to work properly, hopefully this will work going forwards.
Since Openhab 3.4.2 I don’t see the input overruns issuing problems with my serial connections.
dmesg still show them, but Openhab runs smoothly.
Recently I switched to the testing branch of Openhab 4.0.0. With that, I see the serial connections issues again. Was there any change in the
For now I switcht back to 3.4.2 but I’am afraid of the offical release.
I’m using openhab 4.0.3 (still) facing the serial connection issues. Every 1-2 weeks, suddenly no provider for usbtty isn’t found anymore.
Just installed the purejavacomm jar (as described above).
After starting the bundle, I got the message “Unresolved requirement: Import-Package: org.openhab.core.io.transport.serial; version=”[3.0.0,4.0.0)“”.
I checked my installed serial-javacomm package and saw that my installation uses the version 4.0.3.
If I’m understanding the message correctly, the version installed of the package is to new for the bundle.
Has anyone a solution to get the bundle running with OH4?
Did you try the feature:install openhab-transport-serial noted in the second post in this chain?
No, because it is imho already installed.
openhab> feature:list | grep serial
openhab-core-io-transport-serial-javacomm │ 4.0.3 │ x │ Started │ distro-4.0.3
Am I wrong?
I’m out of my league with the alternative java, but whenever I get that message, I run the command. I think there are several bundles that are installed with that command, not just one.
Yeah, the provider is bound to 3.x APIs. Because serial APIs in OH are still the same the import range is to restrictive. I’ll bring a new build for both OH versions.
Replying to myself, but there is OH 4.x version available: org.connectorio.addons.io.transport.serial.purejavacomm-4.0.0-20230928.jar.
@Tuny - can you pull it into first post? Installation is same as before, so your procedure still apply.
Thanks, did this.
thank you for providing a new version.
I tried to start the new version and got another exception:
Error starting bundle 280: Could not resolve module: org.connectorio.addons.io.transport.serial.purejavacomm 
Unresolved requirement: Import-Package: purejavacomm; version="[1.0.0,2.0.0)"
I compared the jar-file of the 3.0.0-version with the 4.0.0-version. Is it possible that the package ‘purejavacomm’ is left out in the 4.0.0-version-jarfile? Is the missing package the reason for the exception?
Do you provide the missing package in another jar I simply didn’t see? Or am I completely wrong?
Indeed, the purejavacomm package slipped away. I will update jar and let you know. OK, file was updated to
Temporary you can download jar with missing packages: https://repo1.maven.org/maven2/org/opensmarthouse/purejavacomm/1.0.5/purejavacomm-1.0.5.jar
Thank you for this helpful solution and to @splatch for the jar. The current java serial is still broken in 3.4.5.
This alternative serial provider works flawless not only with my smart meter reader but also with the EnOcean FT300 dongle. It would be great to have this packages as an official addon in OH.
Thank you for kind words. There is a PR open for donation of new adapter code from @kgoderis: Pure Java Comm - Initial Contribution by kgoderis · Pull Request #3632 · openhab/openhab-core · GitHub.
It was intended for Apple silicon which is not yet supported by nrjavaserial. I am not sure what is state of acceptance for this work, because there are other implications (serial over tcp and eventual latency of non-native implementation).
Anyhow - regardless of PR I am going to keep this provider alive. I was really tired of locking issues with nrjavaserial and its inability to work properly on stock arch linux. I recently managed to compile it with liblockdev, primarily to test
jrxtx for wireless m-bus binding, and it was far away from joy.
Anyhow - I will try to streamline your experience a bit with bunch of docs and simpler installation procedure (ETA until end of this year). I also have a serial test command to verify if port is accessible within OH shell itself.
May be my experience with serial communications in OH will help to somebody. Few month ago I wrote addon for my boiler. Addon use serial connection to boiler. All works ok on test windows OH but with only few hours uptime every day. After that I installed this addon to my production OH instance. My bundle lost connection every few days. Ubuntu logs show issues with driver. I updated my ubuntu kernel to latest and have few weeks uptime now. As I understood in my installation issue was located in linux serial driver for cp2103 serial connector, not in OH or java serial library. I tested it on OH 4.0.4. If you have issues with serial connection, try to write some script without java and run it for connection stability test for few days.
If you are correct, this would be very interesting news indeed. Only thing I’m wondering is this issue seems to also be a problem for users of operating systems other then linux. This alternative serial provider is made available because the nrjavaserial library used in openHAB had a known bug. One of the developers of nrjavaserial posted on this forum confirming the bug. Wouter has provided a patched version which is used in the current version of openHAB. It should be included in the version you say you are using (4.0.4)
Anyhow, please let us know the results of your testing once a period of time has past
Another question is the binding you were using that dropped the serial connection every few days self authored? Just confirm binding in question is not official or available on the markeplace, it is something you wrote yourself?