Integrating multiple items and sitemaps to present a single sitemap

Hello Friends,

I am trying to develop a system with plug and play modules which communicate through MQTT.
I am writing a python script which recognizes the modules when they are powered on. Now I need to create items and sitemap for the corresponding modules in OpenHAB.

I need to know, is it possible that for a single sitemap, we can have multiple items file and multiple sitemaps file?

For two modules the files generated by python script:
mod1.items & mod2.items
mod1.sitemap & mod2.sitemap

Can I integrate all these files and present a single GUI to the user?
If not, can anybody show a workaround solution.


I am preparing multiple files for modularity. If for instance module1 goes offline, I simply need to delete mod1.items and mod1.sitemap. And similarly if any new module comes up, I create new files with corresponding name.

You can have multiple items files. You can also have multiple sitemaps, but this probably want you want. Each sitemap is effectively a different openHAB UI and the user must switch between them. If you want to dynamically add content to the sitemap, one technique would be generate the sitemap from a template. When openHAB detects the sitemap has changed it will reload it automatically (assuming autoload isn’t disabled).

1 Like

Hey Steve,

Thanks for the response. Finally I have developed a modular code for:

  1. Prepare different *.items file for each new module.
  2. Edit the Sitemap file to enclose this new module.

I was thinking that sitemaps also use modular blocks for UI, but as you said, each sitemap file presents a different UI to the user. It took a lot of time to edit the same file multiple times without crashing the file.

Phew… Thanks again.

1 Like


Sorry to but in! But this conversation got me thinking…

I was thinking of splitting my .items file out into separate files for different types of device. So weather, lighting, alarm all go into separate files. Coming from coding PHP, this would be how I’d approach something as complex as this in that world.

But I’m sure I read somewhere that doing this would break some of the core funcionalitiy. I can’t for the life of me find the thing that I read that gave me that impression. But as far as I can work out, now that I’ve got to know openHAB a little better, the only restriction would be that I couldn’t include items from separate .items files in the same groups? Is that the case?

The .rules files would be able to access the items wherever they are declared (as long as they are declared!). And in fact it is within the .rules files that most of the logic takes place.



1 Like