Docs for migrating hardware

I’m trying to find docs for migrating my install from what is currently an apt-get based Ubuntu build onto openhabian.

I have already searched the community, but anything with ‘migrate’ in it returns the myriad of docs referring to migrating from OH 1 to OH 2.

If someone has a link or some guidance, please share (it’s a medium sized install - 14 bindings, around 85 devices - significantly more items)

I am ok with migration of the configuration files - it’s all the lost info stored in DB that was created through PaperUI that I am concerned about (Xiaomi Mi, Nest, Onkyo, Yamaha)
I am not too concerned about the persistence stuff (currently MySQL) as I’ll be moving to Grafana/InfluxDB

Assuming there is not a simple method - could I use the rest api and just get/set through all items?

You should copy the config files in /etc/openhab2/[services,items,things,rules]/*.
Plus you can copy the DB, it’s a single file:
/var/lib/openhab2/jsondb/org.eclipse.smarthome.core.thing.Thing.json
There’s also a couple of environment related config in /var/lib/openhab2/etc/* that you might want to copy (such as logging config).

BTW, you can also install the openhabian scripts on top of Ubuntu.

Markus,

Thank you. That’s the answer I was hoping for.

Assuming I installed the openhabian scripts on Ubuntu, could I just run a backup and restore?

Phew, dunno. It could work but it was not designed with that in mind so absolutely no guarantee it’ll work. But since it doesn’t do harm, why not try.

That’s not quite right :wink: There are many different json files that need to be included if you want the settings to come along. If you’re using bindings like z-wave, then entire folders need to be restored also.

You can use the backup and restore scripts in $OPENHAB_RUNTIME to backup and restore everything config related (database and the files in /etc/openhab2). This works across any platfrom or hardware, as long as it can run openHAB2.

On apt based installations (such as Ubuntu, and openHABian), the shortcut for this is:

sudo openhab-cli backup

This will place file in /var/lib/openhab2/backups, copy this zipfile somewhere safe! Then once you’ve installed openhab2 (and Java 8) on the new machine, simply:

sudo openhab-cli restore filename.zip
1 Like

Really - which ones? I ran a backup and quickly glanced over the .zip but didn’t notice any others than the jsondb I mentioned… (yeah okay and its backups and those files that are created e.g. on discovery, but you don’t really need to backup those, applies to zwave files, too, they all can be dynamically recreated).
Just curious…

Either way, good to know you had a migration scenario in mind.
So @bulletprooffool yep don’t just copy what I mentioned but go with that backup script .

Oops, there are a couple more json files but for settings I meant other files within userdata:

  • org.eclipse.smarthome.core.thing.link.ItemChannelLink.json Contains a list of links between channels and Items.
  • org.eclipse.smarthome.core.items.Item.json contains your individual items made in paperUI.
  • The config folder holds settings made when in the Karaf Console and through the paperUI system configuration. (such as log:set, bundle:install etc.)

Benjy,
These are all covered by the backup scripts right?

No disaster if not - but I’ll try anyway to migrate using a backup and restore

They are indeed!

Just make sure to have both configured, but not running at the same time just in-case you want to compare and troubleshoot :slight_smile:

Not running at the same time?
Different IPs on different hardware - so in theory should be OK?

Or have I missed something? (Understandably there may be issues where changing items outside of the OH environment, but if I trigger from one of my dashboards, I should be able to try config changes?

Yes, that should be no problem, was a suggestion to make sure there’s no race conditions etc. :wink:

Righto
Went through the process - Ubuntu to Openhabian and most of it has worked
I am migrated mysql to influxdb, so there will be some faffing with that

The one thing that didn;t work though is that the change has blitzed my nice Openhabian start tiles (FrontTail / Grafana etc.)

I can only see the old stuff I had before.
Is there a way to get the new ones back?

Does it come back if you run the openhabian-config menu to set it up again?

I managed to get it all working thanks :slight_smile:
I only stumbled back on this question . . because I am now looking to migrate the other way . . openhabian, back to a Linux install :slight_smile: