openHAB 3, Changing old rules

Hi,

I just upgraded my 2.5 to 3 M5 on a new RaspiPi to test it out. It was actually quite the hassle to get it to work, and I had to delete all my persisted InfluxDB data as I was getting lots of errors etc… but now it seems to be working.

I am now not sure about how to use textual config files, especially rule files, in openHAB 3, if at all. I do sill see the rules directory in the openHAB-conf samba share, I can edit the files, but it seems that those changes are just ignored. Also, it seems that I can’t edit my old rules with the GUI (it says that the rules are “not editable because they have been provisioned from files”.

Do I have to recreate all my rules withing the GUI? Or can I somehow still change rules via textfiles and get those changes into the database somehow?

Also, what about my sitemap files, item files etc.? Will I be able to edit those, preferebly via Visual Studio Code? Somehow I’m a little lost :slight_smile:

Many people have imported them into OH2 I personally have not imported my sitemap.

How can I import the files to OH3? Or do you mean still available via basic UI?

The Basic UI and HABPanel are still available in OH3 as additional UIs to the new Main UI. It does not use Sitemaps but you can create Sitemaps in the new UI if you wish.

I think there is a newer feature to import your text files into OH3 so you can manage & edit entities in the UI.

Only for Items at this time. Other stuff may be added eventually but only Items for now.

Are you watching openhab.log for errors? the fact that you see them listed in MainUI with the lock indicates that the rules are in fact being parsed and loaded.

Correct, if you want to edit them from MainUI, you have to create them from MainUI. you can’t edit the text based configs from the UI.

No, you can use your text based rules and any other text based config. However, there are some breaking changes that might require changes to be made to your rules in particular. Look in openhab.log for errors. You cannot import .rules files directly into the database. You’d have to recreate them through the UI.

Yes of course. All of the OH 2.5 text config files are still supported in OH 3. But, as has always been the case, you can only modify them by modifying the files, not through the UI.

I am experiencing a similar issue with JSR223 rules and have opened an issue for it. Someone else has reported issues with DSL rules that I have linked to in my issue. It would make sense that they are related because DSL rules are running on the same rule engine now.

I am, no entries when changing stuff in any textual file (tried item and rule files). In OH2, it would usually add an entry that the new file was being loaded. Nothing happens in my OH3 openhab.log. Also the rule/script in MainUI does not get changed, and I also don’t get a new item (for example) after adding one in an existing textual item file.

That is working for me

Ok, my bad… I didn’t think about having to change my samba config to use the new directories (e.g. /etc/openhab instead of /etc/openhab2). So I was still changing the openHAB2 files… Not very intuitive to leave the old directories as they are, but I guess I could have noticed that earlier :slight_smile:

1 Like

Sorry, but I got lost with the new way to create a rule in OH3. As I am right there is a new way of gui based building of new rules (similar to HABmin), but NO WAY TO EASY IMPORT OF EXISTING RULES EDITED WITH A TEXT EDITOR??? I can’t believe that…

1 Like

Text based rules just work. No import needed. They cannot be edited in the UI but it was the same in OH2.

You can continue to use .rules files. Or you can recreate your rules in the UI.

The two have fundamental differences that makes importing challenging and in some cases impossible.

Further more, Blockly only works if you only edit with Blockly. As soon as you edit the text you can’t use Blockly any more for that rule.

Your belief has nothing to do with it. That’s The way it is due now.

1 Like

Rich, thanks for your clear words. I am now working with OH since 1 1/2 years.I’ve started with release 2.4. My first solution, based on this release was stable. Since 2.5 I had big issues with memory based problems (i.e. Java memory leaks). Now it is nearly 100% error free, but I have concerns with the upgrade to OH3 now. My OH solution is about 120 rules. I cannot just import the files without the possibility to change the code of these rules further. I am really not sure how to continue…

One possibility could be to have a separate openHAB3 and use the remoteopenhab binding to get your OH2 Items available for linking to OH3 Items… That can permit you to migrate gradually instead of a total cut-over of everything. Once the rules are settled, you can move bindings over and link the Items to the OH3 binding.

1 Like