Migrate openhab2.x to openhab 3 - best practice

hello openhab community,

after a short wait I decided to upgrade my openhab installation to version 3. i use openhabian in a virtual machine. this gives me the possibility to create backups and snapshots relatively easily and to roll them back again.

my first attempt at migration was successful. However, I was shocked that I can use my old rules but no longer edit it. therefore i imported my backup again. I’m thinking about whether to do a complete new installation. I would also move my influxdb and grafana installation to a second VM and no longer rely on openhabian but use ubuntu with the corresponding sources

how did you migrate to openhab 3? does the use of grafana with version 3 still make sense or is the solution integrated in openhab useful for graphs?

Best practice is to use the menu 03 in openhabian-config.
You’re the first to claim rules cannot be edited. In standard openhabian they can be so probably something is weird about your system. As you have setup the OS yourself that’s probably where you screwed up something but you fail to give the required details (you even don’t name the OS and install method) and to properly describe the problem.

If you mean that rules defined in .rules files cannot be edited by the MainUI in OH3 then that is expected behavior. With the exception of a few breaking changes, rules from .rules file will still run just fine in OH3, but you will continue to have to edit them via the files even though the MainUI does show them in the rules settings page. MainUI is getting its rule information from the API and has no access to the .rules files directly and so cannot modify them. If you want to be able to edit your rules via the MainUI then you will have to first rebuild them in the UI (this is not actually onerous as a simple migration can be done mostly with copying and pasting the body of the rule after configuring the trigger).

If you mean that you can no longer edit your .rules files after your update then that is, indeed, strange and unexpected behavior that is, as Markus said, likely a cause of your individual system configuration.

in my current configuration i am using openhabian 2.5. I installed influxdb and grafana via openhabian-config. So far, I have created rules and items using text files.

I have only used the web ui to test my rules based on the log.

I am not quite clear where the difference is between the configuration with text files and the configuration via the web UI. therefore it is also difficult for me to decide whether I should stick with my classic or use the new features.

If you want help we expect you to have read and understood the docs yourself in the first place.
We’re not here to explain this to everybody.
And second you should provide a minimum of information in your posts.
Even more so after 2 people responded that it is likely related to your OS setup.

Hello Community,

I have two installations of OH on two different platforms. One of them is v2.4 on a Synology which I edit all the config files myself over the last 3 years and now v3.2 on a RaspberryPi which is a fresh install from scratch w/o any configuration done to it yet.

What is the best way to get the .rules, .items, .sitemaps files over to v3.2? Copy/paste or is there some sort of import? The openHABian panel only has an import for v3. I’m fine if I have to edit the .rules, .items and .sitemaps on v3.2 in the future vs. using the GUI - very use to it.

Since the bindings have significantly changed from v2.4/5, I plan to grab the bindings from the v3.2 branch and put them in the add-on directory vs. installing them via the GUI.

Any other suggestions/recommendations.

Very excited, Jay

I have been moving a 2.5 working setup to a new install 3.1
The approach I use is copying the files gradually while checking they are working and then moving on to the next item/thing/rule set.
I don’t think copying the bindings is the way to go. I use the builtin 3.1 install making sure it grabs the compatible packages from the official repository.

1 Like

When I upgraded, I set up a fresh OH3, installed bindings, and then used the import feature to paste my .items files into MainUI and generate items. I then copied over my .rules files one by one to check if there were any errors.

I see from your posts that you’re using a lot of bindings that haven’t been ported to OH3. You might want to check out the Remote openHAB binding, which enables you to connect OH3 to an OH2 server so that you can run older bindings.

Hi Russ,
Do you use a zigbee2mqtt binding? If so , how did you “move” your controller and all the z2m things and itmes over from a oh2.5 to a oh3 setup?

I don’t use ZigBee, but I would think the controller can just be moved over to the new server and the associated devices will stay connected to it.

That will result in a somewhat suboptimal solution. Add-ons that are installed by dropping a jar file into the add-ons folder do no show up in settings except for the inbox where you can scan for new things. Also, some add-ons have dependences on other add-ons and if you just drop in the jar file the dependencies are not installed too.

