Uptime depending on entries

Hello there,

I’m having some trouble to get some basic information out of my table.
I have a Series named pmv_battery_current that measure battery voltage over time.
when there is no battery left or some transmission problem, nothing goes into the Series.

So, said differently, my device is on if I have an entry and off when I have nothing for a few minutes.

I’m looking to build a query that could give me an uptime.
I’m supposed to have an entry every minute. I’m was thinking of cutting time into 5min blocks and if I have no entry I suppose my device is off and then I can calculate a percentage out of this to get an uptime.

Does it seem possible? I tried different method but I’m totally new to influx and can’t get anything working.
Elapsed seemed interesting, getting all the elapsed time superior to 2min and then being able to get a downtime but can’t get elapsed where time>5min …

Thanks for your help.