[SOLVED] Cannot Link Channel in a new Binding

Hi All,

I started developing the Hörmann Bisecure binding.
I already could get some basic discovery working for the gateway (controller box = bridge in OH) and for the first thing in there (a Garage Door in my case).
The thing should have several channels which are all dynamic created depending on the values configured inside the gateway. For my door I can create a channel, but in PaperUI I cannot link this channel to an item. The profiles Drop down list is empty :frowning:

This is how my channel is created:

ChannelTypeUID channelTypeUID = new ChannelTypeUID(getThing().getUID().getAsString() + ":" + portType);
ChannelUID channelUID = new ChannelUID(getThing().getUID(), PortType.Companion.from(port.getType()).name());
Channel channel = ChannelBuilder.create(channelUID, BiSecureGatewayBindingConstants.ITEM_TYPE_ROLLERSHUTTER)
                .withType(channelTypeUID).build();

The preferred type for the channel should be a Rollershutter (for new, other channels will come later)

The whole source can be found in

I tried to find some more infos about how the channel type is set and how that matches to the profiles available but I think I still don’t have it…

Thanks for your help!
Thomas

It depends on construction of XML, as UI is relying on declaration of thing types and then channel instances. Channel instances are bound to type.

If you have entirely dynamic set of channels you can try to generalize it with ChannelTypeProvider. If you have dynamic things then ThingTypeProvider.
Both will allow you to work around lack of XML definitions and map very generic devices.

Overall before you jump into these please double check if you have compatible XML entries.

Cheers, Łukasz

Hi Łukasz,

thanks for your reply. I tried to define the channel type inside the XML:

<channel-type id="IMPULS">
  <item-type>Rollershutter</item-type>
  <label>Impuls Control</label>
  <description>An impuls control</description>
  <category>Rollershutter</category>		
</channel-type>

and create the channel for this type (the channel type IMPULS is equal to the variable portType here):

 new ChannelTypeUID(getThing().getUID().getAsString() + ":" + portType)

I thought that the last segment of the channel type UID is the id of the channel type inside the thing-types.xml… but actually that is only an assumption.

Regards,
Thomas

Take a look at the networkupstools binding code. It creates both channels from predefined channel types that are defined in xml as completely new channels.

Hi Hilbrand,

thanks, that was a great hint.
The ChannelTypeUID has to be in the format of “<BINDING_ID>: < Channel Type Id in XML>”

Now it works :slight_smile:

1 Like