Monitoring an APC UPS with node-red and MQTT

Introduction

APC sell a decent range of USB connected Uninterruptable Power Supplies (UPS) such as the CS500 and BE700G. These are supported by the linux utility apcupsd for control and monitoring.

This post explains how to monitor these UPS devices using Node-Red to obtain and publish data using MQTT. It assumes you already have a working Node-Red install.

Installing APCUPSD

Install apcupsd for monitoring USB connected UPS:

apt-get install apcupsd

Edit /etc/default/apcupsd:

ISCONFIGURED=yes

Edit /etc/apcupsd/apcupsd.conf:

UPSCABLE usb
UPSTYPE usb
DEVICE
STATTIME 0

Node-Red Flow

Node-Red Flow for extracting data from apcaccess and publishing to MQTT

This flow runs the command line utility apcaccess every 10 seconds. It then parses the output into a number of MQTT messages and publishes them to the configured MQTT server on the topic specified in the “Parse apcaccess data” function.

Copy and paste the following into node-red and configure an mqtt broker and topic: