8000 drivers: powercom-hid: use offdelay/ondelay config options for shutdown commands by Vladdrako · Pull Request #3288 · networkupstools/nut · GitHub
[go: up one dir, main page]

Skip to content

Conversation

@Vladdrako
Copy link

The powercom_shutdown_nuf(), powercom_stayoff_nuf(), and powercom_startup_nuf() functions were reading delay values from dstate_getinfo("ups.delay.shutdown") and dstate_getinfo("ups.delay.start"), which return the UPS's CURRENT delay values read via HID.

However, users configure their desired delays via the "offdelay" and "ondelay" driver options in ups.conf. These were being ignored.

This patch changes the functions to:

  1. First try the value passed directly to the instant command
  2. Then try getval("offdelay")/getval("ondelay") from driver config
  3. Then try dstate_getinfo() for current UPS values
  4. Finally fall back to sensible defaults (60s shutdown, 120s startup)

This ensures that user configuration is respected.

Tested on Powercom RPT-800AP (VendorID: 0x0d9f, ProductID: 0x0004).

Prevents daemon.crit usbhid-ups[10112]: instcmd: attempting a power state change operation [shutdown.return] [(null) (21504.000000)] on [powercom] with broken 21504 value

…wn commands

The powercom_shutdown_nuf(), powercom_stayoff_nuf(), and
powercom_startup_nuf() functions were reading delay values from
dstate_getinfo("ups.delay.shutdown") and dstate_getinfo("ups.delay.start"),
which return the UPS's CURRENT delay values read via HID.

However, users configure their desired delays via the "offdelay" and
"ondelay" driver options in ups.conf. These were being ignored.

This patch changes the functions to:
1. First try the value passed directly to the instant command
2. Then try getval("offdelay")/getval("ondelay") from driver config
3. Then try dstate_getinfo() for current UPS values
4. Finally fall back to sensible defaults (60s shutdown, 120s startup)

This ensures that user configuration is respected.

Tested on Powercom RPT-800AP (VendorID: 0x0d9f, ProductID: 0x0004).

Signed-off-by: Vladyslav Andreichykov <vladdrako007@gmail.com>
@jimklimov jimklimov added bug USB Powercom Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved impacts-release-2.8.4 Issues reported against NUT release 2.8.4 (maybe vanilla or with minor packaging tweaks) labels Jan 28, 2026
@jimklimov jimklimov added this to the 2.8.5 milestone Jan 28, 2026
@jimklimov
Copy link
Member

Thanks for the change and for testing it! I'll update the news entry and some comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug impacts-release-2.8.4 Issues reported against NUT release 2.8.4 (maybe vanilla or with minor packaging tweaks) Powercom Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved USB

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0