On Sep 17, 2010, at 9:00 AM, Will Cooke wrote:

On 17 September 2010 13:26, Charles Lepple <[email protected]> wrote:

<snip>

Also, if you want to include the output of "diff -u" (or "svn diff")
from your changes, we can take a look at that. You're probably close,
but the HID parsing code is pretty complex.

I love your optimism ;).  I risk having my Linux Users licence revoked
by sharing that "code".  Basically all I've done is modify the
hid_into_t thus:

{ "BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent",   NULL,
"%s", HU_FLAG_QUICK_POLL,
liebertpsp_presentstatus_acpresent_conversion },

to make it call my function which then just prints out "value" using
the upsdebugx function.  Once I could see the correct value I was
going to work out an IF statement.

Remember when I said you were really close? Apparently, now that we've figured out that it isn't really "0.000000" for both cases, I think you just need to multiply the value by 1e7 in that function, sort of the same way that some Tripplite voltages are multiplied by 10:

http://trac.networkupstools.org/projects/nut/browser/trunk/drivers/tripplite-hid.c#L155

This function multiplies by the variable "battery_scale" because some Tripp-Lite product IDs get this right, and others don't - so the scale factor is set at initialization time. You might want to try a similar approach, just in case a new model comes out.

The input and output voltages look like they need a similar adjustment, and the frequency probably needs to be divided by 10. Actually, this was mentioned in another email thread in July:

http://lists.alioth.debian.org/pipermail/nut-upsuser/2010-July/006104.html

... and that seems to indicate that BatteryPresent and maybe other booleans need a scale factor, too.

_______________________________________________
Nut-upsuser mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsuser

Reply via email to