org.openhab.binding.rflink
org.openhab.binding.rflink copied to clipboard
java.io.ioexception: underlying input stream returned zero bytes
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).
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
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.