[SOLVED] Cannot retrieve item 'Date'

Looks like showing the date in basicUI is not hassle free for a beginner that has a little knowledge about the linux system.

  • Platform information:
    openHAB 2.3.0-1 (Release Build)
    Release = Raspbian GNU/Linux 9 (stretch)
    Kernel = Linux 4.14.34-v7+
    Platform = Raspberry Pi 3 Model B Rev 1.2

  • Issue of the topic: please be detailed explaining your issue
    How to display the current time and date on the basicUI?
    Followed this: https://github.com/openhab/openhab1-addons/wiki/Explanation-of-Sitemaps#example to find out at the end that it’s not for this version but can’t seem to find a current solution for this.
    Looked everywhere on the web. Changed to nl_NL.utf8 in openhabian-config but think that is not working because this:
    OK (Europe/Amsterdam)
    2018-06-18_17:53:20_CEST [openHABian] Setting locale based on user choice…
    Generating locales (this might take a while)…
    de_DE.UTF-8… done
    en_GB.UTF-8… done
    en_US.UTF-8… done
    Generation complete.

It is probably something very simple but I can’t see it after looking at a whole lot of pages with info that is out of date. It took me a few hours to make the MQTT working and that looks great but this simple thing called the date is starting to be ridiculous.

  • Please post configurations (if applicable):
    • Items configuration related to the issue
      There are no DateTime items in my openhab home builder generated item file.
    • Sitemap configuration related to the issue
      Frame label=“Date” {
      Text item=Date
      }
    • Rules code related to the issue
      There are no rules files in my openhab home builder generated rules folder.
    • Services configuration related to the issue
      ?. Is there a service need to receive the date and time? Habpanel shows the correct current date and time.
  • If logs where generated please post these here using code fences:
    Cannot retrieve item ‘Date’ for widget org.eclipse.smarthome.model.sitemap.Text

Any idea of what to do next?
Ray.

It looks like you don’t have an item configured with the name “Date”. But you are trying to display that item:

So what you need is a DateTime item configured and linked to a channel or binding:

DateTime Date { channel="whatever your binding is" }

and a text item like you already have but with some format function (you could do the formatting also in your items label):

Frame label="Date" {
Text item=Date  label="Date [%1$td.%1$tm %1$tH:%1$tM]"
}

https://www.openhab.org/docs/configuration/sitemaps.html#concepts

Thanks for the response.
Is there a page/explanation to find about { channel=“whatever your binding is” }?

I had created this items files:
DateTime Date “Date [%1$td.%1$tm %1$tH:%1$tM]” { channel=“ntp:ntp:local:dateTime” }
But that only gives me a few dots and the calender icon.

Yes, there should be always a full example in the bindings docs:

Did you create the corresponding “Thing” for that channel?

Did you install the ntp binding?

Thanks.
That is it.
Just installed the NTP binding and it works.
Thanks again.
Ray

1 Like