DateTime format with OH3 items not working

Hi, am demented trying to something which should be easy. Using an Aeotec door sensor which is wired to a rain sensor outside to show Raining or Dry in OH items & cards. I ALSO want to pick out timestamp when starts/stops raining.
Easy peasy of course with old Basic UI Sitemap, works a dream - see screenshot.
With OH3 UI the Rain/dry part works fine along with icon change etc. However, the long winded Timestamp version keeps showing stubbornly (although it does update ok). But I want a simpler display with just the hour & mins etc. I know what the pattern code should be and it works fine within Basic UI. For OH3 I created an additional DateTime Item and gave it a Timestamp-on-update profile and linked the normal Door close/open channel to it. Also I put a Pattern in the State Description metadata. Have refreshed the webpage and even relaunched OH. Am I doing something obviously stupid or what? Any help appreciated.

Basic UI works a dream

Metadata Pattern stubborn

When you first apply the State Description metadata you often need to refresh the page to pick up the change. Since you’ve done that something else is going on.

Since it’s still not being picked up, you can force it if you configure a Default Standalone Widget and use =items["Raining_since"].displayState as the label. Do the same for the Default List Item Widget.

However, be aware that in most of the pages that you are showing will any of this apply. When looking at the Channels, the Link, and the list of Items in Settings->Items, and I think even in the model, only the raw state of the Item will be shown. It’s only in the widget at the top of the Item’s page, and in Pages that you will see the formatted states.

I’m guessing that last screen shot is from a Locations card so for sure there you’ll need to force it with a Default List Item Widget.

Hi Rich, I fiddled about creating another item with that label and using a Default List Item widget and linked it and then the original UI was formatting correctly but the new Item wasn’t… I deleted stuff and have tried to recreate this but can’t…totally fuddled at this stage :crazy_face:…it’s barmy that something that was so simple and reliable to do in Basic UI + Sitemap has become so labyrinthine and totally fiddly in the new OH
In the pic below, the Top item is the newer one and the lower item is the original one which had been stubborn.


I’ve been struggling with this myself

Right ?!?

I can’t even get it to work in a widget

This is how I feel as well

I don’t know what this means. What original UI?

Show the YAML for the Default List Widget that you applied.

It should still work largely the same way in BasicUI.

Ok what I should have said was the original Item and my effort to get it to display properly did now work (see lower item in the screen pic) whereas the new item/widget had the Timestamp as its label and the raw unformatted data as its display value.
Gawd do I have to start fiddling with YAML code now… :scream: :confounded:
It simply doesn’t work like the Basic UI… the process to do something simple has become a herculean task of fiddling and fudging… I feel like taking out my old Vera box and dusting it off… :roll_eyes:

Of course it doesn’t it’s a wholly new UI with wholly different capabilities. But nothing is preventing you from continuing to use BasicUI as you always have.

You at least need to show it to me if I have any hope of knowing what you’ve done and therefore have any hope to help.

Hi Andrew, relieved to hear other folk are struggling with this too… there must be some bug/flaw in the structures of the new OH that are causing this retrograde step in achieving simple things. I’m exasperated tbh.

Hi, I appreciate you’re trying to help but I’m too exasperated and frustrated by it all now that I’ll try tomorrow with a clearer head.
I know nothing is preventing me from using the Basic UI but we’re all trying to adopt and learn and embrace the new OH so I don’t think one should be advised to go back to the old ways just because the new system isn’t delivering on basics. Yes the new UI has many capabilities and we’re all grappling with them but surely to gawd something like this should be straightforward to achieve. Thanks again anyway.


So wait… What? So a widget is the only place a state description will show???
While I have the two of you attention (Rich or Rossko), can either of you please post exactly what I’m suppose to type into the state description please.
here is old OH2 item

DateTime MyCivilDawn "Civil dawn start [%1$tl:%1$tM %1$tp]" <none> (gHome)

Do I use square brackets? single quotes? double quotes? or just

%1$tl:%1$tM %1$tp

Screenshot from 2021-12-15 20-05-33

I’m the last person to give any advice, especially with the forum heavyweights lurking, but I did stumble on a DateTime format that works for me.

%1$tm-%1$td %1$tH:%1$tM

It produces this on a UI page.
datetime format
The same on a widget;
datetime format2
And lastly the widget yaml.
datetime widget yaml

I like the idea of the month and date spelled out like some of y’all have had, but the above is literally all I know and it is mostly readable, so it is all I use.


No, thanks for jumping in Bob, I think this might be a buggy, I’ve been trying for way to long to get this. Here is your format in my item

here is resulting item

What I’m I doing wrong???

