On Aug 26, 2018, at 1:19 PM, Karol Olszewski <[email protected]> wrote:
> 
> W dniu 24.08.2018 o 23:13, Karol Olszewski pisze:
>> Hi
>> I'm bit closer :)
>> Acctually change "UPS.Output.APCDelayBeforeReboot" to
>> 
>>   { "shutdown.return", 0, 0, "UPS.Output.APCShutdownAfterDelay", NULL,
>> "90", HU_TYPE_CMD, NULL },
>> 
>> Now, UPS turn off load after 90 sec, but not power ON when power is back
>> 
> 
> Dear nut users,
> Two APC Back-UPS CS 650
> 1) Firmware 817.v4.I
> 2) Firmware 817.v3.I
> 
> File apc-hid.c line 431
>  { "shutdown.return", 0, 0, "UPS.Output.APCDelayBeforeReboot", NULL,
> "1", HU_TYPE_CMD, NUL
> 
> Change to
>  { "shutdown.return", 0, 0, "UPS.Output.APCDelayBeforeShutdown", NULL,
> "120", HU_TYPE_CMD, NULL },
> 
> Now, UPS shutdown after 120sec from FSD command, and start from
> hibernation automaticaly when power is back. Excelent!
> (I tested 120,180,300 all work)
> 
> I'm try to set DEFAULT_OFFDELAY and define in ups.conf time to poweroff
> (offdelay and ondelay), but this is not work. UPS set to poweroff after
> ~20sec
> 
> I think this line set to 20sec off time:
> usbhid-ups.h:#define DEFAULT_OFFDELAY   "20"    /* Delay before power
> off, in seconds */
> 
> Where DEFAULT_OFFDELAY is change to value from ups.conf (offdelay=xx)?

I apologize that I don't have time for a complete answer, but maybe this will 
help you follow the flow of the parameters. Let me know if you have questions.

In the NUT source code (as with many other projects written in C), the 
convention is that all-caps names like DEFAULT_OFFDELAY are constants that are 
used if values are not provided for variables like offdelay. In your case, 
DEFAULT_OFFDELAY may not apply if the lines where it is found do not match the 
names for your UPS:

drivers/apc-hid.c:  { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, 
"UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, 
NULL},
drivers/apc-hid.c:  { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, 
"UPS.Output.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_FLAG_ABSENT, NULL},
drivers/apc-hid.c:  { "ups.delay.shutdown", ST_FLAG_RW | ST_FLAG_STRING, 10, 
"UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, 
HU_FLAG_ABSENT, NULL},
drivers/apc-hid.c:  { "load.off.delay", 0, 0, 
"UPS.PowerSummary.DelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, 
NULL },
drivers/apc-hid.c:  { "load.off.delay", 0, 0, "UPS.Output.DelayBeforeShutdown", 
NULL, DEFAULT_OFFDELAY, HU_TYPE_CMD, NULL },
drivers/apc-hid.c:  { "load.off.delay", 0, 0, 
"UPS.APCGeneralCollection.APCDelayBeforeShutdown", NULL, DEFAULT_OFFDELAY, 
HU_TYPE_CMD, NULL },

(Note that the last one has an extra APCGeneralCollection before 
APCDelayBeforeShutdown, so it won't match your UPS.)

For the "offdelay" ups.conf option, it seems to be used through the definition 
HU_VAR_OFFDELAY, and that sets the NUT R/W variable "ups.delay.shutdown". I 
think there is some extra interaction in usbhid-ups.c between the shutdown 
commands and the delay variables, but I don't have time to write that up now.

https://github.com/networkupstools/nut/blob/v2.7.4/drivers/usbhid-ups.c#L1002-L1008
_______________________________________________
Nut-upsuser mailing list
[email protected]
https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser

Reply via email to