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

I searched and didn’t find anything like this here. Since I was figuring it out I thought I’d post this for anyone else wanting to do this.

I plan to use this to send pushbullet alerts if my system goes on battery, meaning the power has gone offline. All my networking gear is on this UPS so I’m hoping the message will make it out before everything goes offline. :slight_smile:

I have an old APC Back-UPS XL 1000. It has a 10-pin RJ50 connector on the back. Perhaps you have the cable that came with yours, I lost mine so had to order one from Ebay, about $8 shipped.

Plug it in to the UPS and Rpi usb port.

from command line install apcupsd;
sudo apt-get -y install apcupsd

Once installed run this command to verify the device is visible;

here’s a sample of the output. This tells me it sees the UPS, so that’s good.
Bus 001 Device 006: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

Backup and edit configuration file;
sudo cp /etc/apcupsd/apcupsd.conf /etc/apcupsd/apcupsd.conf.bak
sudo nano /etc/apcupsd/apcupsd.conf

Modify the following values for your environment and save. Here’s what worked for me.
More info here;

UPSNAME backups1000

Copy and modify another config file;
sudo cp /etc/default/apcupsd /etc/default/apcupsd.bak
sudo nano /etc/default/apcupsd

Modify the following values and save;

Start the service;
sudo service apcupsd start

Verify it’s working;
sudo apcaccess

I received this error
Error contacting apcupsd @ Connection refused

Maybe I didn’t wait long enough? Anyways, I restarted the service;
sudo /etc/init.d/apcupsd restart

And tried again;
sudo apcaccess

Now shows status of UPS!

I added this to the configuration.yaml;

  port: 3551

I’m also splitting out my sensor files in the sensors folder, so added this to configuration.yaml;

sensor: !include_dir_list sensors

And this to my sensors/apcupsd.yaml

platform: apcupsd
  - bcharge
  - loadpct
  - status
  - timeleft
  - model

Restart the Rpi;
sudo reboot

The UPS items show up in Home Assistant now!

I added them to a Utilities page in my groups.yaml. Looking good!

When you query the UPS you’ll get a list of objects you can use in your config file. I only wanted a few items so I listed mine above. Yours may be different depending on the model of your UPS.

I found more good info here;

Forgive me if this is posted somewhere else. I searched all over and couldn’t find anything here, so I hope this helps you out!


This is awesome news for APC owners! (I might have to dig out one of my old ones and plug it into the Pi now!)

I’d like to move this into Share Your Projects, which highlights inventive solutions and applications that users have done. Would that be ok with you?

Certainly. Thanks for the feedback.

This also works for some CyberPower UPS units. I set up acpupsd the same way with my CyberPower 1500PFCLCD

Works great! Implemented it on my system last night. Thank you!

1 Like

This works awesome! Just set it up with a brand new APC600VA I picked up a couple days ago. What did you set up as your trigger for the notification for when your system goes on battery? Did you have Home Assistant fire off the notification if the battery load exceeded a certain percentage?

Honestly I forgot to automate this. I was going to program when “status” change from “online” to anything else trigger a pushbullet notification. Thanks for the reminder.

ok, got it working and tested this morning using pushbullet notification. Here’s some code for you.

# UPS Automation
- id: UPS_01
  alias: 'Notify when UPS goes on battery'
    - platform: state
      entity_id: sensor.ups_status
      from: 'ONLINE'
      to: 'ONBATT'
    - service: notify.notify
        title: "Alert from HomeAssistant"
        message: "Home UPS on battery"

Thank you! I am close to purchasing a Tripp Lite UPS. Has anyone tried this with that brand? Thanks!

I currently have a APC UPS ES700 on my Mac and its setup to use the UPS settings in OSX. Can I somehow install apcusbd on my Mac and allow HASS to query it?

Sorry but I don’t know. You should try it out though and see if it works!

Thanks for posting this howto.

I’m looking for an APC UPS at the moment, and this is perfect info.

1 Like

I’ve got this working, but it seems like the update rate is very slow. Most of the sensor readings in home assistant say they were last updated hours ago. And each variable has a different update time for some reason.

Working perfectly on APC Smart-UPS 1500 RM. Thank You!

1 Like

I’m new here :grinning:
One UPS added without issue, working great. And thanks akajester for notification code.

My issue is adding second UPS!
How to add second UPS?

My config:

apcupsd 2:
- platform: apcupsd
    name: "UPS1"
      - hostname
      - bcharge
      - loadpct
      - status
      - timeleft
      - model
      - linev
      - battv
      - itemp

I tried like this:

  - platform: apcupsd
    name: "UPS2"

New entity appeared but with data from first UPS.

Please help!

1 Like

Awesome job! Going to build this weekend.

Any idea how to gracefully shutdown the Pi when the batt reaches low batt status??

Any workaround for HassIO? Since It doesn´t support apt get…

I installed the following HassIO Addon by Colin Dunn which worked perfectly.

I finally get to work with:

The problem is, I use hassOS and there is no apt-get. How can I use the USB port on rpi to see APC’s status? (on another Linux machine it is OK)