{%- set time = (as_timestamp(now()) - as_timestamp(states('sensor.uptime'))) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set minutes = '{}m'.format(minutes) if minutes > 0 else '' %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set hours = '{}h '.format(hours) if hours > 0 else '' %}
{%- set days = (time // 86400) %}
{%- set days = '{}d '.format(days) if days > 0 else '' %}
{{ 'Less than 1 min' if time < 60 else days + hours + minutes }} ago
You can change the formatting by {}m, {}h, {}d if you wish. I just like the format of 5d 2h 23m ago
My remark about “uptime” was based on a name of the sensor from the 1st post:
sensor.u6_lr_uptime
But it’s value looks like a timestamp.
This was not about a device_class (btw, there is no a “uptime” device class).
My remark was only about “why an Uptime value contains a timestamp, may be it should be called a StartTime”.
I was only trying to explain why it makes sense to use a timestamp instead of an actual uptime in seconds. The actual uptime integration does the same thing