[OH3] Sitemap: how to show date & time?

Dear Colleagues :slight_smile:

I’m a newbie and I’m setting up sitemap and now I’d like create Date & Time Frame. Maybe it’s very simple, but I can’t get it and find some answers in documentation.

  1. I added bidding NTP
  2. I added thing DateTime and have 2 channels: Date (dateTime) & Date (String)
UID: ntp:ntp:local
label: DateTime
thingTypeUID: ntp:ntp
configuration:
  timeZone: Zulu
  hostname: 0.pool.ntp.org
  serverPort: 123
  refreshInterval: 60
  refreshNtp: 30

  1. I created Item with textual definition
DateTime Date  "Date [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]"  { channel="ntp:ntp:demo:dateTime" }

with link channel dateTime (no string) with default profile. After that name of Item is Date [%1$tA, %1$td.%1$tm.%1$tY %1$tH:%1$tM]

  1. And now I have sitemap code
sitemap SMARTHOME label="SMARTHOME" {
    Frame label="Date & Time" {
        Text icon="calendar" label="Today" item=Date
        Text icon="clock" label="Now" item=Time
    }
}

And I don’t understand Where did I make a mistake & what should I add or change to see the date and time on sitemap. Could you advise me?

Just in case:

  • Hardware:Intel® Celeron® CPU N3150 @ 1.60GHz
  • OS: Windows 10
  • Java: Zulu11.45.27-ca-jdk11.0.10-win_x64
  • openHAB 3.1.0.M1

Thanks in advance,

BR, Aleksei.

You defined an NTP Thing called “local”

Your Item is (trying to) linkto a Thing called “demo”

Hi rossko57 and everyone.

I changed my code of Date Item & Time Item like this

DateTime Date  "[%1$tA, %1$td.%1$tm.%1$tY]" <calendar>  { channel="ntp:ntp:local:dateTime" }
DateTime Time  "[%1$tH:%1$tM]" <clock>  { channel="ntp:ntp:local:dateTime" }

And nothing happend. :frowning:

What else am I doing wrong?

Did you confirm on MainUI that the spelling of your chznnel is correct?
Does your sitemap show at all? If saved as a .sitemap file its name has to be SMARTHOME.sitemap.
The sequence of definition for the sitemap entry is odd, I would have started with type and item like Text item=Date .... ( can’t say if that is a problem).
Do you see any satefof Theatern MainUI?

You are using a DateTime object. Sometime I also had problems in displaying this kind of value.
Please try to add a MetaData / State Description: %1$tA, %1$td.%1$tm.%1$tY to your item and then refresh your sitemap.

1 Like

Harald hi. I’m very grateful for your advise. I would never have guessed it. Everything is ok now.

And thanks for all for you participation in resolving my isssue :handshake: