OH 2 to OH 3 with Fresh Install Plus Copying conf Directory - does this work?

Hi all,

Planning to migrate my OpenHAB 2.5.6 installation to the latest OpenHAB 3 version, using docker (i.e. using QNAP Container Station). My OH 2.5.6 is working fine but recent side-effects make me believe that my installation might be kind of corrupted. So, instead of doing a migration, I’m considering a fresh installation of OpenHAB 3 and then primarily migrating the conf directory with all things, items, rules, sitemaps, services, persistence, transformations, etc.

My simple question: Will this work? Will OpenHAB 3 understand and use all my files in the conf directory? Or do I need to go through a “migration process” where those files will get transformed, etc. first?

Let me provide some more information:
As far I assessed, there is not too much configuration I did within the UI. Installing a list of bindings and transformations, some locale settings, and I think this is it (well, activating the persistence). I have all my Things and Items in the conf directories, also quite a lot of rules and everything else you configure there (http binding service, etc.).

So I believe I can quite easily replicate the few settings in the UI that I need to have, after a fresh OpenHAB 3 installation.

This is what I would do:

  • Create a new persistence folder for the OH 3 docker container
  • Copy over the OH2 “conf” directory as is to the corresponding OH 3 persistence folder
  • Create the OH3 container and start it up, with the correct persistence folder mappings
  • Go through the basic OH3 installation steps
  • Re-apply the config in the UI as necessary (installing the required bindings, transformations, some locale settings, activating the InfluxDB persistence)
  • With all Things, Items, Rules, etc. already being available in the conf folder, I hope OH3 finds them and knows what to do with it
  • And as of that moment my OH3 installation works with all bindings happily ever after

Does this work? Any recommendations?

I’ll jump in here but I’m no expert so please take what I say with a grain of salt. I think your plan sounds pretty good but please please make a full backup first.
The clean install of OH3 sounds like a good plan, get it up and running first.

I think this will work except don’t copy any .conf files
Copy things, items, rules and sitemaps should work ok, not sure about persistence, I think it is ok thou. Be aware old configuration folder is openhab2 and new one is just openhab (no 2 on the end)
You may have to adjust some of your rules if they include joda time as OH3 now uses java datetime
Make a backup first!!! then let us know how it goes.

1 Like

I can confirm this does work. In fact, you can go further by editing addons.cfg in the /services directory to include a list of the bindings, UIs, persistence services, transformations and actions you want installed.

There are a couple of gotchas though:

  • If you have any time functions in rules, you’ll need to edit them to reflect the change to the time handling library.
  • If you are using any v1 bindings, they will no longer work. Most of them have been replaced with v3 versions but there are some exceptions (TCP being one).

I’m not sure what you mean by the conf and persistence directories. What I call conf is the one with subdirectories items, things, sitemaps etc because in OpenHABain, that is a SMB share that shows up as openhab-conf on windows machines on the network. Persistence is a subdirectory of that.

I run the persistence database on a physically separate machine; I’m assuming you either do the same or at least on a different virtual machine on the same physical one. I found that the new installation of OH3 just kept populating the same tables in the persistence DB so I had a continuous data stream regardless of the originating OH version.

All of the above is why I’m firmly committed to text configuration.

2 Likes

Many thanks for your quick reply and input!

The “beauty” of this approach is that I can keep the OH2 installation untouched in parallel, so I can go back at any time, shutting down the OH3 container and starting up the OH2 container. The OH3 docker container will have its own path / its own persistence folders for the container.

For clarification: I will only copy over the files under the openhab/conf folder, i.e. the things, items, rules, etc. that I wrote myself. I will not copy over any system config files of any other installation directories. It shall be a completely new installation. Exception: the only other thing that I am copying over are two bindings (.jar file) from the addons folder (Worx Landroid Binding, Miele Cloud Beta binding).

Side-remark:
I’m currently using InfluxDB 1.7 as the persistence DB for OH2. My plan is to build up a parallel docker container with InfluxDB 2.x with its own persistence folders, and migrating the data over (based on the Influx website there is now a migration path for docker). Means, as a very first step, before I start the OH3 installation / migration, I will build up InfluxDB 2.x with the data migrated from InfluxDB 1.7.

