Migration from OH 1.x to OH 2 Tutorial

Hi, How can I delete database used by paperUI ?

I first configured all my items using command line and config file, then I started paperUI and I clicked on the stuff found on the inbox (samsung smart tv binding and ntp binding), and now smart tv control does not work anymore.
I think there is a conflict between paperui conf and file conf. How can I delete paper ui db.

Regars

I’m pretty sure, though not certain, the db is in userdata/mapdb/storage*.

@rlkoshak Thanks’ a million for the effort of making such a thorough tutorial. It helped a lot to avoid heaps of “trial and errors”.

I run OH on Rpi’s and have zwave stuff as well as quite a few MySensors Arduinos which communicate over MQTT. So I made a test installation of OH2 on a separate Pi and used the Eventbus Broker functionality to set up and debug an initial and identical installation on OH2.

Essentially this means that all state changes are sent via MQTT from the OH1.8.3.Pi (the “master”) to the OH2 Pi (the “slave”) and commands are sent the other way. After everything was debugged and worked as expected I have started to convert a few items to the OH2 format to learn about this way of doing things.

Another (little) experience is that it is a help to use the log:tail function of the Karaf console when adding all the OH1 info from a separate Putty console. Then everything new showed up immediately so I did not need to poll the logs over and over again.

Or just run tail -f /var/log/openhab2/openhab.log

It may be because I’m old school but I like to tail and grep through the file rather than logging into the console.

I’m glad the tutorial was a help.

1 Like

I agree, I am using the log beside the console as well but when adding to OH2 part by part it helped to get a quick answer which mostly lead to jumping out of the console anyhow.

I tried that, but it was not successful:
String Weather_Current “Wetter [MAP(weather_de.map):%s]” {weather=“locationId=home, type=condition, property=commonId”}

I used the previous icons also used in the webview and generated icons for wunderground (back in OH1.8.3. already). For OH 1 it was working as desired and showed the icon on the Weather_Current item according to the weather (e.g. sunny). With OH2 it does not work…

EDIT:
Found it myself… See:

Hi, I followed this clean guide and I successfully updated my OH 1.X to OH 2 beta4.
Everything works as expected and now, after a couple of weeks that the system was up and running I want upgrade my zwave binding to 2.X but I cannot uninstall previous binding.
From karaf console if I run " feature:uninstall openhab-binding-zwave1" all I get is this error:

2016-11-13 15:21:58.981 [ERROR] [st.core.extensions.ExtensionResource] - Exception while uninstalling extension: org.osgi.service.resolver.ResolutionException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-ui-habpanel; type=karaf.feature; version="[2.0.0.SNAPSHOT,2.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-ui-habpanel)(type=karaf.feature)(version>=2.0.0.SNAPSHOT)(version<=2.0.0.SNAPSHOT))"

The same error is presents on the openhab log file if I try to uninstall zwave1 binding from paperUI.
Any suggestion ?

I recommend posting this as a separate thread. I’ve no advice to give and as a new thread it will get more exposure and attention.

Ok thanx, I will open a new thread

Hi Rich,
This tutorial has been my bible during my attempts to migrate to OH2 - I’m not there yet despite significant investment!

I’ve just re-read this thread from top to bottom in case there’s anything I’ve missed and one thing I have noted are your comments on addons.cfg - I was advised on a different thread that it was to be used, and that it can’t be used for any 1.x bindings.

My question(s) then, is which version of OH2 are you using, beta or snapshot, how often do you update…and the golden question for me, is what steps do you follow in order to upgrade?

In my experience, an apt-get update && apt-get upgrade ripped out all of the 1.x bindings; hence my move to using addons.cfg and the OH2 bindings.

I’m thinking that you have a scipt to backup certain files etc, then delete the various dir’s which need cleaning up etc.

If I can solve this one, then I can revert back to the 1.x bindings where I’m having trouble (milight & RFXCOM).

Cheers
James

This is incorrect. You can use addons.cfg for any 1.9 bindings that appear in the list of bindings when you list in in the karaf console or on PaperUI. If there happens to be a 2.0 version of the binding and you want the 1.9 version, just append a 1: e.g. astro will install the 2.0 Astro binding whereas astro1 will install the 1.9 version. If you have some unofficial 1.9 addons that are not yet part of the OH 2 distro you put the jar file in your configuration/addons folder anyway and that folder does not get wiped out on an upgrade.

There is a PR awaiting approval which is a rewrite of this tutorial for the official docs which includes a section for using addons.cfg and runtime.cfg.

