Monitoring a UPS in Home Assistant: NUT Integration, Add-on and Automations

Home Assistant reads UPS data through its Network UPS Tools (NUT) integration: point it at any NUT server on port 3493 and it creates sensors for status, battery charge, runtime and more. If the UPS USB cable plugs into the Home Assistant machine itself, run the NUT add-on there first.

On this page
  1. Pick your architecture first
  2. Running the NUT add-on on Home Assistant OS
  3. Adding the NUT integration
  4. Automations that earn their keep
  5. Testing without waiting for a storm
  6. A dashboard worth having
  7. Things that catch people out
  8. Frequently asked questions

Pick your architecture first

Home Assistant does not talk to a UPS directly. It talks to a NUT server, which talks to the UPS. Where that server runs depends on where the UPS data cable goes.

Three common setups
UPS data cable plugged intoNUT server runs onIn Home Assistant you install
The Home Assistant machine (HA OS)The NUT add-onNUT add-on, then the NUT integration pointing at it
A NAS (Synology, TrueNAS) or Linux server already running NUTThat machineNUT integration only, pointing at the server
A machine running apcupsdapcupsd network information serverAPC UPS Daemon integration

Running the NUT add-on on Home Assistant OS

On Home Assistant OS (and supervised installs), a community-maintained Network UPS Tools add-on runs the driver and server for you. Install it from the add-on store (Settings, Add-ons), then configure it. The add-on's configuration typically looks like this in YAML mode:

users:
  - username: nutuser
    password: change-me
    instcmds:
      - all
    actions: []
devices:
  - name: myups
    driver: usbhid-ups
    port: auto
    config: []
mode: netserver
shutdown_host: false

Option names can change between add-on versions, so compare against the add-on's own documentation tab. Two settings deserve attention:

  • shutdown_host: when true, the add-on shuts down the Home Assistant host on low battery. That is reasonable for a dedicated HA machine, but read the add-on notes about how it interacts with the UPS power-off sequence.
  • mode: netserver: lets other machines on the network connect as NUT clients. Add a separate user for them.

Start the add-on and check its log. A line showing the driver connected to the UPS, without repeated "data stale" warnings, means it is working.

Adding the NUT integration

  1. Go to Settings > Devices & services and choose Add integration.
  2. Search for Network UPS Tools (NUT).
  3. Enter the host: the add-on's hostname (the add-on's documentation lists it, often a0d7b954-nut for the community add-on) or the IP of your NAS or server.
  4. Port 3493, plus the NUT username and password. For a Synology server these are commonly monuser and secret; see Synology UPS setup.
  5. If the server has more than one UPS, pick the one to add.

The integration creates a device with sensors. Names derive from the UPS name, so a UPS called myups yields entities such as sensor.myups_status, sensor.myups_battery_charge and sensor.myups_battery_runtime. Some sensors are disabled by default; enable the ones you need on the device page.

What the sensors mean

Common NUT variables and their sensors (availability depends on the UPS)
NUT variableTypical sensorNotes
ups.statusStatus (raw flags) and a human-readable statusOL, OB, LB, CHRG, RB (replace battery), OVER (overload)
battery.chargeBattery charge (%)An estimate, not a precise gauge
battery.runtimeBattery runtime (seconds)Varies with load; optimistic on aged batteries
ups.loadLoad (%)Percent of rated capacity
input.voltageInput voltageUseful for spotting brownouts; not all units report it
ups.realpower / ups.realpower.nominalReal power or nominal powerOften absent; see the energy note below

Automations that earn their keep

Alert when the power goes out and comes back

alias: UPS on battery alert
triggers:
  - trigger: template
    value_template: "{{ 'OB' in states('sensor.myups_status_data') }}"
actions:
  - action: notify.mobile_app_your_phone
    data:
      title: "Power outage"
      message: >
        UPS on battery. Charge {{ states('sensor.myups_battery_charge') }}%,
        runtime about {{ (states('sensor.myups_battery_runtime') | int(0) / 60) | round(0) }} min.
mode: single

Add a second automation for the opposite edge (OB disappearing from the status) to confirm power has returned. The raw status entity name varies (it is often a "status data" sensor carrying the flags); check the device page for the exact entity ID. Older Home Assistant versions use trigger:, platform: and service: keys instead of triggers:, trigger: and action:; the visual editor writes the right form for your version.

A reusable "on battery" binary sensor

template:
  - binary_sensor:
      - name: "UPS on battery"
        device_class: problem
        state: "{{ 'OB' in states('sensor.myups_status_data') }}"

With this in place, other automations can simply check binary_sensor.ups_on_battery.

Shed non-essential load

