I have a samsung washer connected via the samsung cloud. This has an entity “sensor.waschmaschine_fertigstellungszeit”.
(translated: sensor.washer_finishtime)
I use that in a
type: custom:button-card
entity: sensor.waschmaschine_maschinenzustand
state_display: |
[[[
if (states['sensor.waschmaschine_maschinenzustand'].state == 'run')
return states['sensor.waschmaschine_fertigstellungszeit'].state;
else
return "fertig";
]]]
there it is visualized as time of the day including date:
First, these are custom cards. Every custom card may have OWN way to show a value. Yes, they should have a possibility to show values in a same way which used in a stock HA frontend. If they do not - these are questions to custom cards - go to these custom cards’ GitHub repo and leave a feedback.
Second, currently not all stock HA frontend components show data in a same way. There are known issues for “timestamp”, for example. There are registered tickets on HA Frontend repo, they will be solved one day.
P.S. Entities card have a “format” option which can be used to change a presentation, check if it can help you in some way.
So, this template sensor is only needed for “timer-bar-card”?
(have not checked the posted code for the sensor)
Asking because in docs the card shows a value as a time:
As I said, I am not using this card.
But I can speculate that it takes a “duration” from an entry in the “entities” option. Also, there is also a dedicated “duration” option - perhaps it is needed in cases when the mentioned “entity” does not keep a “duration”.
Anyway, assuming that durations are taken from “entities” - then it is logical that the card expects an entity to have a “device_class: duration”.
If the same entity in Entities card allows you to be shown in a “relative” format (“in 45 minutes”) - then I can assume that your entity does have that “device_class: duration”. But suggest you to check it - go to “Dev tools -State” and check this entity.
Finally, if the entity does have “device_class: duration” and the custom card does not process it as “duration” - then this is strange and I am not sure that using a template sensor is a proper way.
Thank you for bringing this dev tools to my attention, I did not know that I can look up every state and attributes there!
From here I can confirm, that this Samsung SmartThings Washer entity has only a “timestamp” attribute:
I still wonder, why despite its a timestamp displayed as duration time in a regular entity card, but anyway, I got my goal to see the duration wherever I want!