Copy "automation_rules.json" to new instance?

Folks,

My ‘production’ instance of openHab is 3.4.1. Some time ago I tried an in-place upgrade to 4.x and had more problems than I could overcome - so opted for a re-install and migration.

Long story short I’ve made many improvements to my external scripts and have my items defined in a Google Sheet that I can neatly import optimally via text definition. Great stuff.

I also have a number of rules and scripts I’ve created in the UI. The simplest way for me to migrate these to the new instance is to just copy

/var/lib/openhab/jsondb/automation_rules.json

from my production instance to the new server.

Assuming all thing and item names remain the same, and all the external scripts are in the same location, I can’t see any pitfall. Obviously I’d do this with the service stopped on both old and new. Is there any big gotcha that I’m not thinking of?

(I’m planning on moving straight to the latest 4.x release - I’d love to go 5, but I’ll wait a bit now that I’m actually ready to make the jump and have done all my pre-work in 4!)

I’ve never done it but I see no reason your idea wouldn’t work.

Personally I recommend moving the rules over one by one so you only have to deal with one rule at a time blowing up because of some problem or other instead of a bunch blowing up at the same time. But moving the whole file shouldn’t be a problem.

Note however I say this because this is the automation_rules.json file. I’m pretty sure there was nothing done to that file’s contents or format between 3.4 and 4.3. But moving other JSON files like that might be trickier.

Therefore, just in case I’m wrong, I recommend running the upgradeTool after transferring the file but before starting the 4 instance. It’s in the $OH_RUNTIME/bin folder and it’s run with java -jar upgradeTool.jar. When there are changes like that, upgradeTool applies them automatically.

Upgrading from 4 to 5 should go much easier. There are far fewer breaking chnages and a lot of time was invested in OH 4 to make breaking changes easier to hide from end users.

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.