The second part of that sentence though doesn’t flow from the first. What does the difference between the bindings in 2.4/5 have to do with the decision to install add-ons by dropping them into the add-ons folder?

Note, there are a couple of other options that might achieve what you are after in alternative ways.

  1. If you just don’t want to deal with the UI, list the add-ons you want to install using addons.cfg in /etc/openhab/services.
  2. Install add-ons through the Karaf console.
  3. If you don’t want the add-ons to be downloaded from the Internet to install them, install the openhab-addons package using apt/yum or, if you are not on Linux or have a manual configuration download the kar file with all the add-ons and put that into your addons folder. Then when an add-on is installed, whether it be through the UI or the Karaf console, or addons.cfg the actual addon will be pulled from that kar file instead of downloaded from the internet.

Why not directly install 3.2.0-M4 which also gives you the Marketplace and install bindings via GUI.
I am on the Milestone builds since 3.0 and my openHAB is running rock solid.

I’d love to, please tell me what to change on the Linux side to point to that repository?

Still green on this piece of it.

Best, Jay

Apt sources need to be changed from stable to testing. There is a menu entry in openHABian for that i think.

Doesn’t look to be, see below.

I did find this that references branch of MAIN /etc/openhabian.conf.


What do I change this to (testing)?

Best, Jay

Wrong menu. go to “40 openHAB related” and choose Milestone for option 41.


Thank you Rich, it worked.

2021-11-09_12:21:15_CST [openHABian] openHABian configuration tool version: [main]{2021-11-08T20:38:16-07:00}(28ac2c4)
2021-11-09_12:21:19_CST [openHABian] Checking for changes in origin branch main... OK
2021-11-09_12:21:20_CST [openHABian] Switching to branch main... OK
2021-11-09_12:21:54_CST [openHABian] Updating Linux package information... OK
2021-11-09_12:21:54_CST [openHABian] Beginning install of latest openHAB3 milestone build (testing)... OK
2021-11-09_12:22:02_CST [openHABian] Adding required keys to apt... OK
2021-11-09_12:22:03_CST [openHABian] Installing selected openHAB3 version... OK
2021-11-09_12:24:26_CST [openHABian] Setting up openHAB service... OK
2021-11-09_12:24:28_CST [openHABian] Optimizing openHAB to run on low memory single board computers... OK
2021-11-09_12:24:28_CST [openHABian] Setting openHAB HTTP/HTTPS ports... OK
2021-11-09_12:24:28_CST [openHABian] Creating dependencies to jointly start services that depend on each other... OK
2021-11-09_12:24:29_CST [openHABian] Adding an openHAB dashboard tile for 'openhabiandocs'... Replacing... OK
2021-11-09_12:24:29_CST [openHABian] Restarting openHAB service to play it safe... OK
2021-11-09_12:24:47_CST [openHABian] Checking for default openHABian username:password combination... OK
2021-11-09_12:24:47_CST [openHABian] We hope you got what you came for! See you again soon ;)

Best, Jay

There is no zigbee2mqtt binding. Zigbee2mqtt communicates with your MQTT broker, all outside of openHAB (unless you used the integrated MQTT broker in OH2).

Then inside openHAB the MQTT Binding is used to communicate with the same MQTT broker, enabling access to zigbee2mqtt devices.

So moving to OH3 is very easy, as your controller doesn’t change at all, and neither does your MQTT broker if you used Mosquitto. Just install the MQTT Binding, and create/move/update your Things and Items from OH2.

(If you used very old OH1 Item definitions then you’ll need to translate them into Item/Thing combinations)


Thank you!
If I am moving from an OH2.5 setup to a OH3.0( on another ubuntu server), do I need to install a remote binding first on the new OH3.0 setup, and keep both on to move the things and items?

You only need the remote binding if you intend to run the servers side by side. You can do that as you transition, but it’s usually not necessary unless you want to take your time moving items or have legacy bindings as mentioned earlier.