Iture / RFLinkGateway

MQTT Support for RFLink Gateway (http://www.nemcon.nl/blog2) project
36 stars 33 forks source link

Question: link with serialport over TCP #12

Open jeroends opened 5 years ago

jeroends commented 5 years ago

Hello, I'm experimenting with your gateway (great piece of software!) but having my PI with Openhab in my electrical closet in the basement, I needed my rflink on an other location. Since 5m of USB extender wasn't enough I glues rflink together with esp-link (recommander!). This is working great and I can make connection through socat or remserial (http://lpccomp.bc.ca/remserial/). Now the issue that I'm having is when the connection is lost, the vertiual port is gone and rflinkgateway crashes. Since esplink closes the connection after 5 minutes of inactivity, this happens a lot.

So my question: is there any chance you 'r willing to implement direct connection to tcp with the possibility to have it reconnect when to connection is lost?

Iture commented 5 years ago

If I correctly interpret your question: do you want to implement remserial, or rather automatic reconnect to serial port after disconnection? If second, it should work this way - there is automatic reconnect to serial port every second, so when connection is reestablished, rflinkgw should connect to it. I don't use remserial, I just tested it by pulling off the USB socket from my Raspberry and reconnect worked OK. Maybe the better solution is to make some keep-alive on serial or increasing timeouts on esplink?

jeroends commented 5 years ago

it's idd my question to integrate a tcp connection into your gateway. The problem is socat and remserial create virtual streams. They still exist when the connection is broken. There 's idd an option to do some keepalive, but when the wifi connection is lost (and it will happen), the connection can't be remade automaticly. So in that case the gateway is connected to a "null" stream, never knowing what happens. Further you could end in ex socat or remserial and restart it, than the gateway goes in error and never connects again until restart.

you see, I could write a script that pings the wifi/serial gateway for connection and do some restart of all the scripts, but it would be a nicer solution to have it in a "all-in-one" solution (would be a better way to do it).