NTP binding: documentation about formatting should refer to DateTimeFormatter Class?

The readme of the NTP binding gives a few indications about how to format a date and time.
I may very well be mistaken, but I think that it should refer to the DateTimeFormatter Class.

The example may need some updating too? I’m willing do that, but I would like some confirmation first that I’m not utterly mistaken. :slight_smile:

I’m migrating to OH3 and sticking strickly to the GUI (since we are moving away from text based configuration). The example of the readme and the reference to the documentation seem to indicate another syntax than that of the DateTimeFormatter Class and do not seem to work when using the GUI. The syntax of the DateTimeFormatter Class does seem to work with the GUI.

No, the docs look correct as is. In Item labels, it’s String Formatter that defines the format of how the state gets presented. You’d only use DateTimeFormatter if you were trying to manipulate how it’s represented in a rule.

You will have to show some more context:

  • Where are you setting the DateTimeFormatter config?
  • Where did you try to set the String Formatter config?
  • What are the configs?

I just configured one of my Items and the String Formatter stuff is working like it always has.

Note this is the formatter String straight from the NTP docs.

Notice I use the displayState in the footer to show the current state of the Item. Then notice at the top the preview of the widget is showing the DateTime as defined by the String Formatter config.

The context: I installed the NTP binding and created an NTP Thing. This NTP thing has two possible channels: a datetime channel and a string channel that can be formatted (as clearly stated in the documentation).

When trying to format the second “string” channel, the formatting syntax stated in the documentation does not work.

For example does not seem to work:

%1$tA, %1$td.%1$tm.%1$tY %1$tT

The following syntax from DateTimeFormatter Class however does work and shows updates in the MainUI (i.e. Event Monitor in the Developer Sidebar):

EEEE, dd.MM.yyyy HH:mm:ss

Turns out that in the end I do not need the formatted string. The KNX binding takes care of it when posting to DPT 10.001. So thanks for the input, but I will no be pursuing this further (for the time being :wink:)

1 Like