Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse SmartHome » Item and Channel Label is not set in UI
Item and Channel Label is not set in UI [message #1734180] Sun, 05 June 2016 17:47 Go to next message
Thomas Biacsics is currently offline Thomas BiacsicsFriend
Messages: 3
Registered: June 2016
Junior Member

I have a problem when creating Items during runtime and linking them to Channels of a Thing. The label declared in the ChannelType definitions is not set as the Item's label. Therefore, the label is not set in the UI, instead the Item's Name is displayed.
I have a Thing und some ChannelType definitions in the same file:

<channel id="temperature" typeId="temperatureChannelType"/>
<channel-type id="temperatureChannelType">
        <description>Current temperature in degrees celsius</description>
        <state readOnly="true" pattern="%.1f °C" />

In the ThingHandler's initialize() method, I create Items and link them to the Thing's channel:

serviceReference = bundleContext.getServiceReference(ManagedItemProvider.class);
itemProvider = bundleContext.getService(serviceReference);
itemChannelLinkRegistry = bundleContext.getService(bundleContext.getServiceReference(ItemChannelLinkRegistry.class));
NumberItem temperatureNumberItem = new NumberItem(idFormatted + "_temperature");

Channel tempChannel = thing.getChannel("temperature");
link = new ItemChannelLink(temperatureNumberItem .getName(), tempChannel.getUID());

itemProvider.add(temperatureNumberItem );

tempChannel.getLabel() returns null.
I already debugged the code and found out, that the label and description of the corresponding ChannelDefinition object is null when it is loaded from the XML files. Further analysis of the callstack brought me to the "ThingTypeXmlProvider.addingFinished()" method. While the "channelTypeRefs" contain label and description, however the "thingTypeRefs.ChannelTypeReferences" don't contain a label and describtion any more.
I noticed that this collection is of type ChannelXmlResult, so could there be a bug when assigning the label and description from the ChannelTypes (ChannelTypeXmlResult) ? Or should I retrieve the Label directly from the ChannelTypes? Is there something like a "ChannelTypeRegistry"?

Thanks in advance!

[Updated on: Wed, 08 June 2016 22:30]

Report message to a moderator

Re: Item and Channel Label is not set in UI [message #1736976 is a reply to message #1734180] Mon, 04 July 2016 18:40 Go to previous message
Markus Rathgeb is currently offline Markus RathgebFriend
Messages: 99
Registered: August 2014

Do you think this could be a duplicate of
Previous Topic:ItemRegistery(org.eclipse.smarthome.core.items.ItemRegistry) is empty when channel is linked?
Next Topic:Smarthome Building issue
Goto Forum:

Current Time: Mon Mar 19 22:25:22 GMT 2018

Powered by FUDForum. Page generated in 0.02053 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software