Ubiquiti UniFi - uptime sensors - time format

I have selected the uptime sensor in the options for Ubiquiti UniFi integration:

And I get uptime sensors that look like this in the developer tools:

So I assume that should be understood as an uptime of 1 minute and 10 seconds.
But how do I display that in the front end?

What I get now is this:

create a template sensor with the following value_template

value_template: "{{states('sensor.smart_me_uptime').split('T')[1].split('+')[0]}}"

Yes that is of course straight forward. I just thought it should not be necessary. I mean what is the use of the uptime sensor in its original format…

There is none. It is useless in its original format. Hence, the template sensor to fix it.



Stumbled across this thread as i was having the exact same issue. However, it would appear the above template sensor only works if < 24 hours uptime?

For example - Picked two of my wifi connected devices.
“Revised Sensor” is based on the above template sensor.

iPhone - On Unifi, uptime is 30min 53 Seconds

Unifi Sensor shows: 1970-01-01T00:30:05+00:00
“Revised Sensor” shows 00:30:53


Nest Camera - On Unifi, uptime is 2 days, 5hours and 58 mins

Unifi Sensor shows 1970-01-03T05:58:41+00:00
“Revised Sensor” shows 00:05:58

Which is correct kind of, but not showing the days… Just 5hrs 58mins

Comparing the two Unifi Sensors:

1970-01-01T00:30:05+00:00 for uptime of 30min 5secs
1970-01-03T05:58:41+00:00 for uptime of 2days 5hrs and 58 seconds

Seems to be start time of 1970-01-01 - and the latter uptime shows 1970-01-03 which accounts for the two days…

Any way of displaying the output in day, hour, mins, seconds? Rather than just hours, mins, seconds?

Guessing it has to be along the lines of subtracting number of days between 1970-01-01and current date in the unifi sensor?

My brain is fizz trying to work this out :frowning:

Any ideas?