Moving items from JSONDB to items files -> what happens with duplicates?

Hi all,

on my OH 3.4.3 installation, I started to migrate from JSONDB (GUI generated) Items to items files for everything. To get started quicker, I use daabms excellent converter (Yet another converter for items and things). As I have more than 1000 items, manually removing them via GUI seems to be a bit of work.

now to the question:

  • as far as I know, item files get loaded first. what happens with the stuff in JSONDB that has identical IDs?

I assume I will not see duplicates in OH, but rather the JSONDB stuff will not be used and won’t overwrite my item definitions that came from the files. True?

But that leads to the second question:

  • how to clean up JSONDB? I mean I will now have lots of stuff there that is not needed anymore.

thanks a lot in advance

You won’t see duplicates, but it’s incorrect that one source will be ignored. OH uses both. You could have issues if there are conflicting parameters, but otherwise an item will work.

Each item’s Channels tab has a button at the very bottom to unlink and remove items.

It should remove your JSONDB entries while leaving your .items files alone (since it can’t affect those files). However, you may see some weird behaviour due to caching. I suggest unlinking before you add the .items files. That way, you can confirm that the JSONDB items are removed from OH, then confirm that they return when the .items files are loaded.

Alternatively, you can stop OH, edit the JSONDB items file directly, and restart OH. Do not edit the JSONDB while OH is running, and be very mindful of what you delete. It’s easy to accidentally leave/remove a bracket unintentionally.

In either case, you should have a working backup before you start culling items.

1 Like

Thanks, that’s all very helpful. And yes, I run a multi stage backup and will create a copy before I start working on the DB.

AFAIR, you can also simply start over by renaming/removing the existing items/thing/itemchannellink jsondb files. OH will recreate empty ones. Or empty them on your own, just leaving “{}” as content. Of course, in both cases OH needs to be restarted.

1 Like