If a smart plug on the UPS feeds something non-essential (a monitor, a lamp, a second access point), turning it off when the UPS goes on battery extends runtime for the things that matter. Wait a minute or two before shedding, so brief flickers do not cause churn.

Our view: Home Assistant should watch, NUT should act

It is tempting to build all outage logic in Home Assistant. The weak point is dependency: Home Assistant needs its own host, the network and sometimes the cloud to act, and all three are stressed during an outage. Critical shutdowns are more robust as upsmon configurations on each machine, which work even if Home Assistant has crashed. Use Home Assistant for what it is good at: notifications, history graphs, load shedding and a dashboard showing what is running on battery.

Testing without waiting for a storm

Automations that only fire during real outages tend to be broken when you finally need them. Test them deliberately, in this order:

  1. Check the raw data. Open Developer tools, States, and find the UPS status entity. Note its exact value while on mains (usually OL or OL CHRG).
  2. Dry-run the template. Paste your trigger template into the template editor and confirm it evaluates to false now.
  3. Simulate the state. In Developer tools, States, you can temporarily set the entity's state to OB. This fires state-based triggers without touching the UPS, which is ideal for checking notification text. The integration overwrites the fake value at its next poll.
  4. Do one real test. With the UPS battery charged, unplug the UPS from the wall for two or three minutes. Confirm the notification arrives on your phone over mobile data (turn off Wi-Fi), because during a real outage your home Wi-Fi may be down.
  5. Check the recovery path. Plug back in and confirm the "power restored" notification and any load you shed comes back.

A dashboard worth having

A small UPS card on your main dashboard pays for itself the first time the lights flicker. Useful elements:

  • Status in plain words (the human-readable status sensor), so anyone in the house can see "On battery" at a glance.
  • Battery charge and runtime as gauges, with runtime converted to minutes using a template sensor.
  • Load percentage history over a week. A slow upward creep tells you someone has added devices to the battery outlets, which quietly shortens runtime. Compare against the guidance in UPS load percentage.
  • Input voltage history where reported. Repeated dips line up with brownouts and explain why the UPS clicks onto battery; see UPS keeps switching to battery.

Long-term statistics on these sensors also give you a cheap, continuous record of power quality at home, which is useful evidence if you ever need to raise a supply complaint with your utility.

Things that catch people out

  • The notification path needs power. Put the modem, router, switch and Home Assistant host on battery outlets. See UPS for modem and router.
  • Runtime is in seconds. Convert before showing it to people.
  • Polling interval. The integration polls the server periodically, so very short events can be missed or show up late. The NUT server's own logs are the authoritative record.
  • Energy dashboard. UPS power readings, where available, are often estimates derived from load percentage and nominal rating. They are fine for trends, but not a substitute for a real energy meter. Do not double count a UPS power sensor with smart plugs measuring the same devices.
  • Replace battery flag. Alert on RB in the status. It is a cheap early warning that runtime has degraded; see replace battery light.

Keep port 3493 inside your network

Do not forward the NUT port from the internet. If you need remote visibility, use Home Assistant's own secure remote access, and keep NUT bound to the LAN.

For deeper NUT configuration, including the server side, see the NUT guide.

Frequently asked questions

Do I need the NUT add-on or just the integration?

You need the integration in every case, because it creates the sensors. You also need the add-on only when the UPS USB cable is plugged into the machine running Home Assistant OS, because something must run the NUT driver and server there. If a NAS or Linux server already runs NUT, the integration alone connects to it.

Why are some UPS sensors missing or unavailable?

Each UPS reports a different set of variables, and the integration only creates sensors for what the NUT server provides. Many consumer units do not report input voltage, output voltage or real power. Check what is available by running upsc on the NUT server; anything not listed there cannot appear in Home Assistant.

Can Home Assistant shut down my computers during an outage?

It can trigger actions such as SSH commands or smart plug changes, but it is a fragile place for critical shutdown logic because Home Assistant itself depends on power and the network. Let NUT's upsmon on each machine handle shutdown, and use Home Assistant for alerts and non-critical automations.

How do I get a phone alert when the power goes out?

Create an automation that triggers when the UPS status sensor changes to a value containing OB, and send a notification through the mobile app. For the alert to reach you, the router, modem and Home Assistant host must be on battery-backed outlets, and the internet connection upstream must still be working.

Can I use the APC UPS Daemon integration instead of NUT?

Yes, if your UPS is managed by apcupsd on some machine, Home Assistant's APC UPS Daemon integration connects to apcupsd's network information server, usually on port 3551. NUT is more flexible across brands and is the more common choice when several machines share a UPS.

Sources and further reading

  1. Home Assistant: Network UPS Tools (NUT) integration
  2. Home Assistant: APC UPS Daemon integration
  3. Network UPS Tools project documentation
  4. NUT developer documentation: standard variable names (ups.status flags)