Skip to content
UsamaSarwarPublic

About

Skills for installing, configuring, and operating apcupsd with APC UPS hardware

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

apcupsd — AI agent skills & UPS guides

Open-source documentation and agent skills for installing, configuring, and operating apcupsd with APC UPS hardware — with a focused pack for Smart-UPS SUA1500ICH / SUA1500I (1500VA, 230V).

Works with any coding AI agent that can read this repository (Claude Code, Copilot Chat, Cursor, Windsurf, Gemini CLI, and similar). Point the agent at the repo (or paste AGENTS.md) and ask in plain language.

This repository does not redistribute the apcupsd daemon. Install apcupsd from your OS package manager or Homebrew. Upstream apcupsd is GPL-2.0; this project’s docs and skills are MIT.

Developed by Usama Sarwar · support via GitHub Sponsors or Buy Me a Coffee

GitHub Sponsors Buy Me A Coffee

Technician overview

How the pieces connect on a typical site:

flowchart LR
  Mains["Utility / mains"] --> UPS["APC UPS"]
  UPS --> Loads["Protected loads"]
  UPS --> Cable["USB / serial / NIS"]
  Cable --> Host["Host PC / server"]
  Host --> Daemon["apcupsd daemon"]
  Daemon --> Status["apcaccess status"]
  Daemon --> Shutdown["Graceful OS shutdown"]
Loading

What happens when mains fails:

sequenceDiagram
  participant M as Mains
  participant U as UPS
  participant L as Loads
  participant H as Host apcupsd

  M->>U: Power OK
  U->>L: Pass-through / AVR
  H->>U: Poll status ONLINE

  M--xU: Outage
  U->>L: Battery output ONBATT
  H->>U: Detect ONBATT
  Note over H: Watch BATTERYLEVEL / MINUTES / TIMEOUT

  alt Thresholds hit
    H->>H: Graceful OS shutdown
    H->>U: Soft off command
    U->>L: Cut output after SLEEP delay
  else Mains returns first
    M->>U: Utility restored
    U->>L: Back online
    H->>U: STATUS ONLINE
  end
Loading

What’s in the box

Path Purpose
AGENTS.md Routing rules — which skill to load for a given question
skills/apcupsd-setup/ Install, configure, start, verify on Linux & macOS
skills/apcupsd-monitor/ Status, logs, self-test, day-to-day ops
skills/apcupsd-battery-settings/ Return charge, low batt, UPS off delay, transfer volts, host shutdown thresholds
skills/apcupsd-sua1500ich/ Model pack for SUA1500ICH / SUA1500I

Clone or open this repo in your agent’s workspace so it can follow the skill checklists.

Quick start (humans)

Commissioning flow:

flowchart TD
  A[Identify cable: USB / serial / net] --> B[Install apcupsd package]
  B --> C[Edit apcupsd.conf]
  C --> D{Debian/Ubuntu?}
  D -->|Yes| E[Set ISCONFIGURED=yes]
  D -->|No| F[Start daemon]
  E --> F
  F --> G[Wait 30–60s]
  G --> H[apcaccess status]
  H --> I{STATUS + MODEL OK?}
  I -->|Yes| J[Done — monitor & tune]
  I -->|No| K[Troubleshoot cable / UPSTYPE / competing software]
  K --> G
Loading

1. Install apcupsd

Debian / Ubuntu

sudo apt update
sudo apt install -y apcupsd

Fedora / RHEL

sudo dnf install -y apcupsd

Arch

sudo pacman -S apcupsd

macOS (Homebrew)

brew install apcupsd
brew info apcupsd   # read caveats

Homebrew notes (see formula API):

  • Config: $(brew --prefix)/etc/apcupsd/
  • Binaries: $(brew --prefix apcupsd)/sbin/
  • No brew services — install the LaunchDaemon plist manually
  • After every reboot, unplug/replug the UPS USB cable (known kext caveat)

