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.
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; https://linux.die.net/man/5/apcupsd.conf
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;
I received this error
Error contacting apcupsd @ 127.0.0.1:3551: Connection refused
Maybe I didn’t wait long enough? Anyways, I restarted the service;
sudo /etc/init.d/apcupsd restart
And tried again;
Now shows status of UPS!
I added this to the configuration.yaml;
apcupsd: host: 127.0.0.1 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 resources: - bcharge - loadpct - status - timeleft - model
Restart the Rpi;
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!