JSONDB items to textual config

I made a small tool which can convert JSONDB items into textual config items: JSON2Config


Why not use the REST API as a basis?

Correct me if i’m wrong, but the REST API returns all Items - including the ones already present in textual config files. It’s intended to just convert the items from the JSONDB.

I thought they were all present in JSONDb too but I could be wrong.

Your not wrong :smile:.
All items are stored in org.eclipse.smarthome.core.items.Item.json, no matter how they are defined.
I, for example, use only .items files currently (waiting for OH3 to switch…), and they all show up in the ‘database’ as well.

1 Like

OK, what is the purpose of this then?

Major point of doing this I would see in making a versioned configuration in a file which fits into SCM.

To be fair I was thinking about similar functionality as my laziness is telling me that I do not want to write by hand results of discovery just to have a full control over cfg.

Good job @voruti!

1 Like

Perfect timing.

I’ve got an issue wth something, somewhere that is causing my OH2 to restart erratically.

So I’m going to export everything.

Wipe the whole machine and start again.
(I want to swap OS anyway)

Thanks for taking the time to create this.

1 Like

Have you checked for invalid addons in addons.config? That causes addons to reload every minute.

Thanks Bruce

I hadn’t, but I will.

Something causes a problem very randomly.

I’m leaning towards it being the HEOS or ChromeCast binding…
But after playing with the settings for over 2 weeks, I think a complete wipe is the order of the day.
As the same core configuration has been running since the 2.3.x days

Are we talking about the same configuration file sftp://openhabian:@openhabianpi.fritz.box/var/lib/openhab2/jsondb/org.eclipse.smarthome.core.items.Item.json (in my setup)?
Before I converted them; the items in this file were only those, which I created with PaperUI, not the ones from the .items files.
In the .items files for example I created a group for every room in the house. These do not show up in the JSONDB.

My bad… I had a quick look at the jsondb file and saw a lot of Items. I never used PaperUI, so I jumped to the conclusion that the items are mirrored there.
However, I forgot that I recently started creating a lot of Items dynamically (in Jython rules/scripts). And that are the ones that show up in the json db file, not the ‘static’ ones in .items files.
Sorry for the confusion… :innocent:

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.