Write Config to files (.rules , .things , .items)

Is it possible as part of the OOTB functionality of OH ?

I ask because having started with PaperUI I then reverted to files to expedite creation of my setup. I then moved back to Paper as it was easier when linking Channels and Items. I have also tweaked a few things in Paper. Now my files are not consistent with the config currently being administered through Paper. Therefore I would like to “flush” configuration out from Paper (aka “copy it”) to files (/etc/openhab2/…)

Alternatively is there an Add-On for this? I’d write one myself if not, but I fear OH is Java based and Java is about the only language I’ve never touched (I use C, C++, Assembler, Python, VB, SQL). Java, they teach that in Uni now so we have loads of fresher softies who code in that , hence I’ve never needed to use it nor do I wish to).

Have you looked at using REST API ?

BTW, it’s also recommended to use PaperUI for Things and files for Items. You do not want to create in both places as this could lead to duplicate’s and device issues.

No I have not. I shall take a look at that although if it means js/Java then it looses it’s appeal - to me :slight_smile: But it’s a good idea thanks

I shall see if anyone posts any other (non js/Java/RAPI) solutions?

Here is a good explanation with examples by @rlkoshak for using REST API:

Actually it uses https and JSON. You can yse commmand line tools such as wget & cURL or install restdocs and use it web interface.

ah right, okay, I will take a look to see what it involves.
Thanks ! :+1:

Guys,
I have discovered a new easy way,…provided Things are defined, one can use VS Code with the VS Code extension, and this will display a panel on the left of the VS Code workspace that shows Things and clicking on the small arror icon next to the Thng name, there an option called "Create items from " where channels are the channels from a Thing. There is no way to create, from internal db, the Things themselves though :frowning:

1 Like

That can be done through the REST API (That is how the UIs interface with OH). Anything done in OH by the UIs can be done through the REST API.