I run the Snapshot Offline version in a Docker container. I upgrade it a couple times a week. For me upgrading is pulling the latest Docker image, deleting userdata/cache and userdata/tmp and restarting. I have all of this automated through Ansible and shell scripts so once or twice a week, depending on how many security updates there are I run a script and 30 minutes or so later all of my Linux machines (including the Pis) and Docker Images are updated. I’ve scripted this largely because I have set up my Pis to run read only and I use Tripwire for HIDS so upgrading is much more involved than just running apt-get.

Because I use addons.cfg all the addons get reinstalled automatically after I delete userdata/cache.

Soon this delete of folders will not be required.

This is because the upgrade unfortunately wipes out some stuff in your userdata folder. There is an open Issue (I wish I could memorize that number, Kai has posted links to it several times) to fix this behavior.

Because I’m running in Docker and my conf and userdata folders reside outside the Docker container I can actually get away with upgrading without losing anything because the upgrade cannot get at my userdata folders. However, this does mean that my addons never get updated either. The delete of cache and tmp essentially wipes out the installed addons and forces OH to reinstall them with the latest. I could also run an upgrade from the karaf console but that is harder to script and you have to run the upgrade command for each addon as far as I could tell.

Thanks Rick for the detailed and comphrensive reply.

That’s what I understood, at least for the astro1 binding, however, it would appear to be the only binding which has 1 appended, the other 1.9.0 bindings I want to use doesn’t have such an option, but the same name, and so the 2.0 version gets installed:

openhab-binding-milight                   | 2.0.0.SNAPSHOT   |          | Uninstalled | openhab-aggregate-xml                | Milight Binding
openhab-binding-milight                   | 1.9.0.SNAPSHOT   |          | Uninstalled | openhab-aggregate-xml                | Milight Binding

That said,

That being the case, I’ll go and do that - though I did this last time and still lost all the .jar files, I’m not sure why… could have been the apt-get purge I did to start again and get rid of the problems I now know are resolved by removing the contents of the /tmp and cache dirs.

Docker and Ansible are both on my “to learn” list, simplifying and automating my setup appeals, so I’ll note the pointers here.

Thanks again
James

One comment on the github doc (I can’t figure out how to comment on the documentation), the following section:

Text Based

In your configurations folder for openHAB 2 (/etc/openhab2/conf on apt-get installed instances) there is a new folder named services

That’s not the case on my install - I don’t have a conf sub dir, I have:

pi@home ~ $ ls /etc/openhab2
total 108K
drwxrwxr-x  3 openhab openhab 4.0K Nov  9 06:22 icons
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 services
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 sounds
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 sitemaps
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 transform
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 html
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 scripts
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 21:40 things
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 22:05 persistence
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 22:06 rules
drwxrwxr-x  2 openhab openhab 4.0K Nov 19 22:19 items

Cheers
James

1 Like

The tutorial is in error. With an apt-get install the configs folder is /etc/openhab2. I’ll fix it if the PR which will replace this tutorial with official docs didn’t go live tomorrow or Monday.

Hi, thanks for all the work!

I followed the script and I’m having problems with maintaining the zwave network.

According to the script I installed the legacy wave binding. It’s all operational and fine, but…

I can’t maintain the z-wave system with Habmin. If I try to add the controller with Habmin as a thing, the first thing I have to do is to choose from a list of bindings. The problem is that this list is empty. I think this might be because all bindings are shown in Habmin in the tab Extensions, and not as Bindings?

What went wrong?

Thanks.

The legacy binding is a 1.x binding, so you need to configure and maintain it through text files or HABmin1 (which is not working on openHAB2).
Is there a specific reason you want to use an old 1.x binding? It is not updated anymore and newer devices will probably not work on the zwave legacy binding.

The new zwave 2.x binding is working well, just install it through PaperUI and you will be able to configure it through HABmin.

Thanks sihui,

I just installed the legacy bindings because the migration tutorial did say so.

Should I uninstall all legacy bindings and go for the new ones? No problems to be expected with the existing (OH1) items, rules and sitemap files then?
Why does the Migration tutorial state that one should use the legacy binding versions?

thanks

Well sihui,

I did misunderstood the Tutorial, switched the bindings to all new versions, all OK now, thanks !

Leo

The tutorial says that over you get it working with the legacy bindings to one-by-one upgrade to the new 2.x bindings.

Under section 6, General Approach:

Next uninstall the 1.9 binding… Install the new binding. If this is the zwave binding, install Habmin at this time as well.

There migration tutorial gets your current 1.8 configuration working with a minimum of changes. Then you upgrade to the 2.x version bindings one at a time. It is always better to do a little bit at a time rather than try to do it all at once.

Thanks Rikoshak,

I was indeed a bit overenthusiastic, the new binding demanded a re-linking of items to things…

So indeed set all but the Z-Wave binding back to the legacy version and converted the z-wave items piece by piece to the new version. Quite a lot of work.

KR, Leo