[Nut-upsdev] RunTimeToEmpty is in minutes or seconds?

Charles Lepple clepple at gmail.com
Wed Jan 3 02:19:26 GMT 2024

On Jan 2, 2024, at 1:49 PM, Kelly Byrd <kbyrd at memcpy.com> wrote:
> My question for you all is what units ups.powersummary.runtimetoempty is supposed to be in? This doc from USB.org: https://www.usb.org/sites/default/files/hut1_4.pdf (Section 31.2) says minutes,

Do you mean the Power Device Class documentation?

I agree that the description on p.37 of https://usb.org/sites/default/files/pdcv11.pdf says minutes, but the last reference to RunTimeToEmpty on p.57 is embedded in a descriptor that specifies the units to be seconds. I think most manufacturers end up reporting seconds, since the descriptors tend to look fairly similar to the spec.

> Is this just a case where real world UPS' are using seconds so we're stuck with it now?

That, and the fact that that the HID protocol uses a lot of base SI units.

> I guess it's being pedantic, but IMO trying to measure a UPS remaining runtime with accuracy is sort of silly. I noticed this because I'm cobbling together a personal project that has absurd capacity for the load, somewhere around 2-3 days from a fully charged battery and I'm using NUT's Arduino driver to report things.

To be honest, this is exactly the sort of thing that the Physical and Logical units are meant to address. You can keep the internal time-remaining counter in whatever format makes sense in the firmware, and specify some Logical units to map that back to seconds so you aren't sending 32-bit numbers for something with a really small range.

I'm pretty sure there is one UPS where the shutdown timer settings are kept in minutes, and the NUT drivers expose seconds because the vendor specified a Physical-to-Logical factor of 60.

- Charles

More information about the Nut-upsdev mailing list