networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
2.03k stars 349 forks source link

CPS: for certain models, "ondelay" seems to trigger a reboot regardless of power state #625

Open clepple opened 6 years ago

clepple commented 6 years ago

Partial list of affected models:

Reference:

jimklimov commented 2 years ago

See also #1394

oviano commented 1 year ago

I have just discovered this issue with a new CyberPower CP1500EPFLCD UPS.

I had followed the various tutorials and was testing it all out. I had an offdelay of 60s and an ondelay of 120s.

Sure enough, after 120s the UPS returned back on even though there was no mains power! I understand my only workaround is to set the ondelay to 0s, and hope that when mains power returns it returns long enough to charge the battery.

Is this something that has to be fixed by CyberPower or by NUT?

jimklimov commented 1 year ago

I believe, the fix should be done by CyberPower (if not done yet in some way community developers did not stumble upon yet, see below), since after all this is a hardware-backed behavior that should work in the UPS itself even if the computer with NUT is powered off.

One caveat might be, generally, that different UPS devices implement various commands regarding shutdown and return-or-not under various external conditions. It may be possible that different models (or firmware revisions) of the same vendor implement stuff inconsistently (not always a bad thing, if they converge from some ad-hoc solution to some de-facto standard and sane approach, for example).

So the caveat for me might be if (some) CPS models do implement the command we want, but the NUT drivers call some other command as the default shutdown handler.

For usbhid-ups CPS subdriver we map the following options at the moment: https://github.com/networkupstools/nut/blob/7ac1da177245b836c21ff8422dc4a58df65fda79/drivers/cps-hid.c#L225-L228

And the variant implementations of power commands for the driver are tried at https://github.com/networkupstools/nut/blob/7ac1da177245b836c21ff8422dc4a58df65fda79/drivers/usbhid-ups.c#L733-L782 and the overall shutdown command handling is at https://github.com/networkupstools/nut/blob/7ac1da177245b836c21ff8422dc4a58df65fda79/drivers/usbhid-ups.c#L733-L782 - here it tries sending several commands until one succeeds (per its return code), then see the mapping above for conversion of NUT names to actual USB HID endpoints.

This is something you might experiment with upscmd I suppose, and report if one of the already available mappings does the job better for CPS. Maybe then the (sub?)driver could grow some priority settings for certain device IDs, etc...

oviano commented 1 year ago

I'll investigate upscmd, I haven't looked at that. Thanks for looking at this!

In the meantime I have logged a support ticket with CyberPower and will post back here with any information they provide.

oviano commented 11 months ago

So I went to the trouble of raising a ticket with CyberPower, and also sent them my NUT config files and description of the issue, including a link to this issue.

This was there response:

I would like to inform you that our UPS did not test using any applications or resources from other parties. Furthermore, our UPS systems are unable to set up power on delay.

So, not interested in anything other than their official software basically and no real attempt to help or understand.

Oh well, I tried :)

jimklimov commented 11 months ago

Thank you for that! :)

And to think, how other vendors go to the trouble of providing NUT drivers or even shipping NUT builds as their companion software!

oviano commented 11 months ago

Yep, wish I'd researched it a bit better tbh and found one who better support NUT.

Shame, as I like the hardware.