USB kext + LaunchDaemon (macOS):

PREFIX="$(brew --prefix apcupsd)"

sudo cp -pR "$PREFIX/Library/Extensions/ApcupsdDummy.kext" /System/Library/Extensions/
sudo chown -R root:wheel /System/Library/Extensions/ApcupsdDummy.kext
sudo touch /System/Library/Extensions/

sudo cp "$PREFIX/lib/Library/LaunchDaemons/org.apcupsd.apcupsd.plist" /Library/LaunchDaemons/
sudo chmod 644 /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
sudo launchctl load -w /Library/LaunchDaemons/org.apcupsd.apcupsd.plist

2. Configure (USB — most common)

Linux: /etc/apcupsd/apcupsd.conf
Homebrew: "$(brew --prefix)/etc/apcupsd/apcupsd.conf"

Back up first, then set at least:

UPSNAME myups
UPSCABLE usb
UPSTYPE usb
DEVICE

Leave DEVICE empty for USB auto-detect.

Debian/Ubuntu: set ISCONFIGURED=yes in /etc/default/apcupsd.

Sensible host shutdown defaults:

BATTERYLEVEL 15
MINUTES 5
TIMEOUT 0

3. Start and verify

# Linux
sudo systemctl enable --now apcupsd

# macOS — if plist already loaded in step 1
launchctl list | grep -i apcupsd

sleep 45
apcaccess status

Healthy signs: STATUS is ONLINE (or ONBATT if power is out), plus populated MODEL, BCHARGE, TIMELEFT.

Compact check:

apcaccess status | grep -E '^(STATUS|BCHARGE|TIMELEFT|LOADPCT|LINEV|MODEL|UPSNAME|TONBATT)'

Usage by task

Monitor status

apcaccess status

How to read the main fields on the floor:

flowchart TD
  S[apcaccess STATUS] --> O{STATUS value}
  O -->|ONLINE| OK[Mains feeding UPS — normal]
  O -->|ONBATT| Batt[On battery — check TIMELEFT and BCHARGE]
  O -->|Other| Log[Check logs / model / cable]

  Batt --> T{TIMELEFT and BCHARGE}
  T -->|Comfortable| Watch[Stay on site / reduce load if needed]
  T -->|Near BATTERYLEVEL or MINUTES| Prep[Expect host shutdown soon]
Loading
Field Meaning
STATUS ONLINE = mains OK; ONBATT = on battery
BCHARGE Battery charge %
TIMELEFT Estimated runtime
LOADPCT Load on UPS
TONBATT Seconds currently on battery

Linux logs: journalctl -u apcupsd -n 50 --no-pager
macOS: launchctl list | grep -i apcupsd

Details: apcupsd-monitor skill.

Self-test (apctest)

Stop the daemon first — only one of apcupsd / apctest may own the device.

flowchart LR
  Stop[Stop apcupsd] --> Test[Run apctest]
  Test --> Start[Start apcupsd]
  Start --> Check[apcaccess / SELFTEST]
Loading
# Linux
sudo systemctl stop apcupsd
sudo apctest
sudo systemctl start apcupsd

# macOS
sudo launchctl unload -w /Library/LaunchDaemons/org.apcupsd.apcupsd.plist
sudo apctest
sudo launchctl load -w /Library/LaunchDaemons/org.apcupsd.apcupsd.plist

Battery / EEPROM settings

apcupsd cannot set internal charger float/cutoff DC volts. There are two layers:

flowchart TB
  subgraph Host["Host layer — apcupsd.conf"]
    BL[BATTERYLEVEL %]
    MN[MINUTES runtime]
    TO[TIMEOUT seconds]
  end

  subgraph EEPROM["UPS EEPROM — apctest"]
    RC[RETURNCHARGE %]
    LB[LOWBATT minutes]
    SL[SLEEP / UPS off delay]
    LT[LOTRANSFER / HITRANSFER]
    OV[OUTPUTVOLTS]
  end

  Host -->|"When does THIS computer shut down?"| OS[OS graceful shutdown]
  EEPROM -->|"How does the UPS hardware behave?"| HW[UPS transfer / restore / off]
Loading

Map common technician requests:

You want… Set this Layer
Charge % before loads return RETURNCHARGE (00/15/50/90) UPS EEPROM via apctest
Low-battery warning LOWBATT (2/5/7/10 minutes) UPS EEPROM
UPS off delay after soft shutdown SLEEP (020/180/300/600 s) UPS EEPROM
Host OS shutdown before battery dies BATTERYLEVEL / MINUTES apcupsd.conf
When UPS switches to battery LOTRANSFER / HITRANSFER UPS EEPROM (region-specific)

Conservative starter set:

RETURNCHARGE 15
LOWBATT 5
SLEEP 180
WAKEUP 000
BATTERYLEVEL 15
MINUTES 5
TIMEOUT 0

Full allowed values and region tables (D/M/A/I): battery reference.

Cable / connection matrix

Pick the cable type first:

flowchart TD
  Start[How is the UPS connected?] --> USB{USB cable?}
  USB -->|Yes| U["UPSCABLE usb / UPSTYPE usb / DEVICE empty"]
  USB -->|No| Ser{Smart serial DB-9?}
  Ser -->|Yes| S["UPSCABLE smart / UPSTYPE apcsmart / DEVICE /dev/ttyS0 or ttyUSB0"]
  Ser -->|No| Net{Remote NIS client?}
  Net -->|Yes| N["UPSCABLE ether / UPSTYPE net / DEVICE host:3551"]
  Net -->|No| Ref[See setup reference — SNMP / Modbus / dumb]
Loading
Setup UPSCABLE UPSTYPE DEVICE
USB (default) usb usb empty
Smart serial smart apcsmart e.g. /dev/ttyS0
Net client (NIS) ether net host:3551

More options (Modbus USB, SNMP, etc.): setup reference.

NIS (remote status)

flowchart LR
  Master["Master host<br/>NETSERVER on<br/>NISPORT 3551"] -->|LAN| Slave["Slave / laptop<br/>apcaccess status host:3551"]
Loading

On the master:

NETSERVER on
NISIP 127.0.0.1    # or LAN IP + firewall
NISPORT 3551

Query remotely:

apcaccess status ups-master.local:3551

SUA1500ICH / SUA1500I (1500VA 230V)

Spec Value
Family Smart-UPS (line-interactive)
Capacity 1500 VA / ~980 W
Nominal 230 V (region I)
Interfaces USB, DB-9 RS-232, SmartSlot

Region I transfer window (VAC) — widen if the site browns out often; tighten for stricter regulation:

flowchart LR
  subgraph Low["LOTRANSFER choices"]
    L1[208] --- L2[204] --- L3[200] --- L4[196]
  end
  subgraph Nom["Nominal band"]
    N[230 V class]
  end
  subgraph High["HITRANSFER choices"]
    H1[253] --- H2[257] --- H3[261] --- H4[265]
  end
  Low -->|"below → battery / boost"| Nom
  Nom -->|"above → battery / trim"| High
Loading

Example region I points on a VAC scale (allowed EEPROM values only):

flowchart TB
  direction LR
  A["196 LO"] --- B["200 LO"] --- C["204 LO"] --- D["208 LO"]
  D --- E["230 Nom"]
  E --- F["253 HI"] --- G["257 HI"] --- H["261 HI"] --- I["265 HI"]
Loading

Profiles:

Profile LOTRANSFER HITRANSFER SENSITIVITY Use when
Default 230V 208 253 M Typical clean site
Noisy / brownouts 196 265 L Fewer nuisance transfers
Strict regulation 208 253 H Loads need tighter window

Recommended USB apcupsd.conf excerpt:

