How to connect your APC UPS to Rpi and Home Assistant using apcupsd!

It Works with:
colindunn/hassio-addons

Has anyone tried this with an older APC UPS using serial RS232 to USB? Thanks!

1 Like

I’ve got mine working with a serial RJ-45 to USB. My Pi immediately recognized it and haven’t had any issues with it. I have several sensors showing me different parameters in my HA

Hi! Could you say, what should be done after installing that add on? I did not buy UPS yet, looking for right choice. How should I connect it to Pi?
All I need from UPS - couple days of working Pi and the most important - I need to know that

Hi! Witch UPS did you use?

The one I have hooked up to my pi is an APC XS 1500

Hey there! I tried this on hassio and got this:

Network UPS Tools - UPS driver controller 3.7.0-4224-g76513cf7a8
Network UPS Tools - Generic HID driver 0.41 (3.7.0-4224-g76513cf7a8)
USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)

I just downloaded addon and put this in config file:

  - platform: nut
    username: nut
    password: nut
    resources:
      - ups.load
      - ups.status

My ups is connected via ethernet cable (rj 45) and ethernet adapter to usb port.

Should I change anything in configurations?
Any advices?

Tried another cable, wrote username and password and after few tries it started working. Today I changed wifi settings (reboot and new usb stick) and UPS felt out again. I tried to reload everything a lot of times, tried different cable and still

Network UPS Tools - UPS driver controller 3.8.0-3727-geade014bef
Network UPS Tools - Generic HID driver 0.41 (3.8.0-3727-geade014bef)
No matching HID UPS found
USB communication driver 0.33
Driver failed to start (exit status=1)

Does this mean, that there is no connection to UPS? Can it be healed in some way?
Still on hassio with colindunn/hassio-addons

I tried this, it locked up my HA during boot. something didnt line up right so I wiped it and tried again, and then tried again with a clean install and nothing else… same thing.

Something with how the docker containers are addressed after a reboot do not like HA v87.1. I do not recommend trying this unless you have a solid backup to restore from.

For anyone stumbling upon this thread. Below is an install script for Ubuntu 18.04. Each time I’ve configured this on a system I wasted time getting it to work because the DEVICE line needed the value “ttyS0” removed. I kept getting “COMMLOST” for the status. Instead of just keeping notes this time around I wrote a script for install since I I’m sure I’ll rebuild again at some point. Hopefully this is useful to others.

I’m using a newer APC 1500 via USB.
###SCRIPT START###

!#/bin/bash

#install apc ups utility
sudo apt install -y apcupsd

#backup default files
sudo cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.bak
sudo cp /etc/default/apcupsd /etc/default/apcupsd.bak

#replace necessary lines
sudo sed -i s/‘DEVICE /dev/ttyS0’/DEVICE/g /etc/apcupsd/apcupsd.conf
sudo sed -i s/ISCONFIGURED=no/ISCONFIGURED=yes/g /etc/default/apcupsd

#restart apcupsd services
sudo /etc/init.d/apcupsd restart

#show ups status output
sleep 5
sudo apcaccess

exit 0

######SCRIPT END####

#in configuration.yaml:
apcupsd:

#in Sensor.yaml or under sensor in configuration.yaml

  • platform: apcupsd
    resources:
    • bcharge
    • linev
    • status
    • loadpct
    • timeleft
1 Like

Is there a way to do this with HA that doesn’t include using cables? I have multiple rack mount UPS and they all have web cards in them so are fully accessible over my network. I know with another not to be named automation platform I was able to monitor UPS status.

Thanks.

JR

You read the docs? Just specify the host. Literally the first config variable for apcupsd…

I’ve setup my CP1500PFCLCD also. I’m getting 120% for battery charge though. Are you seeing similar?

I’m getting 100%, what’s your config look like? Also, you’re looking at sensor.ups_battery right?

USB between NUC (Ubuntu 18.04) and UPS. Using BCHARGE variable to get sensor.ups_battery for display in entities card on HA 101.3. Here’s the sensor config:

- platform: apcupsd
  resources:
    - bcharge
    - loadpct
    - status
    - timeleft
    - mintimel
    - model
    - outputv

All other variable values accurately reflect the UPS display.

Odd, doing the same thing but I’m getting 100%. EDIT: My hardware is a RS 1500MS.

Probably an oddity of CyberPower UPS.

I have the same UPS. I’ve been using a nut server addon and the nut component.

Other than the battery charge issue, is this working well with HA?

Yes. No errors so far. It’s likely CyberPower batteries have a higher AH rating making them superior to APC batteries. :grin:

Thank you very much for sharing the detailed instructions. Worked flawlessly first time!