Reusable Sitemap Sections

I’m running OpenHab 2.4.0 Stable, and I have 4 Sitemaps and each one of them have some common section.
Each time I update a section, I need to update 4 Sitemap.
Is there a way to have common section in sitemap, something similar to an “include” ?

Many Thanks


No, but you could write a simple shell script to do that.

What do you need 4 different sitemaps for ?

Hi @mstormi
I have one Full Sitemap for me, one stripped for my wife, one for my daugher and one for me that I use like a quick settings,
For example the light section is common for all sitemap, but the boiler section is only for my sitemap.
Do you have some example of the script you are talking for?


No, that is not specific to openHAB.
Use G**gle.

1 Like

I have been so tempted to use that for many of the threads posted here. :wink:

Just do :wink:
We expect users to contribute their share.

How to ask a good question / Help Us Help You - Tutorials & Examples - openHAB Community

I have used that link many times.
Here is one attempt I made for an ungrateful soul.

EDIT: The binding pages should really have an area to show the first release it was available.

I’m not scripting expert, what i should lookin for on G**gle?


And we’re not your nannies. Look for code to contain my_brain.sendCommand(ON).

Dunno what you mean but just create it. OH docs are on Github so anyone can create a Pull Request.

1 Like

Thanks for suggestion, very useful command


I assumed the page layout and general content guidelines were determined by a central team to insure consistency
I must be new here. :smiley:

Yes but you can’t change it directly like Wikipedia. Any PR involves a review process.
And I think @Confectrician once mentioned that there’s yet another stage your input needs to be copied over to in order to become active.

As said, there are no convenience tools for sitemap management. It’s one of the least developed areas of openHAB, so tedious manual editing is the norm.

But you wouldn’t (shouldn’t!) be editing this every day, it’s a setting up function.

Personally I wouldn’t be looking for some other external script to be copying bits of files around, something else to learn, something else to configure, something else to mess up.
I’d try to structure my “master” sitemap with plenty of comment lines to divide it into clearly labelled chunks. To make manual copy/paste a simple job.

1 Like

There is also somebody working on a new UI to replace the BasicUI. Since all the UIs are using the REST API, that means you can also make your own custom one.

Yes. Future plans for OH3 don’t really help here.

Hi @rossko57,
thanks for suggestion, comment is a smart way to divide sitemap into chuncks and quick identify sections.
What kind of scripting do you use?


Scripting? I don’t - I edit sitemaps. As it happens I use the VSCode editor thingy, but an editor is an editor and copy/paste is pretty universal.

I’m using VSCode too, I will add comments into code.


Hi all,

If you think you may have some kind of reusable sitemap template/content/stuff/whatever
that is needed regularly, we (or to be a bit more clear -> you) could add it as a snippet into the vscode extension.

Snippets are no rocket science and more or less easy to build.
The benefit of an integration is, that everyone who installs the extension may profit from your thoughts and work that you invested in it.
And as a second benefit you don’t need to remember your paste-able contents or where you have saved them.

OK sounds interesting and what would need to be done for adding one?

It is done by proposing a pull request to our extension github repository.
The snippet itself is just some information stored in json.

Here is a sitemap example that is currently live in the extension:

    "sitemap": {
        "prefix": "sitemap",
        "body": [
            "sitemap ${1:sitemap_name} label=\"${2:Sitemap Label}\" {",
            "\tFrame label=\"${3:First frame}\" icon=\"${4:icon}\" {",
            "\t\tText item=${5:Item}",
            "\tFrame label=\"${6:Second frame}\" {",
            "\t\tGroup item=${7:OtherItem}",
        "description": "Create a openHAB sitemap"

This generates an example sitemap container with two Frames and some Dummy Text/Group elements.

Looks like this:

As you can see in the picture, there are some highlighted words, which can be edited in a row with the TAB key.
You can even specify the order of editing.

So if one of you has some snippets that are worth a share, we could add them to one of the next extension releases.
Just poke me, if you need some git/github help.

Just as a side node:
A sign-off statement will be mandatory, when adding something to the extension.
I am handling these very loose for the docs repo, but that’s not possible for the extension repo.
But in my opinion this shouldn’t be a show stopper.


Have look here, you could use sed.

The bad part is, you need to use a special pattern for each include.

1 Like