Page 1 of 1

Tellstick Duos over forwarded virtual serial ports?

Posted: Tue Sep 27, 2016 5:48 am
by vvartiov
Hello,

I’m trying to extend RF coverage by finding a way to get two Tellstick duos that are plugged into two different Rasberry PI’s to be connected to a single Nethome server instance.

I experimented with forwarding the Tellstick Duo /dev/ttyUSB0 serial port from one RPI to another using socat and setting that forwarded port (/dev/ttyUSB5 in my case) as the Tellstick Duo serial port in Nethome server. It seems that the server isn’t designed to work with virtual serial ports, because even after manually adding the forwarded port to nethome server config.xml it took several connection attempts from the GUI to get the server “connect” to the (remote) transceiver. And manual adding was necessary because the pop-up menu seems to only list locally connected Tellstick Duos. After that everything started working, but the setup didn’t recover automatically after restarting.

But since I did get the connection working for one session at least, I assume quite little would be needed to make this kind of setup work reliably. Maybe by just opening up the criteria for the Tellstick Duo serial port selection so that forwarded (and maybe intermittently connected) virtual serial ports could be used. Now it seems to be a bit too picky about what is considered a suitable serial port. Or is there already some other way to accomplish the same? Using a long USB cable for the second Tellstick Duo is unfortunately not an option since the transceivers would need to be quite far apart from each other.

Best Regards,

-Ville

Re: Tellstick Duos over forwarded virtual serial ports?

Posted: Tue Sep 27, 2016 8:05 pm
by stefangsbb
Interesting setup! I am not doing anything special to limit the kind of serial ports, but the RXTX-library I am using has some limitations in discovering serial ports, so I have to list possible serial port names, and I stopped at "/dev/ttyUSB4"! :(
I have now added support for "/dev/ttyUSB5" as well and made a new nightly build, so you can try that.

The best solution in your case would have been to have OpenNetHome on both installations, and some kind of "event bridge" between them so they could share events. I have had plans for that, but unfortunately not implemented it yet...

Re: Tellstick Duos over forwarded virtual serial ports?

Posted: Wed Sep 28, 2016 4:08 am
by krambriw
but unfortunately not implemented it yet...
I think you are almost there, it spells MQTT. You just need to add the possibility for ONH to send MQTT messages, then this is it.

Re: Tellstick Duos over forwarded virtual serial ports?

Posted: Wed Sep 28, 2016 5:28 pm
by vvartiov
Hi,

Thanks for the information regarding the limited number of ports being scanned. I tried again using /dev/ttyUSB3 as the virtual port and it indeed does pop up on the selection menu now. The command I use for testing on remote end (the RPI that has the tellstick plugged in) is

socat tcp-l:54321,reuseaddr,fork file:/dev/ttyUSB0,b9600,raw,crnl,echo=0 &

and the respective command on the ONH server side is

socat pty,link=/dev/ttyUSB3 tcp:192.168.101.56:54321 &

After setting up the tunnel that way I still have to modify the access rights of the newly created virtual port by issuing

chmod g+r /dev/ttyUSB3

on the ONH server side so that the users in group tty (which the nethome user is already member of) gets read access to the new virtual port.

So far so good, but it seems that every time that virtual serial port is re-estabilished (after e.g. restarting the remote end, unplugging/plugging network cable etc.), the ONH server seems to not rediscover the port automatically, but I have to go click the "reconnect" button twice in the GUI. After first click the status changes to "not connected" and after the second click back to "connected". Is there something I could add to make that rediscovery happen automatically after the virtual serial port has been off-line?

Best Regards,

-Ville

Re: Tellstick Duos over forwarded virtual serial ports?

Posted: Thu Sep 29, 2016 5:42 am
by krambriw
I think you are almost there, it spells MQTT. You just need to add the possibility for ONH to send MQTT messages, then this is it.
Stefan, I think I need to correct myself: I think you can already integrate two or more ONH instances with each others using MQTT, just use the MqttValueLoggers and MqttRemapButtons for those events you want to share between the instancies