New apcupsd Hass.io add-on

You might look into documentation for ‘apctest’, I don’t know that there is a function to command it back on again in apcupsd but if there is, it’s probably in the apctest app. In my experience, the “kill” is usually used to power off the UPS after graceful shutdown and it powers back on by itself when mains power returns.

Is there a way to adjust how rapidly this responds to events?

I tried pulling the plug on my UPS and it was nearly a full minute (about 55 seconds) before the status updated showing line voltage 0.0V and similarly long when I plugged it back in. And the status for ONLINE SLAVE/ONBATT SLAVE takes a full 90 seconds to update.

I tried to add the expected key to make it react faster but it told me its invalid.
Failed to save addon configuration, not a valid value for dictionary value @ data['options']. Got {'name': 'APC UPS', 'cable': 'smart', 'type': 'net', 'device': '192.168.1.1', 'extra': [{'key': 'ONBATTERYDELAY', 'val': 1}]}

Every other system I have that monitors the same UPS over the network with apcupsd is able to tell within ~5 seconds at the longest that it’s lost power. I don’t understand why this isn’t updating?

@mmiller7

I might look at adding multiple UPS support eventually, but I just don’t have the time to do it now.

A few things… Your config is invalid because you used 1 as the value. You need to use "1" (i.e. wrap the value in quotes.) This is because the add-on config parser doesn’t support multiple types.

This add-on just runs the apcupsd process. You’ll need to figure out if it’s apcupsd that’s slow to respond to status changes, or Home Assistant that’s slow to update from apcupsd.

I would try triggering the event, then using apcaccess (i.e. run apcaccess <your HassOS ip>) immediately after to see if apcupsd sees the new status. If it doesn’t then apcupsd probably needs additional configuration options. If apcaccess is showing the updated status, but Home Assistant isn’t, you need to investigate why it’s taking Home Assistant so long to update. (Are you running on an older Pi or is the CPU maxed out?)

Ok - it does seem to react in ~5 seconds looking at apcaccess -h <hassio_name> watching the stats, like I see with other hosts and VMs.

I’m running it on a x86-64 server (Intel® Xeon® E-2176G CPU @ 3.70GHz) with 8GB of RAM for Hassio (HassOS using the Intel-NUC image), I don’t know exactly what I’d look at. Nothing else is slow to update on my dashboard or in the developer states display.

It appears the issue is that the apcupsd home assistant component polls at most every 60 seconds.

Here’s a thread discussing it. One idea there would be to use apcupsd scripts to post to an MQTT and have HA monitor that for a quicker status update.

Oh wow, that’s quite a bummer. While some (like on-battery on-mains) could be done with the apcupsd scripts a lot of the metrics would probably require polling.

Seems like the interval should be configurable, with a beefy enough machine I don’t see why every 1s would be an issue. Since it already can import all the readings it seems silly to have to invent my own script to poll, parse, publish, then import, parse, and create sensors.

I agree. I just finished submitting a PR to add poll_interval as a configuration option. We’ll see how it goes.

1 Like

Hello,
I have latest HassOS 3.13 on fresh RPi4. I have difficulties to integrate UPS APC Back-UPS 950VA (BX950U-FR) with HA. As per basic “lsusb” I see it is visible on RPI:

# lsusb .
Bus 001 Device 001: ID 1d6b:0002
Bus 001 Device 003: ID 0451:16a8
Bus 001 Device 002: ID 2109:3431
Bus 002 Device 001: ID 1d6b:0003
Bus 001 Device 005: ID 051d:0002   <--------

however on Supervisor -> System -> Hardware tab it is not included.

Hardware 
serial:
/dev/ttyAMA0
/dev/ttyACM0
/dev/serial/by-id/usb-Texas_Instruments_TI_CC2531_USB_CDC___0X00124B0018E21116-if00
input:
disk:
/dev/mmcblk0
/dev/mmcblk0p8
/dev/mmcblk0p1
/dev/mmcblk0p5
/dev/mmcblk0p7
/dev/mmcblk0p3
/dev/mmcblk0p2
/dev/mmcblk0p6
/dev/mmcblk0p4
gpio:
gpiochip504
gpiochip0
audio:
0:
name: bcm2835_alsa - bcm2835 ALSA
type: ALSA
devices:
[object Object]
[object Object]
[object Object]