UPSNAME SUA1500
UPSCABLE usb
UPSTYPE usb
DEVICE
UPSCLASS standalone
UPSMODE disable
ONBATTERYDELAY 6
BATTERYLEVEL 15
MINUTES 5
TIMEOUT 0

Region I EEPROM suggestions:

OUTPUTVOLTS 230
LOTRANSFER 208
HITRANSFER 253
RETURNCHARGE 15
LOWBATT 5
SLEEP 180
WAKEUP 000
SENSITIVITY M

Paste-ready conf + profiles: model.md. Skill: apcupsd-sua1500ich.

Verify:

apcaccess status | grep -E '^(STATUS|MODEL|APCMODEL|NOMINV|NOMOUTV|NOMBATTV|BATTV|BCHARGE|TIMELEFT|LOTRANS|HITRANS|LOADPCT|SERIALNO)'

Expect roughly NOMINV ≈ 230, NOMBATTV ≈ 24.0 V.

Troubleshooting

Field flowchart:

flowchart TD
  P[Problem reported] --> C{apcaccess shows MODEL?}
  C -->|No| Cable[Check cable seat / port]
  Cable --> Type[Confirm UPSCABLE and UPSTYPE]
  Type --> Comp[Disable PowerChute / other HID UPS apps]
  Comp --> Restart[Restart apcupsd — wait 45s]
  Restart --> C

  C -->|Yes| Sym{Symptom}
  Sym -->|Debian won't start| Deb[ISCONFIGURED=yes]
  Sym -->|apctest hangs| StopD[Stop apcupsd first]
  Sym -->|macOS after reboot| Replug[Unplug/replug USB]
  Sym -->|Frequent ONBATT| Trans[Widen LOTRANSFER/HITRANSFER or lower SENSITIVITY]
  Sym -->|Battery disconnected event| HW[Hardware / connector / pack — not an EEPROM float volt]
Loading
Symptom What to try
No model / comms failure Reseat USB; match UPSCABLE/UPSTYPE; stop competing PowerChute/HID managers; restart daemon
Debian service won’t start ISCONFIGURED=yes in /etc/default/apcupsd
apctest hangs Stop apcupsd first
macOS after reboot Replug USB; confirm LaunchDaemon from current brew prefix
Frequent ONBATT on “good” mains Widen LOTRANSFER/HITRANSFER or lower SENSITIVITY (allowed values only)
“Battery disconnected” event Hardware/USB sensing issue — not an EEPROM float-voltage setting
# Linux logs
journalctl -u apcupsd -e --no-pager

Safety

flowchart TD
  Test[Need outage test?] --> Good[Cut UPS input at breaker / PDU]
  Test --> Bad[Do NOT defeat ground / pull grounded mains plug to fake a test]
  Good --> Restore[Restore TIMEOUT to production value afterward]
Loading
  • Prefer cutting UPS input at a breaker/PDU for outage tests.
  • Do not unplug the UPS ground/mains pin to “test” power failure.
  • Restore TIMEOUT to 0 (or your production value) after any timed test.
  • Do not run killpower casually.

Using with an AI coding agent

  1. Open this repository in your agent’s workspace (or attach AGENTS.md + the relevant skills/ pack).
  2. Ask in natural language, e.g. “Set up my SUA1500ICH over USB” or “What is my UPS battery level?”
  3. The agent should follow AGENTS.md routing and the matching skill workflow.

Credits

Developed and maintained by Usama Sarwar.

Support

If this project helps you in the field or with your agents, you can support ongoing maintenance:

GitHub Sponsors Buy Me A Coffee

Contributing

See CONTRIBUTING.md. Use issue templates and the PR template.

License

  • This repository (docs, skills, templates): MIT
  • apcupsd daemon: GPL-2.0 (upstream; not shipped here)

Links

About

Skills for installing, configuring, and operating apcupsd with APC UPS hardware

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors