For those of you that still use Rule and Item files for OpenHAB, do you put all of your Rules in one file and all of your Items in one file, or do you have multiples of each?
Most of my Items are defined in the Model/Things/Items, but I do have a handful of items defined in a file, but ALL of my Rules are in one “home.rules” file.
Are there advantages/disadvantages to doing it this way?
I think one advantage would be organizing rules into something that makes sense to you. As I recall (UI rules here now) my rules files could become pretty big and unruly. (unruly rules… ha ha) Finding a particular chunk of code could be difficult in a large file.
In addition to what Andrew wrote, every time you save a file it refreshes all of the items/rules. Sometimes, that can have unintended consequences.
There’s no harm in having multiple files. I think of it as effectively categorizing/tagging the rules, similar to what you’d do in the UI. However, in the UI you can add multiple tags: for example, a lightswitch could be tagged as “lights” and “kitchen”.