Skip to content

Binding descriptor files

Chris Jackson edited this page Aug 29, 2013 · 7 revisions

The binding descriptor files are not strictly part of HABmin, and need to be included with the binding as part of openHAB. However, since they are needed by the REST interface, I'm defining this as part of HABmin for now. Expect this to move to openHAB later.

So, consider this a proposal to be included within openHAB...

The purpose of the binding descriptor is to allow the binding to describe its configuration requirements to the REST interface, and on to the web configuration interface. This therefore needs to describe all the configuration parameters, provide a description to assist the user, and provide checking information to allow cross checking within the GUI.

There are three parts of the file to be defined

  • General binding configuration (the parameters currently in the openhab.cfg file
  • Binding interface configuration. This is also currently in the openhab.cfg - it defines the interface specific parameters and is not used in all bindings. It is normally preceeded by a . (eg owserver.interface1.host=)
  • The item binding configuration.

The following excerpts from the xml file should be reasonably self descriptive. Multiple sets of data would normally be defined for the different configuration parameters. A full example file is provided at the bottom of this page.

A few things to look at -:

  • Linking the interface parameter in the item configuration to the interface definitions so that the user gets a list to select from.
  • More validation required? Regex, type, length?

###General Binding Configuration

<binding>
    <!-- Binding configuration settings -->
    <binding.config>
		<pid>owserver</pid>
        <setting>
            <name>cache</name>
            <label>Cache Timeout</label>
            <description>Sets the cache timeout in milliseconds.</description>
            <optional>true</optional>
            <default>5000</default>
            <minimum>250</minimum>
            <maximum>20000</maximum>
            <values></values>
        </setting>

Binding Interface Configuration

    <!-- The following lines specify the communications interface settings. These may be repeated multiple times -->
    </binding.interface>
		<pid>owserver</pid>
        <setting>
            <name>host</name>
            <label>IP Address</label>
            <description>Set the IP address of the OW Server.</description>
            <optional>false</optional>
            <default></default>
            <minimum></minimum>
            <maximum></maximum>
            <values></values>
        </setting>

Binding Item Configuration

    <!-- Item binding configuration -->
    <binding.items>
		<pid>owserver</pid>
        <binding.io>
            <type>Input</type>
            <description></description>
            <parameters>
                <parameter>
                    <name>interface</name>
                    <label>Communications Interface</label>
                    <description>Set the symbolic name of the communication interface.</description>
                    <optional>false</optional>
                    <default></default>
                    <minimum></minimum>
                    <maximum></maximum>
                    <values></values>
                </parameter>

Complete file

<!-- Binding configuration for the OWServer binding in openHAB -->
<binding>
    <!-- Binding configuration settings -->
    <binding.config>
		<pid>owserver</pid>
        <setting>
            <name>cache</name>
            <label>Cache Timeout</label>
            <description>Sets the cache timeout in milliseconds.</description>
            <optional>true</optional>
            <default>5000</default>
            <minimum>250</minimum>
            <maximum>20000</maximum>
            <values></values>
        </setting>
        <setting>
            <name>timeout</name>
            <label>Timeout</label>
            <description>Sets the number of milliseconds that the binding will wait for a response.</description>
            <optional>true</optional>
            <default>5000</default>
            <minimum>500</minimum>
            <maximum>10000</maximum>
            <values></values>
        </setting>
        <setting>
            <name>granularity</name>
            <label>Granularity</label>
            <description>Set the time between each of the OWServer item update checks (in milliseconds).</description>
            <optional>true</optional>
            <default>1000</default>
            <minimum>100</minimum>
            <maximum>10000</maximum>
            <values></values>
        </setting>
    </binding.config>

    <!-- The following lines specify the communications interface settings. These may be repeated multiple times -->
    </binding.interface>
		<pid>owserver</pid>
        <setting>
            <name>host</name>
            <label>IP Address</label>
            <description>Set the IP address of the OW Server.</description>
            <optional>false</optional>
            <default></default>
            <minimum></minimum>
            <maximum></maximum>
            <values></values>
        </setting>
        <setting>
            <name>port</name>
            <label>IP Port</label>
            <description>Set the IP Port number of the OW Server.</description>
            <optional>true</optional>
            <default>80</default>
            <minimum>1</minimum>
            <maximum>65535</maximum>
            <values></values>
        </setting>
    </binding.interface>

    <!-- Item binding configuration -->
    <binding.items>
		<pid>owserver</pid>
        <binding.io>
            <type>Input</type>
            <description></description>
            <parameters>
                <parameter>
                    <name>interface</name>
                    <label>Communications Interface</label>
                    <description>Set the symbolic name of the communication interface.</description>
                    <optional>false</optional>
                    <default></default>
                    <minimum></minimum>
                    <maximum></maximum>
                    <values></values>
                </parameter>
                <parameter>
                    <name>romid</name>
                    <label>ROM ID</label>
                    <description>Set the ROM ID of the One Wire device.</description>
                    <optional>false</optional>
                    <default></default>
                    <minimum></minimum>
                    <maximum></maximum>
                    <values></values>
                </parameter>
                <parameter>
                    <name>parameter</name>
                    <label>Parameter Name</label>
                    <description>Sets the Parameter Name from the One Wire device.</description>
                    <optional>false</optional>
                    <default></default>
                    <minimum></minimum>
                    <maximum></maximum>
                    <values></values>
                </parameter>
                <parameter>
                    <name>Polling period</name>
                    <description>Sets polling period (in milliseconds between each request.</description>
                    <optional>false</optional>
                    <default>5000</default>
                    <minimum></minimum>
                    <maximum></maximum>
                    <values></values>
                </parameter>
            </parameters>
        </binding.io>
    </binding.items>
</binding>