I am a newcomer with openhab2 and I try to understand the Binding Architecture. I have some homemade controller that work with the Modbus Protocol. I want to use the OH2 Modbus Binding because I thought I could use the Modbus Bridge in my appliance.
I learned that the Modbus Bridge is just able to configure things based on Modbus addresses. My Binding uses complex transactions to configure the device. So I am looking for a method that use the Modbus Binding from own
The Modbus bundle should give me an interface and should only be responsible to track the modbus ids and to serialize all modbus transactions in a queue.
My Idea install a servicetracker in the modbus binding that tracks all my application bundles. (OSGi Whitebording)
When the Modbus binding tracks one of my bundles it added the application bundle to the Bridge of the predefined
modbus slave. (It checks that no other application binding use the same modbus-Id)
This would be a good solution on plain OSGi. Are there design patterns for OH2 that I did not found yet?
The Thing Definition would look like this:
Bridge modbus:serial:serhome [port=/dev/ttyUSB0 , baud=38400, databits=8 , stopbits=1 , parity=even , encoding=rtu]
Here could be some more definitions for things (standard modbus transactions)
Here are an application binding that will be attacted to the modbus bridge:
jrsolarcontroller:solarcontroller [attach=modbus:serial:serhome, id=10]
Thanks in advance