Closed dilyanpalauzov closed 5 months ago
This iscertainly something to do in core framework. I remember I added that for string and number a very long time ago. I am not sure I did it for dates, maybe it did not know what could be a good default formatting. Unfortunately, I do not find this code anymore. Either it was removed or I don't search it in the good class.
Found it, it was 6 years ago: https://github.com/eclipse-archived/smarthome/pull/3822
I was not looking at the right place. It is done in the channel state description provider, when no default pattern is set in the channel. I correctly remembered, it was done only for channel with item type string or number. I did not add something for datetime just because I was not sure what could be a good default pattern. A valid default would be different in UK/US and in France for example. https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.thing/src/main/java/org/openhab/core/thing/internal/ChannelStateDescriptionProvider.java#L109
By the way, all this was for item/widget without any state pattern but with the item linked to a channel. For an unlinked item, that is true that there is no default formatting, even for a string/number item.
If I am not wrong (to be verified), using "%s" as format will show the internal system representation of the date/time. Could be an acceptable default ?
Having channels provided by bindings without a default pattern is also a wrong practice, so it should not happen if bindings were providing a default pattern.
I have two DateTime
items. One is bound to an EnOcean channel lastReceived
. The other is modified in a DSL rule by getting x.postUpdate(new DateTime)
. Initially both items have a label without [
and ]
and therefore without %s
between[
and ]
.
I start my system anew. These items do not display values in a sitemap. Then I add [%s]
to the labels in the .items
-file. In the sitemap now I can see value of the DateTime item. I remove [%s]
from the labels in the .items file. I can still see the value of the items in the sitemap file.
So the problem report is that there is no implicit [%s]
added to the label of DateTime
items, as this is done for other item types.
The other problem report is that removing [%s]
from the labels in the .items
file does not change the display, which suggests that missing and present [%s]
are the same, but they are not.
@kaikreuzer : please move this feature request to the core repo.
Which UI are you reporting an issue for?
The problem
In .items file I define
and in a sitemap file:
Expected behavior
The system shall display the value of the item in some way formatted, and emphasize when it is NULL or UNDEF. Currently as long as I do not insert in the item’s label
[%1$tH:%1$tM:%1$tS]
, BasicUI shows no value.