ISO time formating help

Recently I have bought myself a new smart samsung washing machine and dryer and integrated them in HA using the SmartThings integration which works perfect so far.
I can add entitty card using sensors:

  • sensor.dryer_completion_time
  • sensor.washer_completion_time

And it shows me the remaining time or how long ago it was finished.
Below example shows how long ago the program was completed:
Aantekening 2020-09-09 000809

Above example only works when using entity card, when I used the same sensor in any other way it shows me “garbage”, unreadable ISO time. It just isn’t displayed as nice as it was with entity card.
Aantekening 2020-09-09 0008092

How can i accomplish the same nice remaining/past time information when using these remaining time sensors without using entity card?

I tried playing with templates but i think it can be done more easily. I don’t understand why only entity cards shows it like this and any other card doesn’t?

There’s a good reason ISO one of the most preferred storage formats for datetime …

Try this, which was found in the tempting docs:

{{ relative_time(state_attr("sensor.dryer_completion_time", "last_triggered")) }}

Hi thanks for your reply.
I tried it in development tools templating but it returned None.
Als when i read the docs it ony provides dates in the past and in my case i would like to know how long it takes for the program to be finished. My example showed only when it was completed but it also shows how long untill it is completed.

Anyway, templating is new for me and it’s difficult for me to understand how things work, for example i wouldn;t have figured out to use “last_triggered” in it until you said so.

I will try a few more things. My idea was to do a diff against current time. And when it’s negative it would be completed already and postive would mean how long untill finished. Would that be a good approach and is that easy to accomplish?
Also the remaining time is dynamic, not sure if that would give issues?

I see what you mean about the “forwards in time” issue.
Dynamic isn’t an issue.

I think this may be going too far for templating at this point.

You will have to make a command line sensor or something to get the fuzzy time you’re after.

FYI this is as far as I could logically go with templating:

SUN: {{ state_attr('sun.sun', 'next_dawn') }}
TIMESTAMP NOW: {{ as_timestamp(now()) }}
DIFF B/W NOW AND SUN: {{ as_timestamp(state_attr('sun.sun', 'next_dawn')) - as_timestamp(now()) }}

Will give you seconds remaining. Problem is determining fuzzy time from that.

Thanks for your help and templating example.
I’ll try to find some documentation and examples for command line sensors.

Below is a screenshot that shows completed time and remaining time (highlighted) together. In my situation i’m only intersted in remaining time but i already have that covered once i have the timing thingy fixed.
new