Log from Add-on:

May 21 21:22:32 a722577e-apcupsd syslog.info syslogd started: BusyBox v1.30.1
May 21 19:22:32 a722577e-apcupsd daemon.notice apcupsd[7]: apcupsd 3.14.14 (31 May 2016) unknown startup succeeded
May 21 19:22:32 a722577e-apcupsd daemon.info apcupsd[7]: NIS server startup succeeded

APCUPSD included in configuration.yaml:

# APC UPS
apcupsd:

Did anyone face any issue like this before? I turned off and unplug from AC main UPS but unfortunately issue is still present. Appreciate help, thank you.

EDIT: My Fix was to reinstall hass.os, it worked for 2nd time. Only concern is that this addon is checking APC status each 1 minute, it would be nice to have this value user configurable, lets say every 10 or 20 secs.

Can this be used with serial to USB cable?
I have old APC SU1400 but verry good battery that has serial port only.

Hey, great add on. I have it working fine with USB, however my UPS has a AP9630 network card in it. Firmware’s have all be updated and the network card even supports Modbus…

Anyway, I have installed the apcupsd_net version of this add-on to try to eliminate a USB cable going to the raspberry pi. What am I missing in the config file? I have the below config:


name: APC UPS
cable: ether
type: net
device: '192.168.10.7:apc:apc'
extra: []

I would like the add-on to communicate directly with the UPS and not require a server in-between.

Thanks for the help

Hello Koryl!

I live in Brazil and I bought a APC UPS 1500, its seems like its not compatible with your app, here is a little info that I collected:

APC USB SERIAL CONVERTER (Windows USB Name)

hassio name:
/serial/by-id/usb-APC_BY-SCHNEIDER_ELECTRIC_APC_USB_SERIAL_CONVERTER.-if00

Logs:
Sep 12 21:19:22 a722577e-apcupsd syslog.info syslogd started: BusyBox v1.30.1
Sep 13 00:19:22 a722577e-apcupsd daemon.notice apcupsd[6]: apcupsd 3.14.14 (31 May 2016) unknown startup succeeded
Sep 13 00:19:32 a722577e-apcupsd daemon.info apcupsd[6]: NIS server startup succeeded

Response on sensor:

I get “UPS Status COMMLOST” on both windows and hassio using your app.

Thanks in Advance,

-Tony

Hi all, I’m using the APC UPS Daemon add-on with success, but I do not understand why I’m unable to run sudo apcaccess command from the ssh terminal:

image

For sure I’m missing something… any ideas?

Hello, everyone. Due to a lack of time I’ve decided to archive this add-on. I suggest migrating to the NUT add-on which is well-supported and better integrated into Home Assistant. You can read more in the README.

Thank you to everyone who has helped me support this add-on over the past few years.

1 Like

Hi Kory,
NUT does not provide so many information, and for some reason, it is inaccurate for me.
Is there anyway to download your custom apcupsd, even you archived ?
PS: I had it before, and worked very fine. I changed my environment, and unfortunately did not saved.
thanks in advance,

You could try this add-on:

well, thank you dave. i have nut for my other apc, which is brazilian standard. But NUT does not work so well. apcupsd has many more information and it is more precise.
that is why I asked.

Ah ok, sorry, I mis-read your post.

1 Like

Tony, you must use NUT. NUT has driver for microsol UPS type, which is the brazilizan model

The repository is still available here, I’m just not updating it. I was able to follow my old instructions and install the network version of the add-on. I didn’t try the USB version since NUT is managing the USB for me.

I’d say just give it a try.

1 Like

Thank you Kory. I finally was able to install it.
Unfortunately, my home assistant can’t reach the USB, I am getting COMMLOST

Well, I rolled back to NUT.

Best Regards,