I’d like to apply a transformation on a DateTime item from inside a widget expression to reuse informations from a single item for different purposes without the overhead of creating multiple items and define different transformation patterns.
But regarding your present use case access to a nicely initialized dayjs() instance would be nice. Especially with plugins like RelativeTime (https://day.js.org/docs/en/display/from-now). Day.js is already imported as a library for the charts.
IIRC, Yannick said somewhere that the widgetOrder is considered by the oh-repeater. That’s why I have included it in my fetchMetadata:
Admittedly, I haven’t really checked if it does have the intended effect.
I don’t have the widgetOrder metadata set to the above items yet but am still thinking how to do it by a script based e.g. on location and equipment name.
AND: Maybe, items in lists as above ARE sorted by their item label.
BUT: Since I show the equipment and location label instead of the actual items labels (which are always “Letzte Aktivität” for each in my case), we won’t notice that …
That may be the reason, why the list appears to be unsorted
Hi, great work and i successfully enriched the uiSemantics metadata for my Timestamp items that i created. They are showing in the widget but the format does not seem to be correct at my end. I created all lights and all batteries repeater widgets but here i am struggling. Can someone give me a hint what is wrong? Thank you.
EDIT: corrected working YAML and updated screenshot.
- in test
- in use
- description: A text prop
label: Prop 1
- description: Icon to show
label: the icon
- context: item
description: An item to control
label: The Group Item
timestamp: Feb 20, 2021, 1:10:26 AM
- component: oh-list
- component: oh-repeater
fetchMetadata: semantics, widgetOrder, uiSemantics
filter: '( loop.i.state < dayjs().add(-25,"minutes").format() ) ? true : vars.detailsOn '
- component: oh-list-item
iconColor: '=items[loop.i.name].state === "ON" || items[loop.i.name].state > 0 ? "green" : "gray"'
footer: =loop.i.metadata.uiSemantics.config.preposition.label + loop.i.metadata.uiSemantics.config.location.label
hi, i was not searching for a solution to sort yet and this widget is still on a test page in my openHAB, but i have seen some discussion about the sort order above in this thread that you can use meta data to achieve this.