I am working on a binding as an interface to a heating system controller; access to the controller is via the so-called Boiler System Bus (BSB) and a serial interface. The nitty-gritty coding of the BS-Bus protocol handling and the bus hardware interface are not the problem, but my understanding how the OpenHAB core interfaces to my binding, which functions I have to provide on the binding side and how I would declare the {binding config} part in the .items file.
The heating controller command set contains commands to read parameters and to set parameters; each command definition contains a unique CmdNumber, a CmdName, and the command structure. A “read” command contains no payload and triggers a response from the heater with a payload (=the value). Conversely, a write command is sent to the heater with a payload (=the set value). The guaranteed unique CmdNumber string looked to me like a good candidate as a {binding config} to address the commands…
I have written some scaffolding code to confirm from within my binding that my code generates correct command messages when I call getParameterByCmdNr() or setParameterByCmdNr(), two functions which I hope to use between the OpenHAB API and my low level code.
At this time I am stuck how to define the {binding config} parts in the bsbus.items file. Can someone please lend me a helping hand? This is my biggest stumbling block right now.
Example for a temperature setting command in the .items file
Number ComfortTemperature “Comfort temperature [%.1f deg C] <temperature> (gTGroup) {bsbus=”1234”}
where the string “1234” is the CmdNumber. My getParameterByCmdNr() method takes the CmdNumber, looks up the respective command description, and uses this description to send an appropriately formatted “Read Comfort Temperature” command to the heater system. The getParameterByCmdNr() method returns the payload of the heater response.
- Is this a workable assumption?
- How does the heater response value get back to OpenHAB? And how do I / how does OpenHAB differentiate between a “read value” command and a “set value” command, and how do I declare this difference in the {binding config} between the curly braces? I very much believe that I am missing something here in my understanding.