[SOLVED] [Zwave, Zigbee, ...] RFC2217 remote serial port HowTo?

You are right and I agree that the title is appropriate.

Thats what I did: Remote serial connection fails after rebooting OH3

According to the recent add of mDNS discovery for rfc2217 serial ports (see: Add ser2net mDNS USB serial discovery by wborn · Pull Request #2519 · openhab/openhab-core · GitHub), I decided to give it a new try :wink:

I’ve prepared a fresh Raspberry Pi with Pi OS Bullseye and the new version of ser2net which supports mDNS. My config is currently:

%YAML 1.1
---

define: &banner \r\nser2net port \p device \d [\B] (Debian GNU/Linux)\r\n\r\n

connection: &Zigbee
  accepter: telnet(rfc2217),tcp,2222
  connector: serialdev,
    /dev/zigbee,
    57600n81 local xonxoff
  options:
    mdns: true
    mdns-sysattrs: true

derived from my former ser2net setting in the old ser2net.conf:

10003:raw:0:/dev/zigbee:**57600** 8DATABITS NONE 1STOPBIT XONXOFF

Unfortunately, the Zigbee coordinator thing remains offline:

The tcp connection to the remote Pi with the Zigbee stick connected got established but it seems, that openHAB cannot “open” that remote serial port yet…

Has anybody yet a working setup with rfc2217-connected Zigbee coordinator? Preferably Ember based? If so, would you share your ser2net.yaml and openHAB thing configuration for it?

EDIT:
Just found this:

Some change in the Zigbee was needed to make it work with rfc2217:

image

Since this has been merged back in October, it’s not included in my 3.1.0-RELEASE setup…

So: Somebody out there who had tried it on 3.2 already?

AFAICT, the combination RFC 2217/openHAB Zigbee Binding 3.2.0 snapshot/Ember Coordinator does not work - for a detailed low level discussion see:

Workaround: use socat instead of RFC 2217, see step 12:

1 Like

On rasperry pis, I use ser2net and socat to bring a remote aeotech zwave stick serial to my rpi running openhab, I’ve been noticing that occasionally openhab crashes in the RTXPortMonitor thread from time to time. I think maybe socat is restarting occasionally and causing it. In reading through this thread I’m not clear if I should try RFC2217 to access a remote zwave stick or not?

The jvm crashes look like this:

Current thread (0x6cd27000):  JavaThread "RXTXPortMonitor(/dev/ttyNET0)" daemon [_thread_in_Java, id=11557, stack(0x61aaf000,0x61aff000)]

Stack: [0x61aaf000,0x61aff000],  sp=0x61afd960,  free space=314k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
J 6726 c2 java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(J)J java.base@11.0.9.1 (181 bytes) @ 0xb3e4667c [0xb3e46250+0x0000042c]
j  java.util.concurrent.ThreadPoolExecutor.awaitTermination(JLjava/util/concurrent/TimeUnit;)Z+57 java.base@11.0.9.1
j  org.openhab.binding.zwave.internal.protocol.ZWaveTransactionManager.shutdown()V+120
j  org.openhab.binding.zwave.internal.protocol.ZWaveController.shutdown()V+15
j  org.openhab.binding.zwave.handler.ZWaveControllerHandler.stopNetwork()V+110
j  org.openhab.binding.zwave.handler.ZWaveSerialHandler.onSerialPortError(Ljava/lang/String;)V+65
j  org.openhab.binding.zwave.handler.ZWaveSerialHandler$ZWaveReceiveThread.serialEvent(Lorg/openhab/core/io/transport/serial/SerialPortEvent;)V+17
j  org.openhab.core.io.transport.serial.rxtx.RxTxSerialPort$1.serialEvent(Lgnu/io/SerialPortEvent;)V+17
j  gnu.io.RXTXPort.sendEvent(IZ)Z+397
j  gnu.io.RXTXPort$MonitorThread.run()V+42
v  ~StubRoutines::call_stub
C  0x61afdd90
C  0x6cd27000


siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000

Thanks.

There is a success story for RFC 2217/Z-Wave Binding:

But AFAICT there is no success story for RFC 2217/ZigBee Binding.

Thanks! I converted over to that and so far it seems to be working.
I did have to manually define the thing even in the new UI (OH 3.1).
If anyone has Zwave security make sure to grab the security key first before you delete the old device in the UI (if switching to a text file)
I’ll see how it goes…

Will rfc2217 also work for a network usb device server? for example
https://www.seh-technology.com/services/downloads/download-deviceserver/myutn-250.html
my OH3 is in a docker container. how can it be setup to see the network usb z stick?

It all depends on what the USB device server supports. It looks like the particular model you’ve linked to does not. It seems to depend on its own proprietary drivers for creating virtual serial ports to access the remote serial ports.

When using virtual serial ports for accessing remote devices, you add a device mapping for that port to the Docker container (similar to socat/ser2net).