Skip to content

APC Back-UPS RS 1300 LCD: battery.date changes to invalid values when battery.mfr.date is written #3796

Open

Description

@Potato314159

Summary

On an APC Back-UPS RS 1300 LCD using usbhid-ups, writing
battery.mfr.date also changes the read-only battery.date to an
invalid value.

The behavior is reversible and reproducible.

Environment

  • Unraid 7.3.4, x86_64
  • NUT package: nut-2.8.5-x86_64-1stable.ssl31
  • Unraid NUT plugin: nut-plugin-2026.10.15-x86_64-1
  • UPS: APC Back-UPS RS 1300 LCD
  • Firmware: 838.H10 .D
  • USB VID:PID: 051d:0002
  • Driver: usbhid-ups
  • Generic HID driver: 0.71
  • APC HID: 0.101
  • USB communication driver (libusb 1.0): 0.53
  • libusb: 1.0.30

Reproduction

Initial values:

battery.date: 2011/00/50
battery.mfr.date: 2020/05/17

battery.mfr.date is writable according to upsrw.
battery.date is not listed as writable.

I changed battery.mfr.date:

upsrw -w -s battery.mfr.date=2026/10/22 -u admin ups@localhost

NUT returned:

SUCCESS

Result:

battery.date: 2056/00/63
battery.mfr.date: 2026/10/22

Writing 2020/05/17 back restores the original values:

battery.date: 2011/00/50
battery.mfr.date: 2020/05/17

Writing 2026/10/22 again reproduces:

battery.date: 2056/00/63
battery.mfr.date: 2026/10/22

I also repeatedly queried battery.date and received the same value
on every poll, so the displayed value is stable.

Source-code observation

My installed version reports APC HID 0.101. I also reviewed the current
master version of drivers/apc-hid.c, currently APC HID 0.102. I
have NOT tested master on this hardware.

Current master contains these mappings:

battery.mfr.date
  <- UPS.Battery.ManufacturerDate
  <- date_conversion

battery.date
  <- UPS.Battery.APCBattReplaceDate
  <- apc_date_conversion

Source:
https://github.com/networkupstools/nut/blob/master/drivers/apc-hid.c

There is an interesting exact numerical relationship between the
written dates and the invalid battery.date values.

The standard HID packed representation of 2026/10/22 is:

(2026 - 1980) * 512 + 10 * 32 + 22
= 23894
= 0x5D56

Applying the apc_date_conversion_fun() calculation from current
master to 0x5D56 yields:

year  = 0x56 -> 56 -> 2056
month = 0x00 -> 00
day   = 0x5D -> 63

giving exactly:

2056/00/63

Likewise, the HID packed representation of 2020/05/17 is:

0x50B1

Applying the same APC conversion yields exactly:

2011/00/50

These are the two values observed on the physical UPS.

This shows that the observed malformed values are consistent with the
standard packed date values being processed by the APC date conversion.
I have not determined why those values reach that conversion.

Expected behavior

NUT should not report impossible calendar values such as:

2011/00/50
2056/00/63

I searched existing issues and found examples of unusual battery.date
values in APC diagnostic output, but did not find an issue specifically
covering this reproducible behavior.

If this is already tracked, please mark this as a duplicate.

I can provide HID/debug output, test current master, or test a proposed
change on the physical UPS if useful.

Activity

  1. added
    unraidIntegration of NUT into unraid OS
    Incorrect or missing readingsOn some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.)
    impacts-release-2.8.5Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks)
    on Nov 4, 2026
  2. added this to the 2.8.7 milestone on Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    APCIncorrect or missing readingsOn some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.)bugimpacts-release-2.8.5Issues reported against NUT release 2.8.5 (maybe vanilla or with minor packaging tweaks)unraidIntegration of NUT into unraid OS

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions