How to create a sitemap from a Semantic Model (OH3)

Tags: #<Tag:0x00007f1749451d90> #<Tag:0x00007f1749451c00> #<Tag:0x00007f1749451ae8>

I started from scratch with OH3 on a Raspberry Pi 4 and build a complete semantic model from my environment. But now I want to start using this in Basic UI so I need a Sitemap.
There is where I get confused !

  1. How can I easy create a sitemap?

  2. Is it correct that I need to do this in a text file?

  3. What is the easiest way to do this and use the same Names, labels, Types, Categories and Semantic classes?

I don’t think basicUI is going to be useful. You have to find posts by rlkoshak showing examples. As far as I know documentation is not complete yet so you have to figure out how to proceed by looking at posts in the forum. I am also in the process of trying to understand how to display the model in the MainUI.

I basically copied my OH2.5 sitemap into OH3.
To do so I created the sitemap using the Pages Settings option and then used the code view to do it.

Example result below:

  1. It’s under pages. You could create a sitemap

  2. Semi :slight_smile:

  3. I did it based on the groups I have.

sitemap Sitemap_Haus label="Haus" {
    Group icon="house" label="Orte" {
        Group icon="cellar" item=Keller label="Keller"
        Group icon="groundfloor" label="Erdgeschoss" item=Erdgeschoss
        Group icon="firstfloor" label="Obergeschoss" item=Obergeschoss
        Group icon="garage" label="Garage" item=Garage
        Group icon="garden" label="Garten" item=Garten
        Group icon="temperature" label="Außen" item=Aussen
    }
    Group item=Funktionen label="Funktionen" icon="receiver"
}
2 Likes

you do need one for the Android/iOS App, so there’s that! :wink:
But as the semantic model is based on groups, you can easily do like Björn just posted (Thanks @bjoernbrings, saves me doing it! :stuck_out_tongue_winking_eye: )

1 Like

As far as I understood so far, the model is a way to organize items in nested groups in a standardized way. In particular, it allows you to add predefined “tags” to these groups and items so that it is possible (but I have to figure yet how) to have the mainUI build pages for you. These pages are, in principle, viewable also from the browser of a cell phone.
Sitemaps display Groups that you have to explicitly specify and it seems to me that they ignore the tags, but I may be wrong as I’m still learning.

Or you can use the browser for the mobile friendly Main UI and have a shortcut on your menu to open that.

Hi Lionello; that is also my question: :grinning: :wink: :thinking:

it allows you to add predefined “tags” to these groups and items so that it is possible (but I have to figure yet how) to have the mainUI build pages for you.

You’ve had some good answers already here.

For clarity: the Semantic Model is used by the new MainUI to auto-generate interface pages. It is also used by Habot. It is not used (automatically) by Sitemaps for display in BasicUI - if you want to have a ‘Semantic Model’ style display in BasicUI, you will have to write the Sitemap yourself: it is not done automatically.

2 Likes

1 and 2. There is a sitemap builder built into MainUI. Go to settings -> Pages -> + and select
“sitemap” as the type of page to create. There are a few things that are not supported such as color and visibility. Alternatively you can write it in a .sitemap file.

  1. The sitemap knows nothing about the semantic model which is wholly encoded using tags and Group membership. However, the sitemap knows all about Items and Groups are Items so some of the semantic model stuff can be used on a sitemap. By default the sitemap will use the label and category set on the Item it’s showing. Or you can override those in the sitemap itself.

Sitemaps have been around since OH 1. The docs are complete and unchanged for OH 3. See Sitemaps | openHAB.

Are you thinking about Pages which is completely different. And in that case the Overview Pages get automatically populated based on the model and at least for basic stuff it’s pretty easy to create custom pages just by clicking around. Only if you want to create custom widgets does it get hard.

And I’m not the one who has examples for those. I don’t know much about building widgets.

No you don’t, unless support is only in the beta Android app. I’ve been using MainUI through the Android app for several weeks now. I don’t even have a sitemap anymore.

When you have a model defined:

The Locations, Equipment, and Properties tabs of the Overview Page gets automatically populated.

You can customize these by editing the page (little pencil icon in top right corner) and by setting the Default X widget metadata on the Items. If I wanted to change how that row for the Garage Door looks in that Family Room card, I’d set it in that Item’s Custom default list widget.

That’s correct, it doesn’t know anything about tags. But it does support Groups.

5 Likes

This is helping a lot … Thanks Rich.
just one question;
If i Build the model i can add a “type” and there i see “Location” and “Group” as a type. But what is the difference in behavior for the model?

The Location Item type is a latitude/longitude coordinate and has nothing to do with the Model Location tag.

1 Like

Is it possible to define a grid for the location rectangles? I notice you have a high resolution, so, perhaps therefore more such rectangles fit on your screen.
Or is it configurable?

The number of riws and columns adjusts based on the screen resolution. This is not configurable in the auto generated tabs.

1 Like

I see, and, it looks like in the manually designed Overview Layout Page one can define grids in each block.

Locations only gets populated if you have equipment in a room. If it is empty or the room just has points then it is not shown in locations. Why can a room not just be a collection of points?

If you have a power switch you only need on/off so a point would do without having to include the tree structure that is equipment.

Also, there is a bug, if you run a copy openhab from a folder not called openhab, lets say openhabcopy, you end up with a folder structure in your openhab folder called openhabcopy that is for the userdata folders (all empty) this is in the same drive partition - It looks like someone has left a hard path in.

This win10 & openhab3. Sorry newbie so don’t know how to report bugs.

I really like the semantic model approach :+1:and I build the model representing my home. As I understands this model will be stored in the OH database. It is also very easy to import a items file into the model. But is it also possible to distract or export a kind of item file from the database? It believe that it would be easy to maintain the model via a text file if you have a large model. So extract -> maintain -> import.

No, this is not possible, and won’t be unless some writes the code to give openHAB the ability to do this.

You can start from an Items file though: