Rolli
(Roland Mayr)
January 13, 2021, 10:00am
1
Hello All
I am using an Item State as Title in a oh-label card, the State of the Item is DateTime Format.
The Items State Description is set,
and the State of the Item is shown correct.
In the oh-label card the raw State is shown.
and the YAML
component: oh-label-card
config:
action: group
item: Muellkalender_Ergebnistitel1
actionGroupPopupItem: muell
fontSize: 18px
iconUseState: true
icon: oh:muell
vertical: false
title: =items.Muellkalender_Ergebnisstart1.state
Is it possible to format the Item State in the YAML to get the correct State description?
Use =items.Muellkalender_Ergebnisstart1.displayState
Rolli
(Roland Mayr)
January 13, 2021, 10:28am
3
That was fast, thank you smarthomepch
It works
1 Like
Eddie_0
(Ralf)
March 3, 2021, 11:06pm
4
Hello!
sorry for my possibly silly question:
I’ve exactly the same problem: I want to change the format of an item state in YAML(the footer). Example is a short Statusdisplay of a computer:
component: oh-label-card
config:
item: MacMini_Online
title: Mac Mini
footer: =items.MacMini_LastSeen.state
background: =(items.MacMini_Online.state=="ON") ? "lightgreen" :"red"
trendItem: MacMini_Online
action: analyzer
actionAnalyzerItems:
- MacMini_Online
icon: f7:desktopcomputer
What I would like to have is a display in the UI like:
2021-03-04 00:10 (Year, Month, Day, Hour, Minute )
instead of
2021-03-04T00:03:55.260+0100
I saw your explanation, but, where to edit the item metadata?
Actually, I have only .state and do not know where to define something like .displaystate
Thanks in advance
Eddie_0
(Ralf)
March 4, 2021, 11:32pm
5
Thanks to all. Solution found here:
No.
Navigate to the Item.
[image]
[image]
[image]
Click on “Add metadata”
[image]
Select “State Description” from the list.
[image]
Put the formatting pattern in the Pattern field.
[image]
Save.
In your custom widget use the displayState.
footer: items.FritzBox_LastSeen.displayState