Device Tracker - unifi - calculate the length of time home

Is there a way with either standard HA calculations, or with the unifi integation that I can store the uptime of one device. I know I can add uptime for all with the integration.

Or alternatively, is there a way of calculating the length of time a device is home into a new sensor. I want more granularity than home for 1 hour. I would like an easy to look at sensor for a single device to know in minutes how long it has been home (it gets turned off when not in use).

Edit: Ahh, there is no way to reset the sensor when you are not home, would not work, forget it

Check this

I turned on the uptime sensor. But home assistant doesn’t allow me to set the resolution. So it switches from minutes to hours.

And then after one hour is doesn’t give the minutes after the first hour