So if everything goes well, I will end up with OH3 using InfluxDB 2.x, and if things go wrong I still have my current OH2 / InfluxDB 1.7 installation that I can spin up again. And for completeness, I recently upgraded Grafana from 6.6 to 7.3 so this one should be ready for InfluxDB 2.x as well.

Any additional comments and input especially regarding the OH2 → OH3 migration path mentioned in the first posting would be appreciated!

1 Like

Thanks so much for your posting, really helpful. Our postings crossed and let me quickly reply separately here.

Great to hear that it will work, so I have my migration path. Quick clarification regarding the points you mentioned:
“conf” folder: Yes, we talk about the same
“persistence”: When you use docker, everything in the container is temporary, i.e. you lose it when you stop the container. So you need to map some docker-internal folders to folders outside the container that persist also once the container is shut-down. For example the “conf” folder you don’t want to lose, or for your database the files that store the data you don’t want to lose. These are the “persistence folders” of the docker container. I know it’s confusing because OH also uses the term “persistence” but the one has nothing to do with the other.

Thanks to both for the hints regarding the time / timestamp format. I read about it in the migration guides and I think I am impacted but for low-priority features, i.e. I will fix it once it is broken. Regarding V1 bindings, I’m not aware that I have any but will check again before the migration.

Finally, yes, exactly situations like these confirm to me as well that it was the right decision to put everything into the config files under the “conf” folders and not use auto-discovery within the UI, etc.

Thanks again, highly appreciate everyone’s help and input!

1 Like

Hi @sirupflex, one side note about “copying over” the Miele Cloud Binding: Please install the latest version compiled for openHAB 3 instead of copying over the version compiled for 2.5.x. The old version will not work with openHAB 3. Have a nice day.

Thank you very much, @BjoernLange . I planned to use the latest binding version for OpenHAB 3, indeed.

Maybe a stupid question: Why are your V2.5.x bindings not working under OpenHAB 3? I thought all OpenHAB 2.x bindings are compatible with OpenHAB 3 and only OpenHAB V1.x bindings are not working any more.

There’s some further information in this post https://community.openhab.org/t/guide-binding-development-changes-for-openhab-3-from-2-5-x

I must admit that I’m not aware whether 2.5 bindings work with openHAB 3 in general. For the Miele Cloud Binding I’m sure that it is not fully functional (even if it should boot up) because we use an openHAB “internal” function for the automatic thing configuration that changed from openHAB 2.5 to 3.0 (this is an Application Binary Interface incompatibility, just to drop the technical term here :wink:).

Thank you very much @barneyd and @BjoernLange . It is a bit confusing for me around OpenHAB 3 compatibility and meanwhile it looks to me like all bindings had to be redeveloped for OpenHAB 3. In any case, I found working bindings for all of my needs, as far as I can tell.

I’m in the process of migrating from Grafana 6.6, InfluxDB 1.7 and OpenHAB 2.5.6 to Grafana 7.x, InfluxDB 2.0.4 and OpenHAB 3.0.1. 95% went fine so far and thanks to docker I can build the new infrastructure in parallel to the old one without time pressure and without impacting the old one because I also have a parallel instance of InfluxDB now and an easy, reproducible data migration path.

Short feedback that I can give already is that the migration path described in the initial posting does work, indeed. Depending on used bindings, things, etc. it will require manual fixes of various aspects / configurations but generally it works. Also the upgrades to Grafana 7.x and InfluxDB V2 have their painpoints that are taking time for resolution / adaptation (depending on your initial setup, of course) but at the end it is manageable.

One of the few remaining things to be resolved is the changes in time format with OH3 … argh, I really hate this topic and in the past it took me days for OpenHAB 2 already to get some rules working that use elements like Astro_Sunset, etc. Now I have to dive into that mess again. Well, sooner or later I will be able to fix it, I hope.

1 Like