Hi Andrew, you’re doing exactly the same process as me, the pattern looks fine and neither of us can get this (stupid) thing to work. :rage:
The new UI may have a load of new capabilities but it’s falling flat on its face here trying to deliver something that should be (and was) straightforward to do… it would seem to me that there’s some design/coding flaw somewhere that has resulted in this silly situation. One shouldn’t have to start drilling into YAML code, gawd it’s either a UI or it isn’t!

Hi Bob, I tried your Pattern expression also but just as Andrew found out, it didn’t work for me either. It seems to me nobody knows if/when/how this thing works… :roll_eyes:

I have no idea why this would work for one person, but not another.


It’s a brand new UI with way more features and way more capability than any UI for OH that has ever existed. To expect it to be as simple as sitemaps is unreasonable. That’s why BasicUI is still around and will likely remain around. Heck, thats why MainUI even has the ability to create sitemaps.

MainUI is not intended to be a replacement for BasicUI that everyone must migrate to. It’s there if you want to use it. If it’s too hard or complicated to use right now, don’t use it. There is nothing wrong with using BasicUI.

Yes, it should be. In my experience it actually is. So I need from you lot and lots more detail to figure out where it’s going wrong. Have you uncovered a bug? Is there a misunderstanding that can be addressed in the docs? Is there something special about DateTimes? :man_shrugging: I don’t have the information I need to tell at this point. I don’t even know enough to. try to reproduce what you are seeing on my system.

So yes, it’s more complicated. You must fiddle with some YAML so I can see what you have done. Or you must use BasicUI because I can’t help you.

In MainUI yes, that’s my experience. The State Description is unfortunately use in a lot of different ways so it has influence in a number of other areas. But in MainUI, the State Description is only used in a widget.

Just as you posted it. No square brackets, no quotes.

However, the screenshot of your widget code is cut off exactly where I need to see it. Please post the full YAML in code fences and not screen shots which are hard to work with.

You can find the full syntax Formatter (Java SE 11 & JDK 11 )

To get the month spelled out replace the %1$tm with %1$tB for the full month name or %1$tb for the abbreviated month. Your locale’s names for the months are used.

With the information I’ve gathered so far, what you’ve done is not different from what Andrew and Denis have done which is why I need more information. What they’ve described should have worked. It really is that simple and we need more information to understand why it’s not working.

Show your Default Standalone Widget. If you don’t have one, what happens if you create one like what Bob posted?

Look. It should work. It should be that simple. I need that YAML to see what’s going on. Day-to-day you don’t need to ever look at or mess with YAML.

It’s no different than requesting logs and the rules code from someone who is trying to make a rule work. If you don’t want to post some YAML and gather additional information for me so I can help, then please, give up. I can’t help you. No one can. Continue to use BasicUI.

Again, the YAML is for me. I’m the expert on this thread (which is unfortunate since I’m far from an expert on this stuff). I need this information. Nowhere have I ever said that you will have to deal with YAML to make this work. Help me help you!

Rich- Great reference ! thanks. I can now do more than one date-time format :smiley:

FWIW- I get the display state on the UI page for the item, but as you noted, not on the summary item page.

Also don’t know if this will help troubleshooting, but I just started adding DateTime metadata to channels about three months ago on 3.1 stable. I’m currently on 3.2M5, but also used 3.2M4 along the way.



Comment: a lot of confusion stems from MainUI being dual-purpose. Both Admin and User functions. In OH2 terms, PaperUI and BasicUI rolled together.

In Admin areas, we would want to see raw states.

In user’facing areas, we would want to see prettified states.

By design, you could see either depending where you look in MainUI.

Hi Rich,
As shown in the screen shot below from a card display that I sent you last night, I didn’t go creating any new standalone widgets on a separate Pages setup. All I did was fiddle about randomly creating another item and adding a Metadata widget to it and messing with linking and unlinking… is this what you meant by adding Oh-stanalone widgets etc last night? Somehow mysteriously it worked (see screen shot) but I took it apart and haven’t been able to reproduce the temporary success since :grimacing: so there would’t be any YAML code available to me would there? Well I don’t see any option to view the code when I’m dealing with a Metadata pre-made widget. I only see the option to view YAML code when I experiment with Widgets in Pages layout rather than the normal UI location/equipment/properties cards. If one can do this, I don’t know how, sorry. So I’m not trying to be uncooperative and I can see you’re genuinely trying to help but we all seem to be stuck in a web of frustration…
Pattern stuff DOES normally work for the cards but there seems to an issue here where the Profile of Timestamp on the channel is stubbornly overriding & ignoring what the user really wants to see from having inserted a Pattern to present the raw data in the desired way. This is the nub of the problem.
Have you tried to reproduce what I did? My screenshots are clear enough. Do you have a simple door contact & use the magnet or some wires to close/open it and add a timestamp channel? I think if you actually try it you’ll better understand what we’re experiencing and what should appear be in those codes areas. Thanks again for you patience, I’m sure we’re driving you mad too … :upside_down_face: