org.openhab.binding.zwave: Workaround causes serial port discovery issues
The binding currently uses serialPortManager.getIdentifiers() to get the SerialPortIdentifier
.
This workaround was added in https://github.com/openhab/org.openhab.binding.zwave/pull/1222 by @bodiroga.
The workaround causes serial port detection issues because the getIdentifiers()
method will only return discovered ports.
As a result:
- Undiscovered (non-standard) RXTX ports will not work this way (e.g ports defined in udev rules), the transport adds undiscovered ports to
gnu.io.rxtx.SerialPorts
so they can be used without users having to configure this - RFC2217 ports cannot be used because there is no discovery logic for these ports.
Perhaps the workaround can be removed by instead detecting that a controller is disconnected by just opening the port and handling any resulting exceptions?
Related to:
About this issue
- Original URL
- State: open
- Created 4 years ago
- Comments: 22 (20 by maintainers)
Commits related to this issue
- Update nrjavaserial in TP to 5.2.1 With this version it will no longer completely exit the JVM in certain scenarios when ports are closed/reopened. Related to: * openhab/org.openhab.binding.zigbee#... — committed to wborn/openhab-core by wborn 4 years ago
- Update nrjavaserial in TP to 5.2.1 (#1503) With this version it will no longer completely exit the JVM in certain scenarios when ports are closed/reopened. Related to: * openhab/org.openhab.bin... — committed to openhab/openhab-core by wborn 4 years ago
- Update nrjavaserial in TP to 5.2.1 (#1503) With this version it will no longer completely exit the JVM in certain scenarios when ports are closed/reopened. Related to: * openhab/org.openhab.binding... — committed to ConnectorIO/copybara-hab-core by wborn 4 years ago
I think you did an excellent job to try to get it working @RafalLukawiecki as newcomer. Back when I started working on openHAB I also found it very difficult to understand how everything works together (even as a seasoned Java developer). What worked for me was fixing small issues in add-ons and learning my way around everything eventually.
For me the RFC2217 part is new and looks like you’ve uncovered quite a few issues with it. It probably has to do with that it’s not used by many. Which is reinforced by the same issues of course.
Hopefully we do can get it fixed/improved eventually. After spending 35 hours and without a positive outlook to get it fixed it’s OK to give up. Thanks for recompiling the FreeBSD nrjavaserial libraries and triggering me to have a look at the RFC2217 part. 👍 I’ll continue to make some improvements for it.
Hi guys!
Sorry for being a little bit late to the party, but I will try to help fixing this bug and testing the proposed solution 👍
As far as I remember, that workaround was introduced because the function
serialPortManager.getIdentifier(portId);
didn’t return null when the USB controller was unplugged and, thus, making the binding believe everything was ‘ok’. I know that it doesn’t make any sense, but that was what happened on my computer and I explain it in the PR (see https://github.com/openhab/org.openhab.binding.zwave/pull/1222).I will start up the Eclipse IDE, replace my function with the original one and test it again, let’s see if things have changed (I hope so). I will also get a spare Raspberry Pi and test the RFC2217 functionality 🤞
Many thanks to @RafalLukawiecki for his awesome work during this week (your job with the nrjavaserial library has been amazing) and @wborn for having a look at this topic 🎆
Best regards,
Aitor