Backup/Restore part by part (bindings, things...)

Hi all,

Long Story:
a while ago I migrated my RPi based installation to a docker container. Since then I’m facing too issues which I would finally like to solve.

  1. whenever the customer starts, it takes up to one hour for the CPU usage to go below 100%
    During this “startup” phase I’m unable to use many things/items.

  2. For some light switches I do make use of the follow profile. However, now if I turn one light on, it takes up to 20s for the other light to follow.

So in order to “fix” these issues I’d like to setup a new fresh container.

Short story:
My plan is then to restore bindings first, followed by things, items, rules. How can I do this, especially the first two topics, as the rest is all file based.

thanks in advance

The issue you described sounds abnormal.

My suggestion about your restore process, and many here would probably disagree with this:

  • Put the list of bindings you use inside addons.cfg so this becomes a file-based config
  • Migrate your things to .things file too

Check the logs for errors while doing so.

Thanks for your response. I assume this migration to addons.cfg and .things means manual work, right?

Yes. Just list your addons inside addons.cfg. Are you familiar with it?

Here’s an example from mine:

remote = true
includeIncompatible = false
automation = pidcontroller,jsscripting,jrubyscripting
binding = mqtt,airquality,astro,chromecast,lgwebos,mail,openweathermap,ipcamera,daikin,chatgpt,fronius
misc = openhabcloud
persistence = mapdb,influxdb
transformation = jsonpath,map,regex
ui = basic,habot

# A comma-separated list of voice services to install (e.g. "voice = googletts,marytts")
voice = 

suggestionFinderIp=false
suggestionFinderMdns=false
suggestionFinderUpnp=false
suggestionFinderUsb=false

The names of the addons are easy to “guess” but basically the last part of the URL that you can find on the web site, e.g. for Air Quality binding, you can find it in https://www.openhab.org/addons/bindings/airquality/ and the addon id to use inside the addons.cfg file is airquality, as per the last bit of the URL.

If you don’t want to do this, you could migrate your UI based bindings and things by copying the files inside userdata/jsondb/, the file names should be kinda self explanatory.

It is best to pick one method over the other and not mix it. That is, if you install bindings using UI, don’t use addons.cfg file, and vice versa.

It is OK however, to install bindings using UI and using .items file for all your items. In fact, you can mix .items and UI items just fine. It’s just the addons that shouldn’t be mixed.

1 Like

Thanks. Well, yes. I install bindings via the UI and most of the things I generate via UI, too. Like about 40 Shelly devices. I will give it a try with the json files. Thanks again

I still had to trigger the installation of the bindings.

Used a fresh container and copied the json db files. Afterwards I saw all my things in the UI but with messages:

Status:

UNINITIALIZED
HANDLER_MISSING_ERROR
Handler factory not found

After a while, did the bindings install? Usually that’s the case.

cannot say. I just went to the UI and installed them manually :slight_smile:

When bindings are installed through the UI, that setting gets saved to $OH_USERDATA/config/org/openhab/addons.config.

Everything you configure through the UI gets saved to a text file. The only real difference is it’s not always clear which file it’s saved to with UI configs.

One thing to note is that when you edit addons.cfg in the $OH_CONF/services folder, those settings get moved into the addons.config file in userdata and it’s the addons.config file that really controls what add-ons get installed.

To restore just the addons restore $OH_USERDATA/config/org/openhab/addons.config. However many bindings have their own settings (e.g. InfluxDB). Those settings you’ve made through the UI get saved to $OH_USERDATA/config/binding. There are other settings made through the UI there so I would just restore all of $OH_USERDATA/config.

As mentioned, those get stored in $OH_USERDATA/jsondb and the file name should make it obvious what they do. Note that stuff to do with Items get stored in multiple files as the Items, Links, and metadata are each stored separately. You’ll want to grab all three for the Items.

Don’t mess with anything in $OH_USERDATA while OH is running for best results.

1 Like

I have finished successfully. thanks a lot. the container performs much fast now. no clue what the issue really was, anyway I’m happy. thanks again!

1 Like