Update to latest OH2 deleted my items

Hi!

I had some strange behaviour that I wanted to see if was still relevant, so I updated to the latest. I have been using the script proposed below, but that broke after the folder structure revamp. I reinstalled, and thought the script should work now, but guess the script was missing something critical. At least all my things are now gone… My script is as follows:

#!/bin/bash
#
# This script will update your OpenHAB 2 installation.
# The script assumes that the OpenHAB 2 is already installed.  Please shut it down and then run the script
# If OpenHAB 2 is not already installed, create the directories ahead of time, and it will install OpenHAB 2
#
# v2 Greatly simplified for the new OpenHAB2 Karaf online distribution
# v1.1 Jim Howard
#

# The location for archive downloads
DOWN="/opt/DOWN"
# The location of the openHAB installation
HAB="/opt/openhab2"

mkdir -p $DOWN || (echo "cannot make dir $DOWN";exit 1)
mkdir -p $HAB  || (echo "cannot make dir $HAB ";exit 1)

#
# OpenHAB2 section
#
cd $DOWN
wget -N https://openhab.ci.cloudbees.com/job/openHAB-Distribution/lastSuccessfulBuild/artifact/distributions/openhab-online/target/openhab-online-2.0.0-SNAPSHOT.zip || (echo "failure downloading OH2";exit 1)

cd $HAB
rm -rf $HAB/runtime
rm -r $HAB/userdata/cache/*
rm -r $HAB/userdata/tmp/*

unzip -n $DOWN/openhab-online-2.0.0-SNAPSHOT.zip

# clear up some windows clutter not needed with *nix systems
rm $HAB/*.bat

Before the upgraded, I backed up conf and userdata. Would someone be so kind to advise how to properly upgrade?

I looked at the following articles first, but found the information a little to comprehensive as well as “flaky”:

Take a look here:
https://community.openhab.org/t/replacement-of-mapdb-by-jsondb

you need to backup userdata/jsondb (please recheck foldername)

Ouch. But thanks for pointing it out. I’ll start to follow that tag… :slight_smile:

Do you know if there is a way to define things in files instead of paperui?
And is there a way to use things directly in sitemaps? I had created about 60 things, only to be able to refer them in a items file, which was then used in the sitemaps. Right now, it just seems like an unnecessary extra step to both maintain the things and items.

The change referenced above will save all configuration in a text file so you can edit it using PaperUI, or using a text editor - this is the benefit of the JsonDB storage.

You can also use the DSL to define things, but you will loose some functionality - using JsonDB provides a good compromise…

No - this isn’t possible.

I remember reading some comment from Kai that the “old” conf files would be useful to have as read only import. So i thought maybe to rather get the things also into those files (to avoid future loss). But I guess the ease of backup of the json files, as well as flexibility should be more attractive.

But thanks, btw! :slight_smile: