Displaying Time - Hour and Minute

Hi,

I would like to display time below date.

Capture33

However is not displaying it at all but time is visible in Paper UI

I have following configs:

Sitemap:

Frame label="Date" {
		Text item=Date
		Text item=Time

Items:

/* NTP binding demo item */
DateTime		Date			"Date [%1$tA, %1$td.%1$tm.%1$tY]"	<calendar>	{ ntp="Europe/London" }
DateTime	    Time            "Time [%1$tH : %1$tm]"	<clock>

Hi Andy, to show hours and minutes you need to define your channel as the date item.
Install the ntp binding and you will able to define the channel to your dateTime item.

Example:

DateTime Time  "[%1$tH:%1$tM]" <calendar>  { channel="ntp:ntp:local:dateTime" }

If you want to show a clock icon, download a .svg clock image and save with the name clock.svg on the /icon/classic folder

The result must be something like this:
Sem%20t%C3%ADtulo

1 Like

Hi Renan,

Great , that works for me - many thanks.

Regards,
Andy

1 Like

I’m trying to do the same thing, but it will not show. I get the data in Paper UI, but not in Basic UI. So far, none of the suggestions in the message boards or the OpenHAB instruction files seem to be working.

Sitemap:

sitemap home label="Hutchins Home Automation" {
	Frame label="Date" {
		Text item=Date
		Text item=Time
	}
	Frame label="Main Menu" {
		Group	item=gUS	label="Upstairs"	icon="firstfloor"
		Group	item=gDS	label="Downstairs"	icon="groundfloor"
		Group	item=gOS	label="Outside"		icon="garden"
		Group	item=gHVAC	label="Heating & Air"	icon="heating"
		Group	item=gA		label="Alarms"		icon="alarm"
		Group	item=gM		label="Mobile"		icon="qualityofservice"
		Group	item=gW		label="Weather"		icon="sun"
		Group	item=gH		label="Holiday Lights"	icon="tree_96"
	}
}

Things file:

ntp:ntp:local [ hostname="0.us.pool.ntp.org", refreshInterval=60, refreshNtp=15 ]

astro:sun:home   [ geolocation="38.67581,121.1327313", interval=60 ]
astro:moon:home  [ geolocation="38.67581,121.1327313", interval=60 ]

Items file:

/*DateTime*/

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

astro:sun:home   [ geolocation="38.67573, -121.1327", interval=60 ]
astro:moon:home  [ geolocation="38.67573, -121.1327", interval=60 ]

openhab.log

2018-12-23 23:14:30.875 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.882 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.889 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.894 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Date' for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.899 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.905 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Time' for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.911 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Time' for widget org.eclipse.smarthome.model.sitemap.Text
2018-12-23 23:14:30.917 [ERROR] [ui.internal.items.ItemUIRegistryImpl] - Cannot retrieve item 'Time' for widget org.eclipse.smarthome.model.sitemap.Text

Maybe those spurious astro lines in your xx.items file are stopping it loading. There should be a clue in openhab.log for that

rossko57, you were right. I didn’t realize that I duplicated the entries. I removed them from the items file and everything is working again. Sometime a second set of eyes is all that is needed.

Thank you!!!