irwan.io

Tutorials for noobs… from a noob.

Monitoring APC UPS with a raspberry pi and Home-Assistant

APCUPSD

After connecting the USB data cable from the data port to the rpi usb port, we can check the connection with:

If the connection is working you will see the following output:

 

Alright, let’s install APCUPSD with the following command:

After the installation you might see an attemption to communicate with the UPS:

Just exit from it by pressing CTRL-C.

Now we need to edit the apsupsd configuration. In this example i use nano, but you can use vi or winscp with notepad++, what ever suites you.

and change to the following example:

Save by writing out to the file by CTRL-O or exit with CTRL-X.

You might as well change other parameters like BATTDATE, but that’s up to you…

Next:

and edit ISCONFIGURED=no to ISCONFIGURED=yes

Save by writing out to the file by CTRL-O

Then restart the service!

I found out that it’s important to restart the service instead of starting it.

To see if it’s working, start up the APC Access application with:

You’re output may vary as each UPS has different properties but it’s very similar to this.

 

HOME-ASSISTANT

We can have these output’s defined as sensor’s in Home-Assistant and set some notifications to warn about UPS status.

Edit configuration.yaml:

Reboot Home-Assistant. After reboot, there will be entities created in the sensor domain followed by ups. Add these sensors in a group and view to visualize them in Home-Assistant as in the example.

Then reload groups in Home-Assistant.

 

NOTIFICATIONS

To get warned with notifications whether if the UPS is on batteries or on line power, setup an automation like:

Then reload your automations in Home-Assistant. Once that’s done test the notifications (and your UPS:))

Voila!

Have fun!
irwan.io

 

Next Post

Leave a Reply

© 2019 irwan.io

Theme by Anders Norén