[Nut-upsdev] UPS commands

Rob Groner rgroner at RTD.com
Fri Mar 20 19:10:54 UTC 2015


Ok, that’s what it was…I added a dummy report handler for those two report IDs, and now there’s no broken pipe, and both the .delay commands show up for upscmd.  Excellent!  I so far can’t actually set the command due to an ERR ACCESS-DENIED, but I’ll probably be able to figure that out (other than just going all-root).

Sincerely,
Rob Groner

Software Engineer
RTD Embedded Technologies, Inc.
ISO9001 and AS9100 Certified
Ph: 814-234-8087
www.rtd.com<http://www.rtd.com/>

From: aquette.dev at gmail.com [mailto:aquette.dev at gmail.com] On Behalf Of Arnaud Quette
Sent: Friday, March 20, 2015 2:15 PM
To: Rob Groner
Cc: nut-upsdev at lists.alioth.debian.org
Subject: Re: [Nut-upsdev] UPS commands

Hi Rob
I still have an unset draft answer to your previous mail... but you seem to have progressed...

2015-03-20 16:32 GMT+01:00 Rob Groner <rgroner at rtd.com<mailto:rgroner at rtd.com>>:
I’m doing testing of the UPS-side code, including being able to tell the UPS to shutdown and then come back up after a while (if power has returned).

I’m trying to use upscmd so that I don’t have to do an actual shutdown, but when I have it list the commands for my UPS, I just see 4 commands, and they’re not the ones I thought I had specified.

load.on
load.off
shutdown.return
shutdown.stayoff

I  looked in the usbhid-ups file, and I see where, if it finds load.on.delay or load.off.delay, then it adds the 4 commands shown above.  Now, load.on.delay and load.off.delay are the only two commands I *want* to support.  So I put them in my hid2nut table:

/* Commands to control UPS */
{ "load.off.delay", 0, 0, "UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL },
{ "load.on.delay", 0, 0, "UPS.PowerSummary.DelayBeforeStartup", NULL, DEFAULT_ONDELAY, HU_TYPE_CMD, NULL },

So there’s a few things I am trying to figure out:

1)      Where are the commands that I said the UPS had (via HU_TYPE_CMD, I thought) when I use upscmd?

these should be there.
as per the code pointed in (2) below, the above 4 commands are only created if either "load.off.delay", "load.on.delay" or both exists...
practically, you may have identified an issue.
Could you please check if "usbhid-ups -D ..." does list the above HID data (UPS.PowerSummary.DelayBeforeShutdown &DelayBeforeStartup)
The only case I see is that the base data are missing, since we don't check if these HID path actually exists...
please report back so that we can fix the code if needed.


2)      Why does the usbhid-ups automatically add those 4 commands to all usb subtype drivers….can it really know that those 4 commands are supported?  Along those lines, am I supposed to support those 4 commands?
answer here:
https://github.com/networkupstools/nut/blob/master/drivers/usbhid-ups.c#L1002


3)      Finally…what is the usefulness of shutdown.stayoff?  It tells the UPS to shut off its load and not to turn it back on when the power comes back.  If so…how does the UPS ever know to turn that load back on?  You would have to hook a different PC to the UPS and run nut just to send the “load.on” command?
that's a use case and an option.
Some users prefer the default "turn on when AC is back", some others prefer not.

cheers,
Arno
--
Eaton Data Center Automation - Opensource Leader
NUT (Network UPS Tools) Project Leader - http://www.networkupstools.org
Debian Developer - http://www.debian.org
Free Software Developer - http://arnaud.quette.fr
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/nut-upsdev/attachments/20150320/fd63e6b7/attachment-0001.html>


More information about the Nut-upsdev mailing list