New apcupsd Hass.io add-on

@Aussybob Thanks, but send your money to the Home Assistant guys. They’re the ones that put in all the work.

@korylprince Firstly let me thank you for your work on developing this add-on, I find it very useful! Really thanks.
Would you please help me in troubleshooting this issue I have on this my configuration?

Had many issue at the beginning in starting up. I did a lot of try and it is now running, but there is no connection from apcupsd to USB port, with error similar to this one copied from the thread (don’t have a trace right now of mine):
18-01-23 03:35:31 ERROR (SyncWorker_18) [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”)

I discovered I have no /dev/usb devices files at all in my container, but I got:

admin@NAS:/dev/bus/usb/001$ ls -la
total 0
drwxr-xr-x 2 root root 120 Aug 30 16:20 .
drwxr-xr-x 4 root root 100 Aug 27 19:34 …
crw------- 1 root root 189, 5 Sep 4 19:53 006
and the same from:

bash-5.0# lsusb
Bus 001 Device 006: ID 051d:0002

How do I and where I do the modification to let the add-on to install and run correctly with this configuration?
I see there is a config.json in the addons/a722577e/git/apcupsd folder with this entry:

"devices": ["/dev/usb/:/dev/usb/:rwm"]

I tried modifying it with my path but I get a lot of:
Sep 4 01:01:59 a722577e-apcupsd daemon.warn apcupsd[7]: Communications with UPS lost.

HASSIO is talking to the add-on in fact I see the sensors in HA but most of them are in unknown states

Could it be a problem with passing-through the USB port to HASSIO, has anyone had experience with this configuration and could help?

Thanks for your help!

There is a known issue with USB devices being populated from Synology onto hassio. But if you get something it is populated but timeouts due to something else.

Let me know if you find anything that makes it more reliable and I’ll add it to the Synology thread.

@gerosaf The issue is definitely related to the Synology not putting the /dev/usb/* stuff in place (or at least the docker daemon isn’t able to see it.)

As I have no experience with Synology and no way to test it, there’s not much help I can provide.

Thanks @fredrike and @korylprince for you prompt answers

I’ll send you a pm tomorrow morning (CEST) with some suggestions on how to fix it. (we need to copy some udev rules from the hassio-container to the Synology)

big problem here on a Cyberpower PR1500ELCD.
is there someone who can help?

Thanks @fredrike, I’ll wait for your PM.
Are you talking about the fix_usb_device () function?

I’m sorry for the late reply.

Yes I’m thinking that perhaps can the lines 8-9 help.

Thanks @fredrike, I did a try, but nothing change from my site. Still no way to see in /dev or /dev/usb my UPS connected via USB. Don’t understand how Synology manage such a device, putting it in /dev/bus/usb/001. I cannot see any udev.rule to manage it, so I can’t try to do any modification.
Do you have another clue?
And, thanks a lot for your HASSIO on Synology. It works GREAT!

Running plain hassio on a NUC. Sounds like same problem, can’t find device. Can I help with any information from here?

19-10-08 23:22:30 ERROR (SyncWorker_6) [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”)

Hi there,

i have an even more complicated setup: Proxmox running a Debian virtual machine on which I installed Hass.io.
Great flexibility but difficult access to external interfaces: can someone point me to some hints how to integrate apcupsd add-on into my system?

Hello,
I’m using the NET version of your addon and have it connected and pulled the ups_status sensor. It currently reads ‘ONLIVE SLAVE’. Unfortunately, when I attempt to initiative a power loss event, the sensor changes state not quite immediately, can I tweak the polling interval? I believe it’s POLLTIME, right, which can be changed via the “extra” parameter?

"extra": [
     {"key": "POLLTIME", "val": 30}
  ]

seems to be giving me an error:

not a valid value for dictionary value @ data['options']. Got {'name': 'APC UPS', 'cable': 'ether', 'type': 'net', 'device': '192.168.x.xxx:3551', 'extra': [{'key': 'POLLTIME', 'val': 30}]}

but

"extra": [
     {"key": "POLLTIME", "val": "30"}
  ]

works…

Also, the time seems to be off in the container. Aside from that thanks for your work.

Hi,

Thanks for this addon!

I think i might need some help configuring this addon to shutdown my esxi host. Yes, i have hassio running virtual on a bare metal esxi host among with some other small vm’s. The APC ups is connected to the host through USB. This addon is working fine and is seeing my UPS.
If im not mistaken i should be able to shutdown/ reboot my esxi host instead of the “hassio host”???

What do i need to do?

Hello. I run hassio on a VM Wsre inside windows server. I have powershute business with my UPS connected with usb. I’ve installed the addon on HA but it keeps saying connection lost… I’m using pcnet type… anyone can help with config of this setup?
I use powershute in host since I want to shutdown other PCs that are on the same UPS via network.
Thanks!

@Dansker You’re getting that message because the hassio supervisor is not detecting an APC UPS USB device. If you are sure the device is plugged in and is supported by apcupsd, you need to make sure you have udev rules set up to create the devices in /dev/usb/.

@mspinolo See above. Ultimately you’ve got to pass the USB devices into the VM running the hassio, and use udev rules there to create the devices in /dev/usb/.

@joelones You’re getting that error because you’re trying to use 30 as an integer. You need to quote it so it’s a string like {"key": "POLLTIME", "val": "30"}

@kurniawan77 Check out this part of the manual for such situations.

@zejulio Have you checked out this part of the manual?

Yes i did…

The Addon also does not start. It worked fine for months but I had to clean and install HA again and now I get the same error “error gathering device information while adding custom device “/dev/usb/”: no such file or directory”. I really do not know what to do… what do you mean by " make sure you have udev rules set up to create the devices in /dev/usb/ ."?
Thank you

@zejulio I’ve never attempted such a setup before, so I’m not sure I can help much. The first thing I would suggest is docker exec'ing into the add-on container and verify you can ping the host IP from within the container. If you can’t then you need to solve that network issue before anything else. If you can ping the host, then that would signal a configuration issue either on the powerchute side or the apcupsd side. I would try installing apcupsd directly on the host and see if you can get it to talk to powerchute there.

@fernmac The add-on won’t start because those devices aren’t in /dev/usb which is required to get the add-on to start. This issue is very hard for me to troubleshoot because so many people use different setups.

Ultimately, the /dev/usb/hiddevN have to be accessible to the docker “host”. By docker host, I mean the OS that is actually running docker that runs the hassio supervisor container. This could be on bare metal (raspberry pi, NUC, etc) or in a VM. The add-on is started expecting those /dev devices to be there; if they aren’t the add-on fails to start.

To start, if you’ve got the docker host running in any sort of VM, you’ve got to pass the USB device into the VM by configuring the hypervisor (i.e. HyperV, VMWare, VirtualBox, libvirt, etc) to do that.

Once the device can be seen by the docker host, udev is the daemon used to detect (among other things) USB devices and create special device files for them in /dev. It uses rule files to do this. If you use the official HassOS (or whatever we’re calling it these days) images, these rules should be automatically set up for you. If not, then you’ll need to set those up yourself.

It may be as simple as copying these rules into /etc/udev/rules.d/, but you’ll have to test that yourself. When adding rules, you’ll need to make sure udev reapplies them (or you could just reboot.)

That’s about as exhaustive an explanation as I can offer at this time. There’s lots of information you can find on writing udev rules online.

Wow! Thanks for the explanation, unfortunately for me, I am way over my head here. I will try some further research. Thanks again.