OH configuration: Browser- or filebased?

Hello Community,

i’m a friend of file/textbased configuration.
I like the copy and paste, the clean setup (one file per room), no loaddelay, the comment-feature…
Currently i have most of things configured browserbased and all the items textbased.
But in the last few days i got more and more problems with this.

I changed items or parameter of items and the changes where not or not complete processed trough OH.

I renamed an item from “Radiator” to “Thermostat” and created a new iten named “Radiator”.
In the textfiles is everything fine, the log didn’t show any unusual, but in the browserbased item-list i found 2 items named radiator.
A comment out → save → remove comment → save works in the most cases.

My question is:
Should a text-based config work or is it only kept for compatibility-reasons?
Are ther do’s and dont’s ?

Thank you!

A few things worth mentioning here.

  1. Mixing file based and UI based for any one entity type (e.g. Items) is a bad idea and likely to lead you to an inconsistent state. The Model for sure has problems with this. So stick to one or the other.

  2. There is no such thing as renaming an Item, even in text files. What is in fact happening is the old Item is deleted and a new Item is created. Since you are reusing the name of an Item that previously existed I suspect that is causing the problems you see. In the UI, you actually have to delete the Item and create a new one and when you do so you are given the option to clean up stuff like the Links at the same time.

  3. With file based Items that deletion and recreation happens every time the .items file is loaded which can cause a good deal of churn in OH as restoreOnStartup happens and rules get triggered with incomplete sets of Item definitions and such.

  4. Managed entities (i.e. those created through the UI) load way faster than those defined in files because the load and parsing process is far less involved. However, in practice both are really fast so that isn’t really a reason to choose one over the other.

  5. I personally think it’s not worth the effort to try to build the semantic model in .items files. There is too much looking up supported tags and too much mental gymnastics to keep track of which gets shown to you right there in the Model view. If you want to use the Model, using “Create Equipment from Thing” and “Create Points from Thing” is a super efficient way to create lots of Items all in one go and have them situated into the model automatically.

To answer your question though, text based configs work just fine. But as has always been the case since OH 2.0, you have to be a little careful in how you do stuff like “renaming” because simply deleting the Item doesn’t delete the Channel Item Link. And if the Link still exists, OH will think the Item still exists which is likely why you saw two of them. OH got confused by an orphaned Link hanging around.

1 Like