In my Binding, I am creating groups of channels based on the configuration I obtain from the device.
For me, this is groups of Air-Conditioner Units and their channels, and Air-Conditioner Zones and their applicable channels.
I am configuring the channel-types
in things-types.xml
, and then creating channels after retrieving the properties of the unit.
example:
<channel-type id="airconditioner-zone-temperature">
<item-type>Number:Temperature</item-type>
<label>Zone Temperature</label>
<description>The temperature as measured by the Zone. Typically read via a device located in the room.</description>
<category>Temperature</category>
</channel-type>
I am then creating the channel in code like this…
Channel channelZoneTemperature = ChannelBuilder
.create(new ChannelUID(channelGroupUID, "airconditioner-zone-temperature"))
.withLabel(String.format("Zone Temperature - %s", zoneName))
.withType(new ChannelTypeUID(AirTouchBindingConstants.BINDING_ID,
"airconditioner-zone-temperature"))
.build();
thingBuilder.withChannel(channelZoneTemperature);
This is working great. However when I create the item from the channel, I have to remember to set the Semantic Class
and Semantic Property
as per this screenshot.
Each Zone has a number different properties (eg, on/off, mode, setpoint, temperature, battery low, damper open percentage), and from experimentation they all appear to have different semantic values so that they appear sensibly on the cards in the UI.
I keep forgetting which ones have what semantic settings, and I would love to be able to provide sensible defaults for each channel.
Is it possible to set the Semantic Class and/or Semantic Property when creating the Channel?
I’m hoping there is some recommended XML or code that I can use to save my users having to go in and change every new Item. My system will have nearly 50 items, and mine is a small install.