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!
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.
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.