New apcupsd Hass.io add-on

Total newbee … where o I place this script in Hass.io setup ?

Hi Haddood,

It is an automation, so it goes in your automation.yaml. You will have to setup a notify service first.

Hi, I’m getting this error under
https://192.168.88.252:8123/hassio/system

18-05-06 03:57:26 INFO (SyncWorker_13) [hassio.docker.interface] Clean korylprince/hassio-apcupsd-armhf docker application
18-05-06 03:58:00 ERROR (SyncWorker_13) [hassio.docker] Can’t start addon_a722577e_apcupsd: 404 Client Error: Not Found (“linux runtime spec devices: error gathering device information while adding custom device “/dev/usb/hiddev0”: lstat /dev/usb/hiddev0: no such file or directory”

Config: (I tried the default configuration too: Same error)

{
“name”: “APC-SMARTUPS-RC3000”,
“cable”: “ether”,
“type”: “pcnet”,
“device”: “192.168.88.250:apc:password”,
“extra”:
}

configuration.yaml

apcupsd:
host: a722577e-apcupsd

I’m using a raspberry Pi 3 w/ Hassio 0.68.1

I was using before Hasbian with apcupsd and it worked fantastic but my sd card got corrupted twice so that’s why I’m trying hassio now.

Cheers.

1 Like

Hello, all. I’m sorry I’ve not been around lately. The following is currently not supported with this addon:

  • Network UPSes (See this issue for why)
    • When I get a chance, I’ll release a second add-on that doesn’t require a USB device attached
  • Multiple UPSes
    • This will require quite a bit of changes to the startup script to support. This is tracked here

I will post here once I’m able to solve these issues.

2 Likes

Thank you so much for the add-on @korylprince was very useful, I appreciate your work

I had issues starting mine as i already had a APCUPSD server running on the same machine, so it could not start because port was in use (error message: 3551: bind: address already in use).

Only found by using Docker Portainer to manually start as the hassio interface does not give error messages!

I have posted about this and riased a issue on github: Hass.io provides no error messages shown when starting add-ons

However, I still cannot start, as I have no USB on my system :frowning:
Issue riased: Need ethernet version: Cannot start on hassio running on Docker on a virtualized Ubuntu Server. (No "/dev/usb/") ¡ Issue #7 ¡ korylprince/hassio-apcupsd ¡ GitHub

My config:

{
  "name": "APC UPS",
  "cable": "ether",
  "type": "snmp",
  "device": "192.168.1.60:161:APC:private",
  "extra": []
}

Error message before removing other server:
18-09-09 19:21:11 ERROR (SyncWorker_3) [hassio.docker] Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("driver failed programming external connectivity on endpoint addon_a722577e_apcupsd (77b4e8f39e7d0e20f99dc3f9e8b611fc5c13e354d74d94e445ea15d9fb120e03): Error starting userland proxy: listen tcp 0.0.0.0:3551: bind: address already in use")

Error message after removing other server:
18-09-09 19:27:55 ERROR (SyncWorker_0) [hassio.docker] Can't start addon_a722577e_apcupsd: 500 Server Error: Internal Server Error ("linux runtime spec devices: error gathering device information while adding custom device "/dev/usb/": no such file or directory")

Any update on a network only build?
That would be fantastic :grinning:

Any chance you could consider looking at this?

Hello all. I’m sorry for the lack of activity here. Life has been pretty busy.

I’ve released version 1.6 which is really just version updates, but with it I also released a second version of the add-on for use with network UPSs. Just refresh the repository in your Hass.io dashboard and you should see the second add-on show up.

If you have issues with it, please create an issue on Github.

I’ve made the decision not to try and make multiple UPSs work in the add-on. You can technically use two (one USB and one network) if you run both add-ons (make sure to use different ports.)

Beyond that, I just don’t have the time to devote to making that work. I’ll happily accept a PR if someone wants to work on that feature :slight_smile:

Hello and congrats on a great job!
I have just adquired an APC UPS, installed your add-on and everything seems to work perfect, thank you.
Where can I find the logic under the provided scripts for commfailure, offbattery, changeme, commok and onbattery. I assume everything is working fine as I can see the sensors and no error found in the logs, but realy don’t know what to expect on those events.
Sorry if the question is very basic, I’m quite newby.

Those scripts come straight from the apcupsd source. They are included in the alpine package which is installed in my add-on.

Thank you very much for your quick answer, I will take a clorser look at the information and try to undestand how it works. Just one quick question to try get a better undestanding, does the add-on shutdown hassio or the host (rpi in my case) when any of the predeffined conditions are met? Which one?
Thanks again for the great add-on and your help!

You’ll want to read the README here and here.

Worked perfectly. Thanks!

Hello,
I have a problem with the deamon.
The shutdown of the machine is initiated five minutes aprox after I cut the power of the inverter.
But the inverter is new, battery is new, the load is very low (16 W on a 900 WUPS)
I don’t know what is the cause of the initiated shutdown?
I don’t overrided default apcupsd parameter.
When the machine is down the inverter provide output power.
I run apcaccess as you explain and all values are normal.
The autonomy is 340 min when the server shutdown…

Many thanks for your help and best regards

@vormsty,

I’m assuming you’re Vorms on Github. If so, please make sure you fix that issue first to see if it fixes your issue.

If you still have an issue after fixing that (and you are actually running this add-on on Hass.io), please cut the power, wait a couple of minutes, then copy the add-on logs so I can see what’s going on. Also please show the full add-on configuration.

hello,
Yes, i am the same person on github, sorry to spam you.
Yes, I run Hass.io
Yes the inverter is new.
I miss understanted how to configur the apcupsd deamon on hass.io.
So, in the configuration.yaml I have nothing but the declaration of the service (apcupsd:) and the sensors.
I can also display the remaining time and all value on the display, and the binary sensor.
I installad power chute on my windows pc with the same load, and after 10 minutes nothing special.
So, no shutdown is initiated.
I reconnect the usb cable to the linux machine and cut the power again, and after 5 minutes, the machine initiate the shutdown procedure.
Here is the result of the access command, connecting with ssh as you explain in this web page:

APC : 001,037,0964
DATE : 2019-08-23 23:17:35 -0400
HOSTNAME : a722577e-apcupsd.local.hass.io
VERSION : 3.14.14 (31 May 2016) unknown
UPSNAME : APC UPS
CABLE : USB Cable
DRIVER : USB UPS Driver
UPSMODE : Stand Alone
STARTTIME: 2019-08-20 20:30:18 -0400
MODEL : Back-UPS NS 1500M2
STATUS : ONLINE
LINEV : 123.0 Volts
LOADPCT : 1.0 Percent
BCHARGE : 99.0 Percent
TIMELEFT : 179.1 Minutes
MBATTCHG : 5 Percent
MINTIMEL : 3 Minutes
MAXTIME : 0 Seconds
SENSE : Medium
LOTRANS : 88.0 Volts
HITRANS : 139.0 Volts
ALARMDEL : 30 Seconds
BATTV : 27.3 Volts
LASTXFER : Unacceptable line voltage changes
NUMXFERS : 4
XONBATT : 2019-08-23 23:05:56 -0400
TONBATT : 0 Seconds
CUMONBATT: 1632 Seconds
XOFFBATT : 2019-08-23 23:14:18 -0400
SELFTEST : NO
STATFLAG : 0x05000008
SERIALNO : 3B1914X25000
BATTDATE : 2019-04-04
NOMINV : 120 Volts
NOMBATTV : 24.0 Volts
NOMPOWER : 900 Watts
FIRMWARE : 957.e3 .D USB FW:e3
END APC : 2019-08-23 23:17:36 -0400
bash-5.0#

Blockquote

Here is the log of the deamon on the hass.io add on page:

Aug 20 20:30:18 a722577e-apcupsd syslog.info syslogd started: BusyBox v1.30.1
Aug 21 00:30:18 a722577e-apcupsd daemon.notice apcupsd[6]: apcupsd 3.14.14 (31 May 2016) unknown startup succeeded
Aug 21 00:30:18 a722577e-apcupsd daemon.info apcupsd[6]: NIS server startup succeeded
Aug 21 00:43:02 a722577e-apcupsd daemon.crit apcupsd[6]: Power failure.
Aug 21 00:43:08 a722577e-apcupsd daemon.crit apcupsd[6]: Running on UPS batteries.
send-mail: account default not found: no configuration file available
Aug 21 00:46:46 a722577e-apcupsd daemon.crit apcupsd[6]: Mains returned. No longer on UPS batteries.
Aug 21 00:46:46 a722577e-apcupsd daemon.alert apcupsd[6]: Power is back. UPS running on mains.
send-mail: account default not found: no configuration file available
Aug 21 00:53:44 a722577e-apcupsd daemon.crit apcupsd[6]: Power failure.
Aug 21 00:53:50 a722577e-apcupsd daemon.crit apcupsd[6]: Running on UPS batteries.
send-mail: account default not found: no configuration file available
Aug 21 01:08:44 a722577e-apcupsd daemon.crit apcupsd[6]: Mains returned. No longer on UPS batteries.
Aug 21 01:08:44 a722577e-apcupsd daemon.alert apcupsd[6]: Power is back. UPS running on mains.
send-mail: account default not found: no configuration file available
Aug 24 02:32:03 a722577e-apcupsd daemon.warn apcupsd[6]: Communications with UPS lost.
send-mail: account default not found: no configuration file available
Aug 24 02:49:01 a722577e-apcupsd daemon.warn apcupsd[6]: Communications with UPS restored.
Aug 24 02:49:02 a722577e-apcupsd daemon.crit apcupsd[6]: Power failure.
send-mail: account default not found: no configuration file available
Aug 24 02:49:07 a722577e-apcupsd daemon.crit apcupsd[6]: Running on UPS batteries.
Aug 24 02:49:07 a722577e-apcupsd daemon.crit apcupsd[6]: Mains returned. No longer on UPS batteries.
Aug 24 02:49:07 a722577e-apcupsd daemon.alert apcupsd[6]: Power is back. UPS running on mains.
send-mail: account default not found: no configuration file available
send-mail: account default not found: no configuration file available
Aug 24 03:05:57 a722577e-apcupsd daemon.crit apcupsd[6]: Power failure.
Aug 24 03:06:02 a722577e-apcupsd daemon.crit apcupsd[6]: Running on UPS batteries.
send-mail: account default not found: no configuration file available
Aug 24 03:14:18 a722577e-apcupsd daemon.crit apcupsd[6]: Mains returned. No longer on UPS batteries.
Aug 24 03:14:18 a722577e-apcupsd daemon.alert apcupsd[6]: Power is back. UPS running on mains.
send-mail: account default not found: no configuration file available

Blockquote

So in resume, in the hass.io apcupsd, the machine is executing the shutdown after 5 minute of power line down.
So, i would like to know the reason wich the shutdown is initiated.

Best regards and thank you very much for helping me !

To get the add-on configuration, you need to go to the add-on page.

For me, it’s something like http://hassio:8123/hassio/addon/a722577e_apcupsd

You need to replace the http://hassio:8123 part with whatever you normally use to connect to home assistant. On that page, scroll down to the “Config” section. That’s where you set the add-on configuration.

Assuming that doesn’t have any weird options in it, it sounds like your UPS may be sending bad data randomly. This (very old) post shows some issues like that. If your configuration is correct, you may need to turn to the apcupsd mailing lists so they can help you diagnose and fix what’s going on.

If you just want to prevent the shutdown completely by this add-on, read the README.

Hello,
Yes, i undestand the config is on the addon page and not in the configuartion.yaml page.
I just have the default config.
I already write to the apcupsd mailing list and my request is pending…
It seems with the powerchute windows software, the beahviour is correct.
Why it sound like the ups send bad data ?
I didn’t see the shtudown reason in any log.
Is that possible to have more detailled log ? changing the log level ?
Is that possible to have the log of the data from and to the ups ?

Many thanks for your help and best regards
Thierry

All of those questions are for the apcupsd developers. I don’t develop apcupsd, I just created the add-on using it.

Your best bet is to use a dedicated linux machine (not this add-on) to debug the issue.