I would like to implement a serial protocol via rules between Arduino and raspi (openhab 2) which is blocking as long as the Arduino has not acknowledged the command.
it is pretty straightforward on the Arduino side. I am struggling with the openhab2 rules. Could you please give some hints on a good way to accomplish that?
Thanks a lot in advance!
What exactly are you trying to achieve?
Let me make an example to be more explicit:
If I control a LED via openhab, I send via rule “LED=ON” over serial binding to an Arduino where the massage is interpreted.
I would like now that openhab is waiting as long as it received “roger” from the Arduino.
Problems occur when a lot of messages are send from openhab to the Arduino. Then I get buffer overflow and messages are dropped. Therefore I would like that each send command from openhab waits until it receives an acknowledgement from the Arduino.
NOTE I just added an implementation to that DP that doesn’t use Locks and is safer over all.
If you have a free hand with the Arduino, consider implementing Modbus on it. That’s a serial protocol that includes basic handshaking. There are Arduino libraries.
The openHAB modbus binding incorporates outbound command queuing, and retrying on error.