Structure of Sitemaps, Items and rules

Is there a way of splitting sitemaps, items and rules to slightly smaller files? Mine are getting pretty large.

The Sitemaps and items I could probably leave. But the rules file is getting a bit unwieldy.

I am using different rules-files with no problems at all. I have rules in separate files for “heating”, “security”, “presence” and so on. You can put all of them in the rules folder and all of them will be executed normally.

I am using multiple item files and everything works OK, but not sure about having multiple sitemaps.

You could break items and rules apart as described earlier. i have done this as described in different areas security, climate, lighting, garden, …

and you could have more than one sitemap, but you cannot break sitemapy apart. Means that you could have a sitemap for the system admin and a sitemap for the family and a special weather sitemap but you cannot split your standard site map into three parts and it is displayed as one map


Some caveats with splitting rules into separate files.

Global vars and vals defined in one file are only accessible in that one file. However, there is/was a bug that could cause problems if you use the same name for a global var or val in more than one file.

I recommend splitting your Items and Rules files apart by functionality rather than by location or some other approach, as @jaydee73 recommends. For example, I have my weather Items and rules in one file, lighting in separate files, entry sensors in their own files, etc. This lets you keep like functionality together and reduces the potential need to reference the same global var and val across multiple files.

Also note that when you separate your Items and Rules into multiple files, those files are loaded in parallel. So you might need to change the polling period (look for the file:: attributes near the top of openhab.cfg) for rules to be later than items. This will make sure that all your Items have been parsed and loaded before rules start running.


With multiple sitemaps, there might be sections of those sitemaps that are common across multiple sitemaps (such as music contol, lighting, etc.). I’d like to see an include directive for sitemaps, such that I could define sitemap “fragments”, then include those fragments in different sitemaps.

This is also proposed here

but no answer yet…