[Nut-upsuser] persistent "low battery" condition

Charles Lepple clepple at gmail.com
Mon Jan 12 13:39:14 UTC 2015

On Jan 11, 2015, at 11:48 PM, Graham Menhennitt <graham at menhennitt.com.au> wrote:

>> The file drivers/usbhid-ups.c is looking for any of the following conditions to declare LB:
>> The mapping to HID Path names will depend on the model, but STATUS(LOWBATT) can come from ...BelowRemainingCapacityLimit, which is 0 in both instances in your log. STATUS(TIMELIMITEXP) maps to ...RemainingTimeLimitExpired, which I don't see, and STATUS(SHUTDOWNIMM) would cause an ups.alarm message to show up in upsc.
> Thanks very much for replying, Charles.
> I've done a bit more investigating. I added a diagnostic printf("%x", ups_status) at the point where LB is set. It shows that it's RemainingTimeLimitExpired that's causing the LB condition. Below is a bit more of the driver log which shows RemainingTimeLimitExpired changing to 1 and then back to 0 again. What does that variable mean?

Ah, when I said earlier that I didn't see "RemainingTimeLimitExpired", it seems that it is not being polled as frequently as the other values. (See "pollfreq" versus "pollinterval" in the usbhid-ups man page, which map to the "Full update..." and "Quick update..." sections in the debug output, respectively.)

RemainingTimeLimitExpired is supposed to indicate that the estimated battery time remaining is below the RemainingTimeLimit threshold (battery.runtime.low in the NUT variable namespace), but your UPS isn't publishing that time threshold, only the current remaining time estimate. (Per the previous email, the battery.runtime.low value in upsc seems to be coming from the override.battery.runtime.low setting in ups.conf.)

I still think the combination of override.battery.runtime.low and the ignorelb setting should get you the shutdown trigger you are looking for. You might also need to set pollfreq to a lower value than its default of 30 seconds, since the RemainingTimeLimit value is not requested during the Quick update every two seconds.

On the other hand, the whole reason for the two separate polling frequencies is that low-speed USB is only 1.5 Mbit signaling, and has even lower throughput, so it isn't possible to poll all of the variables every two seconds. You could try setting the HU_FLAG_QUICK_POLL bit in drivers/apc-hid.c on RemainingTimeLimit. At that point, you should be able to see how often the UPS updates the runtime estimate - it might be dropping below 90 (or whatever the internal threshold is for RemainingTimeLimit) for short intervals.

Charles Lepple
clepple at gmail

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsuser/attachments/20150112/09210229/attachment.html>

More information about the Nut-upsuser mailing list