HowTo: Move ALL items to JSON dB for easy editing in PaperUI and tagging for Google Home (and Alexa)

Tags: #<Tag:0x00007f3880db6b80> #<Tag:0x00007f3880db6a40> #<Tag:0x00007f3880db68b0>

Dear all, this is my very first post here (and may have a bunch of formatting errors)…
…but I think this will help a lot of people struggling with a mix of .items -definitions.

OS:      Raspbian GNU/Linux 8.0 (Jessie)
OpenHAB2:  2.5.0~S1512-1 (snapshot)

OpenHAB REST Exporter/Importer for Items and Links
Download     (Updated 2019-04-06)

These files will allow you to make all your items editable (RW) in a couple of minutes.

  • It doesn’t matter if items are created in PaperUI, HabMIN, .items -files. All items can easily be inserted into the OpenHAB JSON dB and editable through PaperUI.
  • This script does not change anything in OH and cannot break anything. It only extracts data in a very easy to edit format, which then (again easily) can be imported to OH using REST and SSH.
  • You yourself have to add any tags (if you like) in your favorite text editor (I’ve fallen in love with Visual Studio Code which has OH support).
  • Or use this tool without any edits to just make all your items editable in PaperUI.

My main purpouse is adding tags enabling Google Home (and likely Alexa?).

This is for RaspberryPi, OpenHab 2 (snapshot) & SSH. It probably works for most platforms as long as you can use SSH.
I’m using OH2 aliases mapped to /srv/ instead of hard paths, which makes it less platform dependent.

The boring stuff: “Use it at your own risk!” I have +200 items and used this method 20 times now, rebooted plenty, tested again… but it may behave differently at your system.

Download .7z and extract to a temp folder. Then copy files to /srv/openhab2-conf/html/
You can skip index.html , I only put some useful (to me) links in that start page. Everything needed is in the subfolder exporter .
Browse to: yourserver:8080/static/exporter

Feel free to ask or comment, but please have a look at all helpful links in the html/script.

Best Regards
Pete R

openHAB Google Assistant
HowTo: Listen & Talk to your Home
Moving on from simple mode
Setting Tags and Groups
Apply tags to items added/linked in Paper UI
Add/remove item to group through REST API fails
[SOLVED] Move thing configuration from UI to files
DSL serializer for items and things #4817


Perfect timing :slight_smile: Thanks a lot.

Cheers, David

You havn’t tried it yet :wink:
(I sure hope it help others, I spen’t around the clock for over a week doing this. But now I can move all items to JSON dB over and over in few minutes.)

Haha, you mean I regret what I just said :smiley: I’ll try with a test system first as soon as I find time.

But more importantly: I’m working on that Paper UI new generation design study that includes the vision of not having .things and .item files anymore (not in their current form at least) and your importer/exporter is the perfect match.

Thanks for posting! As David said, this is very timely and will get a lot of use over the coming months I’m sure.

I did this when I integrated with Google Assistant but I created a “blacklist” of stuff I didn’t want tagged. There should be a disclaimer about this in OP or in the git. I have items that trigger my alarm system, doors, etc so I was careful not to tag stuff I didn’t want tagged.

This webpage and JavaScript only extract and format the output for easy editing. You yourself have to add tags (if you like), and then import them again using REST and SSH.
I have updated the Intro and made it clearer. Thanks for the input.


Is there a typo in the documentataion?

./backup –full

./backup --full

Yes, it was a typo. Thanks for pointing it out. It’s fixed now.
I also noticed the hyphens ‘-’ could become the wrong ones during cut’n’paste. So people, try the - - help to see that you get help. Then - - full should work also.

Hi, im trying to use ypur scripts, but im unable to access http://openhabianpi:8080/doc/#!/items/createOrUpdateItems, i got 403. Can you help me?

Im just starting with OH, with openHABian
Your scripts are copied to /srv/openhab2-conf/html, and chmod to 777
I have REST Documentation addon installed, I also rebooted rasberry several times.

Hi Ján.
The link that doesn’t work, is it from step 7 in the instructions? Does the other steps work? Can you extract any data at all, i. e. items and links?
Does this work for you?

I don’t think this is related to my script. REST is dynamically created and not in /html. Can you access OpenHAB start page and from there click REST API?
If that works, you can for example in step 7 go to PUT/items

Thank you, yes your scripts worked properly, I was just uncertain about that step 7, because that link doesnt work. Im able to go to PUT /items, manualy, so I going to try it.

Would these scripts affect the frontail settings I have in the html folder?

No it won’t change any settings as long as you don’t replace any files you already have.
Please see updated Installation

You can try with just one item to see you get a response 200 OK. Do that before you start deleting things. You will get OK even if the item already exist. Remember starting/ending [ ].
Wonderful to get some feedback :slight_smile:

hello i tried typing linksAdd in ssh console but this command doesnt exit . Any help would be appreciated

Hi, linksAdd is not a command, it’s a button saying Show linksAdd.txt, or click Open in new Window. Paste that into SSH, i. e. curl -X PUT --header "Content…
If you managed steps 4 & 5, then step 8 works the same way…
Thank you for your question so I can improve the instructions.

worked like a charm

Hey @PeterR,

Glad you’ve found my original exporter useful! :wink:
The direct link to original source in exportREST.js is broken, it should be:


1 Like

Thank you for the new link.
Yes your script showed the possibilities and it triggered me to do something more automated and user friendly. This community has given me a lot and I wanted to give something back.