openhab / openhab/org.openhab.binding.zigbee

Workaround causes serial port discovery issues

Open
#577 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
76
Forks
112
PR merge metrics
No merged PRs in 30d

Description

The binding currently uses serialPortManager.getIdentifiers() to see if there are any SerialPortIdentifiers.

This workaround was added in https://github.com/openhab/org.openhab.binding.zigbee/pull/335 by @triller-telekom.

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.

We've upgraded nrjavaserial in OH3 so we should retest if this is still an issue.
We should also test if it is fixed with nrjavaserial 5.1.0+ because it contains fixes for hardware that gets removed.

If this is no longer an issue we should remove the workaround by instead detecting that a controller is disconnected by just opening the port and handling any resulting exceptions.

If it is still an issue, we should create an issue for it in the nrjavaserial issue tracker with a reproduction scenario. That way we can fix the root cause and don't need to add such workarounds (causing discovery issues) to other add-ons.

Related to:

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in org.openhab.binding.zigbee/src/main/java/org/openhab/binding/zigbee/handler/ZigBeeSerialPort.java at the getIdentifiers() workaround. Retest with the upgraded nrjavaserial, including version 5.1.0+, undiscovered RXTX ports, and RFC2217 ports. Done means confirming whether the workaround can be removed or documenting a reproducible nrjavaserial issue for its tracker.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.