Hello,
I’m just getting started with openHAB2 binding development, and I have some questions with regard to the thing-type.xml files I am setting up for a new Insteon binding. I have 3 of them thus far: generic_dimmer.xml, generic_modem.xml, generic_switch.xml, which based upon what I found here: https://www.eclipse.org/smarthome/documentation/development/bindings/thing-definition.html and could Google.
Q1: What is the relationship of the xml to the actual code and openHAB?
Q2: What is the relationship between “channel id” and the channel “typeId”? Consider the example below.
<channels>
<channel id="foo" typeId="bar"?
</channels>
Q3: What’s the relationship between “channel-type id”, channel “item-type”, channel “label”, and channel “description”? Consider the example below.
<!-- Sample Channel Type -->
<channel-type id="sample-channel">
<item-type>insteonplmItem</item-type>
<label>InsteonPLM Binding Channel</label>
<description>Sample channel for InsteonPLM Binding</description>
</channel-type>
Q4: Do the below xml files appear correct in terms of how Insteon works? Answers to the above may make this self evident though. However, I’m most concerned with the Generic_Modem.xml as it seems to be a bridge-type, and I’m not clear how the bridge-type’s thing-type file should appear.
A. Generic_Dimmer.xml
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="insteonplm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
<!--Generic thing for Insteon dimmer switches-->
<thing-type id="Generic_Dimmer_Switch">
<label>Dimmer switch</label>
<description>Dimmer switch</description>
<channels>
<channel id="dimmer" typeId="brightness" />
</channels>
<config-description>
<parameter name="InsteonID" type="text" required="true">
<label>23.EF.0B</label>
<description>The InsteonID uniquely identifies each Insteon device.</description>
</parameter>
</config-description>
</thing-type>
<!-- Channel Type for Generic Insteon Dimmer Switches-->
<channel-type id="dimmer">
<item-type>dimmer</item-type>
<label>Dimmer switch</label>
<description>Dimmer switch</description>
</channel-type>
</thing:thing-descriptions>
B. Generic_Switch.xml
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="insteonplm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
<!--Generic thing for simple Insteon on/off switches-->
<thing-type id="Generic_Simple_Switch">
<label>On/off switch</label>
<description>On/off switch</description>
<channels>
<channel id="switch" typeId="switch" />
</channels>
<config-description>
<parameter name="InsteonID" type="text" required="true">
<label>23.EF.0B</label>
<description>The InsteonID uniquely identifies each Insteon device.</description>
</parameter>
</config-description>
</thing-type>
<!-- Channel Type for Generic Insteon Simple Switches-->
<channel-type id="switch">
<item-type>switch</item-type>
<label>On/off switch</label>
<description>On/off switch</description>
</channel-type>
</thing:thing-descriptions>
C. Generic_Modem.xml
<?xml version="1.0" encoding="UTF-8"?>
<thing:thing-descriptions bindingId="insteonplm"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:thing="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0"
xsi:schemaLocation="http://eclipse.org/smarthome/schemas/thing-description/v1.0.0 http://eclipse.org/smarthome/schemas/thing-description-1.0.0.xsd">
<!--Generic thing for Insteon modems (PLM/PLC/Hub)-->
<thing-type id="Generic_Modem">
<label>Modem</label>
<description>Modem</description>
<channels>
<channel id="command" typeId="command" />
</channels>
<config-description>
<parameter name="InsteonID" type="text" required="true">
<label>23.EF.0B</label>
<description>The InsteonID uniquely identifies each Insteon device.</description>
</parameter>
</config-description>
</thing-type>
<!-- Channel Type for Generic Insteon Modems-->
<channel-type id="command">
<item-type>command</item-type>
<label>Insteon command</label>
<description>Insteon command</description>
</channel-type>
</thing:thing-descriptions>