Skip to content

Add battery.charge to hunnox driver#3254

Merged
jimklimov merged 3 commits intonetworkupstools:masterfrom
rtm516:feature/hunnox-battery-charge
Jan 16, 2026
Merged

Add battery.charge to hunnox driver#3254
jimklimov merged 3 commits intonetworkupstools:masterfrom
rtm516:feature/hunnox-battery-charge

Conversation

@rtm516
Copy link
Contributor

@rtm516 rtm516 commented Jan 11, 2026

This adds battery.charge to the hunnox driver as used by Powercool UPS devices. Tested with a real device and works well.

Tested Device: PowerCool 1500 VA (Rack)

After this PR, as you can see battery.charge is included

battery.charge: 100
battery.voltage: 27.4
device.type: ups
driver.debug: 5
driver.flag.allow_killpower: 0
driver.flag.norating: enabled
driver.flag.noscanlangid: enabled
driver.flag.novendor: enabled
driver.name: nutdrv_qx
driver.parameter.langid_fix: 0x0409
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0000
driver.parameter.protocol: hunnox
driver.parameter.synchronous: auto
driver.parameter.vendorid: 0001
driver.state: dumping
driver.version: 2.8.4.1
driver.version.data: Hunnox 0.03
driver.version.internal: 0.48
driver.version.usb: libusb-1.0.27 (API: 0x0100010A)
input.frequency: 49.9
input.voltage: 244.0
input.voltage.fault: 0.0
output.voltage: 244.0
ups.beeper.status: disabled
ups.delay.shutdown: 60
ups.delay.start: 0
ups.load: 0
ups.productid: 0000
ups.status: OL
ups.temperature: 29.0
ups.type: offline / line interactive
ups.vendorid: 0001

General points

  • Described the changes in the PR submission or a separate issue, e.g.
    known published or discovered protocols, applicable hardware (expected
    compatible and actually tested/developed against), limitations, etc.

  • There may be multiple commits in the PR, aligned and commented with
    a functional change. Notably, coding style changes better belong in a
    separate PR, but certainly in a dedicated commit to simplify reviews
    of "real" changes in the other commits. Similarly for typo fixes in
    comments or text documents.

  • Please star NUT on GitHub, this helps with sponsorships! ;)

Frequent "underwater rocks" for driver addition/update PRs

  • Revised existing driver families and added a sub-driver if applicable
    (nutdrv_qx, usbhid-ups...) or added a brand new driver in the other
    case.

  • Did not extend obsoleted drivers with new hardware support features
    (notably blazer and other single-device family drivers for Qx protocols,
    except the new nutdrv_qx which should cover them all).

  • For updated existing device drivers, bumped the DRIVER_VERSION macro
    or its equivalent.

  • For USB devices (HID or not), revised that the driver uses unique
    VID/PID combinations, or raised discussions when this is not the case
    (several vendors do use same interface chips for unrelated protocols).

  • For new USB devices, built and committed the changes for the
    scripts/upower/95-upower-hid.hwdb file

  • Proposed NUT data mapping is aligned with existing docs/nut-names.txt
    file. If the device exposes useful data points not listed in the file, the
    experimental.* namespace can be used as documented there, and discussion
    should be raised on the NUT Developers mailing list to standardize the new
    concept.

  • Updated data/driver.list.in if applicable (new tested device info)

Frequent "underwater rocks" for general C code PRs

  • Did not "blindly assume" default integer type sizes and value ranges,
    structure layout and alignment in memory, endianness (layout of bytes and
    bits in memory for multi-byte numeric types), or use of generic int where
    language or libraries dictate the use of size_t (or ssize_t sometimes).
  • Progress and errors are handled with upsdebugx(), upslogx(),
    fatalx() and related methods, not with direct printf() or exit().
    Similarly, NUT helpers are used for error-checked memory allocation and
    string operations (except where customized error handling is needed,
    such as unlocking device ports, etc.)

  • Coding style (including whitespace for indentations) follows precedent
    in the code of the file, and examples/guide in docs/developers.txt file.

  • For newly added files, the Makefile.am recipes were updated and the
    make distcheck target passes.

General documentation updates

  • Updated docs/acknowledgements.txt (for vendor-backed device support)

  • Added or updated manual page information in docs/man/*.txt files
    and corresponding recipe lists in docs/man/Makefile.am for new pages

  • Passed make spellcheck, updated spell-checking dictionary in the
    docs/nut.dict file if needed (did not remove any words -- the make
    rule printout in case of changes suggests how to maintain it).

Additional work may be needed after posting this PR

  • Propose a PR for NUT DDL with detailed device data dumps from tests
    against real hardware (the more models, the better).

  • Address NUT CI farm build failures for the PR: testing on numerous
    platforms and toolkits can expose issues not seen on just one system.

  • Revise suggestions from LGTM.COM analysis about "new issues" with
    the changed codebase.

Signed-off-by: rtm516 <ryantmilner@hotmail.co.uk>
Signed-off-by: rtm516 <ryantmilner@hotmail.co.uk>
@rtm516 rtm516 force-pushed the feature/hunnox-battery-charge branch from 491ca35 to fd96279 Compare January 11, 2026 16:18
@jimklimov
Copy link
Member

Looks nice, thanks!

@jimklimov jimklimov added enhancement Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others labels Jan 11, 2026
@jimklimov jimklimov added this to the 2.8.5 milestone Jan 11, 2026
@AppVeyorBot
Copy link

Build nut 2.8.4.3958-master failed (commit dae41ce65c by @rtm516)

@AppVeyorBot
Copy link

Signed-off-by: rtm516 <ryantmilner@hotmail.co.uk>
@rtm516 rtm516 force-pushed the feature/hunnox-battery-charge branch from b9f1a0f to d8b30ba Compare January 11, 2026 18:54
@jimklimov jimklimov merged commit e06b8ae into networkupstools:master Jan 16, 2026
30 of 32 checks passed
@jimklimov
Copy link
Member

Great thanks for your contribution!

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

Labels

enhancement Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants