Generate things programmatically

Hey there,

I am looking for a way to generate thing in a programming way instead of configuring xml files such as things.xml.

I think others were already facing this problem and hopefully can provide me a proper tutorial or link.

Thanks a lot.
Best Rue

I’m not really sure how to answer this.

First of all, Things are not defined in XML files, they are defined in .things files which have their own format. This alone indicates you either have little understanding about how OH works or you are using the wrong vocabulary.

Secondly, that is what Autodiscovery is for. When you install a 2.x version binding you can go to the inbox and the binding will go out and try to discover the devices that the binding supports and it will automatically create the Things for those devices.

But if you need to manually create a Thing, you can also go to the Things page under Configuration and press the blue and white + icon and manually define a Thing.

Given the nature of the question, I’ll recommend:

Hi @rlkoshak,

thanks for the fast reply. However, my question is not about adding things within e.g. PaperUI, but
implementation of specific things via Java within a binding.

I am able to configure a thing incl. channels within things.xml. However, I would like to generate things e.g. with a dynamic number of channels.

I would assume that there is a possibility to implement this directly in Java without xml files.
Can you provide me some further links on this topic?

Thanks for the response and your support.


I’m not a developer on OH so can’t help. You might try posting on the Eclipse Smarthome forum. That is where all of that stuff is implemented.