Dynamic channels are not visible in /rest/things

I have created Dynamic channels in my binding as

ChannelTypeUID triggerUID = new ChannelTypeUID(BINDING_ID, "dynamic"); Channel mychannel = ChannelBuilder.create(new ChannelUID(getThing().getUID(), "channel_name"), "String") .withType(triggerUID).build(); thingBuilder.withChannel(mychannel);

When I query things using /rest/things I do not get channels which are generated dynamically in the JSON.

Where am I wrong in creation of channels?

Are you doing this within your ThingHandlerFactory.createThing()?

No, I am doing in initialize method of ThingHandler class.

At this moment, the Thing already exists and thus needs to be edited (through edit/updateTing), see the documentation.

Yes I was doing that.

It was my mistake. There were some null channels in thingBuilder.withChannels(channels_array) and thus it was throwing error. Now channels are updated with thing.


1 Like