Sitemaps example not working

in openhabian

I decided to have a look at sitemaps.

In the example here:

Is said to be the complete explanation of the example.

sitemap demo label="My home automation" {
    Frame label="Date" {
        Text item=Date
    }

This does not produce the sitemap shown.
Mine shows:
image
I’m guessing it’s because in the line
Text item=Date

Date is an item defined elsewhere?
And I don’t have an item Date defined?

Correct. Sitemaps don’t stand on their own. Nothing in OH stands on its own. That is the source of a lot of the complexity with OH.

If you refer to an Item named Date then you have to actually have an Item defined with that name.

And you have to have something that populates that Date with the actual DateTime, perhaps the NTP binding.

Agreed, it is a strength and a source of confusion. Especially when a new user is trying to suss things out.

Indeed, after posting I added a NTP item thus:

DateTime Date  "Date [%1$td.%1$tm.%1$tY]"  { channel="ntp:ntp:demo:dateTime" }

And the .sitmap to:

sitemap default label="My home automation" {
    Frame label="Date" {
        Text item=Date label="BlaBla [%1$td.%1$tm]"
    }

The Date item is now found, but the sitemap shows the entire date and time.
Isn’t “BlaBla [%1$td.%1$tm]” suppose to change that?

On a different note.
Would it not help to clarify the doc page if the “Full Example” linked above did one or more of the following:

  • Noted in the explanation that the “Date” is indeed an item defined elsewhere.

  • Add a comment:

Text item=Date label="BlaBla [%1$td.%1$tm]" //Date item defined elsewhere
  • Used an item name that would not be mistaken as some sort of built in. For example, instead of “Date”, “MyDate”.

(BTW: I’m happy to login to github and add this if I’m making sense… :man_technologist: )

Does it show “Date 25.09.2018” or just the full ISO 8609 Date Time string? Or does it show "BlaBla " followed by the full date time string?

What version of OH are you running?

Does this problem persist after a restart of OH?

Well, the problem is the Docs are intended to be use together. If we had to mention every time something like this appeared in an example in the docs, they would be more than twice as long and almost impossible to maintain. So I’m not really sure I agree with adding the comment, because ALL Items are defined elsewhere. Using the “item” tag on a Sitemap element ALWAYS means you are referring to an Item defined elsewhere.

We can use a name that is a little less ambiguous.

That would be greatly appreciated. Reference this thread in the issue you create and the comments on your PR. You should be able to make the change in the browser.

image

What version of OH are you running?

openHABian 2.4.0~20180913031338-1 (Build #1361)

Yes

On second reading of the Sitemap link, I see that the sitemap is defined as:

… Sitemaps are used to select and prepare these elements in order to compose a user-oriented presentation of this setup for various User Interfaces (UIs), …

Where elements are defined in the prior sentence as Things and Items.

It may be, because it’s now hindsite for me, that is obvious now.

But, I still think a different name would make it more obvious. :thinking:

I agree.

I don’t see anything obviously wrong with the way you are setting up the formatting. If you don’t try to override the label in the sitemap and instead apply the formatting to the Item does it still fail?

So further experimenting with sitemap, I added a switch. The switch works in paperui > control and habmin > Configuration > Things.

But not from habmin > Sitemaps.

Interestingly, having read the sitemap link intro and it mentioning the Android app…I went to PlayStore and installed in on my phone.

And the sitemap shows up, looks just like in habmin > Sitemaps.

Except, the switch works and the date displayed is only the month and day. :confused:

Let me guess, I missed the part that said “habmin > Sitemaps is only a display of the sitemap and doesn’t control anything”. :roll_eyes:

You didn’t say you are using Habmin. Habmin hasn’t been kept up to date. There are large portions of it that don’t work. You should really only use Habmin for administering zwave and zigbee for now. I suspect it will be quite some time before chris gets a chance to go abck and make everything else work properly in Habmin again.

Use BasicUI or ClassicUI.