Reusable Sitemap Sections

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

Thanks

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

2 Likes

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?

Marco

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.

Thanks

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}",
            "\t}",
            "\tFrame label=\"${6:Second frame}\" {",
            "\t\tGroup item=${7:OtherItem}",
            "\t}",
            "}"
        ],
        "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.

2 Likes

Have look here, you could use sed.

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

1 Like

What about this Howto: Generate similar item/sitemap configurations using templates ?

1 Like

I believe that the ungrateful soul followed up with a thanks.

Thanks,

Chuck

1 Like

Hello,

Script is one solution.

Another possibility might be using groups in a clever way. You include only the group in all 4 sitemaps. The real content of the group you configure in the item file(s).

Doing so changes on one place (the item files) will change appearance of all 4 sitemaps.

Regards
Ralf

1 Like

There’s a relatively simple way. Create a sitemap for each of your ‘re-usable’ sections and then use
Webview url=“http://192.168.0.183:8080/basicui/app?sitemap=RSSI” height=19
This displays the RSSI sitemap within the ‘master’ sitemap. You only need to make the changes in the child sitemaps and they’ll automatically update in the master sitemaps

1 Like

Thanks to all for all kind of solution, in next days I will try each one of them so I can find the one that fit to my need.

Marco

that is fine but why not just add a feature that allows to import sections to the sitemap from other files? This would be so powerful and now people have to copy and paste stuff around. It is just one of the first thing anyone looks to avoid and for some reason not a priority in openhab.

Because someone must be willing to spend his time and needs to be proficient enough in openHAB programming. openHAB is a volunteer-driven project. Dunno why you ask me that after 1yr+ but
I’m already contributing my share.

1 Like