To use relative_time the datetime object must be in the past, not the future.
If it’s in the future, relative_time will simply show the datetime as opposed to the relative time.
The first line of the following example contains a time that is in the future for my local time zone.
The second line contains a time that is in the past.
You appear to be trying to use relative_time to report the washer’s completion time (a time in the future) and it’s not designed to work with future times.
BTW in the lovelace dashboard this sensor is automatically printed as:
“in 15 minutes”
is there a way to have the same string “in 15 minutes” inside an automation?
do I have to calculate the difference between the timestamp and the current time?
I don’t understand. If the Lovelace Ui already shows the sensor’s value as “in 15 minutes” why do you need to create another way to show the same thing? Isn’t it already showing you what you want?
the result will be timedelta object. If you use the the timedelta object’s seconds method, it can be combined timestamp_custom to produce the time in a preferred format.
I provided a rudimentary example. It also has to handle the case of a zero or negative timedelta value (i.e. projected completion time is no longer in the future and is now in the past).
I was working on a post in the other thread where you asked the same question but then deleted it.
but so my work wasn’t completely wasted here is another solution that would have gotten you what you wanted (but I didn’t know tht you already had the correct time displayed in the correct format in the card tho):