Items-file item not saving values. gui item does

I have an item that it used to set a time value which then shall be needed to trigger a lightsout action.

Using the GUI that works. The GUI code is:

label: Abschaltzeitpunkt Aussenbeleuchtung
type: DateTime
category: Time
groupNames:
  - lProperty
tags:
  - Control
  - Timestamp

The item in the model looks like:

Now, want to set up the same item in a file. The items file code is:

DateTime iLightsTimeOutOutside "Abschaltzeitpunkt Aussenbeleuchtung [%1$tH:%1$tM]" <oh:classic:time> (gProperty) ["Control", "Timestamp"] {stateDescription=" " [pattern="%1$tH:%1$tM"]}

The GUI code is:

label: Abschaltzeitpunkt Aussenbeleuchtung
type: DateTime
category: oh:classic:time
groupNames:
  - gProperty
tags:
  - Control
  - Timestamp

The GUI view shows no difference (except names) concerning the setup:

In general I do not see any difference concerning the “setup” of the two items.
BUT:
The value of the item in the GUI item can be set to a value that appears in the widget, e.g. 23:30 (see screepshot).
The value of the file based item cannot be set. It remains to be NULL.

Maybe a remark: The item is so far not used in any rule or so.

What am I missing/doing wrong here?

how do you attempt to do that? The item admin page is not meant to be used for setting values. Use a widget or the console.

Okay, thanks for that hint.
In the meantime I found out (due to the “dark color scheme” after sunset; changed/set values change from grey-white to white color) that it is possible in the admin page when one sets all values, meaning date & time to a value and hits the checkmark. The it works…

Maybe I did that in my gut item without knowing that the admin page is not the best way to set values…

I see no reason why you can not and should not set the Item state from the Item’s page. The “default stand alone” widget of the Item is presented right there at the top of the page and it’s interactive.

You can often also send commands to an Item through the developer sidebar.

image

This works for more than jsut Switches too.


image

Another convenient way to update the Item is to use the -Scratchpad- Script (if you don’t have one create it from the Developer Sidebar, third tab).

If the widgets shown to you on the Item page are not editable, you can override what OH chose as the default and set an editable “default stand-alone widget” metadata on that Item that does let you edit the value.

Yeah, I was just wondering if that is built to work for a ‘locked’ item (provided from files), too.

So long as it is configured, either intentionally or through the default (which is based on item type, semantic tags, and state description metadata), to have a default standalone widget that lets you interact with the Item, you can send a command to that Item from all the places I listed.

All these settings, including the default standalone widget, can be defined in. items files. Item metadata can be defined through the UI even for. items files defined Items since metadata is stored separately from the items.