Skip to content

Binding Configuration

Chris Jackson edited this page Sep 10, 2013 · 4 revisions

The binding configuration window allows the configuration of generic binding configuration parameters. These are parameters that are not specific to an item, and might include parameters on the operation of the binding, or definition of interfaces.

Binding Config Screen

Clicking on a binding name will present the binding properties on the right of the window. All configurable properties for the selected binding will be listed, and you can freely edit them. Clicking on the "Add Interface" button will produce a prompt for an interface name. Interfaces are often defined in the binding configuration, and their properties (eg, address, port etc) set there, and then only the interface name used in the item bindings. This improves readability of the item configuration and makes it easier to change the interface as an address or configuration item only needs to change once, and not for every item. Once you have created a new interface, the properties for the interface will be presented in the properties list.

Once all the configuration is finished, click the Save button. This will write the properties back to openHAB. A box will appear to confirm that the save was successful or if there was an error.

Implementation notes

When the REST interface saves data, it does the following -: Searches the openhab.cfg file for the appropriate setting. If it exists, it replaces it. If it's a line that's commented out (with #), then it will also replace it (thus maintaining the configuration in the same place which keeps it with any description that may also be in the file). If the value you're setting is empty, the line will be commented out when saved (with #). If an interface config value (ie. one with a colon : in the parameter) is an empty value, it is removed from the config file. These are the only items that should be removed. If you add a setting into the config file, and it doesn't already exist, it will be placed at the end of the section containing other settings for this binding.