org.openhab.binding.rflink icon indicating copy to clipboard operation
org.openhab.binding.rflink copied to clipboard

java.io.ioexception: underlying input stream returned zero bytes

Open seekoman opened this issue 6 years ago • 2 comments

I have a lot of "java.io.ioexception: underlying input stream returned zero bytes" in the openhab log.

I have tried to add this to the code after opening the serial port to avoid it timing out when it doesent revice amessage for a long time.

serialPort.disableReceiveTimeout(); serialPort.enableReceiveThreshold(1);

Which seams to solve this issue but I am uncertain if it will cause other problems ( I am running this on windows and hence not tried it on linux).

seekoman avatar Feb 11 '19 08:02 seekoman

That's interesting.

The library used to communicate with the SerialPort is specific to the architecture & OS. The lib you are using on a x86 Microsoft Windows OS is different from what you would use on a ARM Raspberry Pi running a Raspbian distrib. So I don't know if everyone will get the same improvement, but we can give it a try :)

I was investigating another approach : the RfLink protocol reference declares some specific instructions to keep the connection alive with the RfLink bridge : http://www.rflink.nl/blog2/protref 10;PING; => a "keep alive" function. Is replied with: 20;99;PONG; This requires some changes in the way the bridge works

cartemere avatar Feb 11 '19 20:02 cartemere

Hello,

I made a commit with your suggested code. And another one introducing a new option in the bridge configuration : keepAlivePeriod : Send "PING" command to the bridge at the specified period. Only enabled if > 0. default=0

with for instance '60', the plugin will automatically send a 'PING' command every 60 seconds to the bridge. The bridge will return a 'PONG' message.

cartemere avatar Feb 16 '19 21:02 cartemere