Closed madbrain76 closed 11 months ago
Please post the logs and config, it looks like you have an issue with the integration rather than the addon.
Privet, you're probably using a default config with "port=auto" NUT must be able to differentiate the units, for example using a serial number. As per https://networkupstools.org/docs/man/usbhid-ups.html: Just add a config "serial = xxxx" for each units.
That means: config:
and it's really an addon (config) issue ;)
Arnaud, Paul, Re: the add-on config, I left everything as default except for the username and password. So yes, I do have port=auto as that's part of the defaults.
In the device section, I have this :
- name: myups
driver: usbhid-ups
port: auto
config: []
Arnaud, I ran lsusb and it shows the following :
Looks like both are on bus 2, but one is device 6 and the other device 4 . I'm not sure how to determine the serial number. I'm running HAOS so I don't know how to specify the -DD argument to the driver.
I tried the following config :
- name: myups1
driver: usbhid-ups
port: auto
config:
- vendorid=051d
- productid=0002
- bus=2
- device=4
- name: myups2
driver: usbhid-ups
port: auto
config:
- vendorid=051d
- productid=0002
- bus=2
- device=6
And got the following error :
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
libusb1: Could not open any HID devices: insufficient permissions on everything
No matching HID UPS found
Driver failed to start (exit status=1)
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
libusb1: Could not open any HID devices: insufficient permissions on everything
No matching HID UPS found
Network UPS Tools - UPS driver controller 2.8.0
Driver failed to start (exit status=1)
Please set the following option https://github.com/hassio-addons/addon-nut/blob/main/nut/DOCS.md#option-list_usb_devices
Then post the full addon startup log. Running lsusb from a different container may not get the information you need.
@sinclairpaul , How do I set it ?
I tried the following
- name: myups1
driver: usbhid-ups
port: auto
config:
- list_usb_devices=true
But it failed:
Fatal error: 'list_usb_devices' is not a valid variable name for this driver.
It is an option at the same level as devices/users/shutdown_host
Thank you. I found it in the GUI for HAOS. I was trying to set it in the YAML. Here is the output :
[11:39:17] INFO: Connected USB devices:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 006: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 005: ID 1a86:55d4 QinHeng Electronics 800 Z-Wave Stick
Bus 002 Device 004: ID 051d:0002 American Power Conversion Uninterruptible Power Supply
Bus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB Hub
Bus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual Mouse
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
So does bus="002", device="006" not work?, it will be challenging in the container to find the serial number.
Yes, I tried those two with two leading zeroes - it didn't work. I can disconnect one or both UPSes from the HAOS VM and onto the Windows host, if that helps.
@sinclairpaul , is there any way to resolve the following error:
libusb1: Could not open any HID devices: insufficient permissions on everything
It seems to happen anytime I try to specify vendorid, productid, bus, device ... Not sure if using serial would fare any better given this.
It may show the serial, I wouldn't know. I believe the error is thrown when it can't locate the device correctly.
But in all honesty if you have a VM, why are you running the NUT addon (which is a container). In my opinion you would be much better of managing the UPS devices at the host OS, as you will have visibility into the Shutdown process. I should also add that the Integration for HA itself is in no way related to the addon, NUT can be run anywhere.
Great question. The two UPSes support a number of devices, some less critical than others, many on smartplugs. In case of power outage, an HA automation routine can decide to shutdown the non-critical devices on the UPS, and restore them when the power is back. As far as the VM (HAOS) triggering a shutdown of the host, I don't think that would be easily done, unfortunately, maybe through some networking between the VM and host, but hard to coordinate any case. This isn't something I have given much thought about.
hey guys, looking at the last comments, I just realized that you're running in VM mode :D So, check the config on vmware side, there may be missing privileges for your VM to get exclusive access to your devices. That should fix your libusb1 privileges issue. Ref: https://docs.vmware.com/en/VMware-Workstation-Player-for-Windows/17.0/com.vmware.player.win.using.doc/GUID-E003456F-EB94-4B53-9082-293D9617CB5A.html
Then a few comments:
@aquette Thanks for your help. Thanks, I have read that VMWare doc already. I have my Z-Wave USB stick working in the VM, as well as one of the two UPSes. lsusb is reporting all 3 devices are present. So, I'm confident I have the right VMWare configuration.
Re: stickers, are you referring to the "QC passed" stickers that originally were taped on the UPS by APC ? Those might have had the serial number indeed. But they were long ago removed and throw away. I don't see any other sticker on the BX1500M.
I do have another Linux system to test with, running Ubuntu 22.04. How would I get the driver to report the serial number on that machine ?
Also, shouldn't it be possible to get the serial number for the one UPS I have under HAOS? Maybe I can get both by connecting one UPS at a time to the VM.
I found the serial numbers on the sticker at the bottom of each UPS. With serial=xxxx , the driver works with both UPSes, and so does the integration. The integration reports "Description unavaialble" for each one. I tried to use alias= in the add-on to give them a description, but did not succeed.
Glad you have the addon working, I don't believe "alias" is a valid option for the driver as per the NUT docs.
Issues with the Integration will need to be logged against the Home Assistant repo, as we can't help you with that here.
Can this then be closed out.
Yes.
thanks for the confirmation on using serial config, glad to see your issue is fixed. I'll check for the description unavailable (you may log an additional issue so that I don't forget ;)) Note that I'm unsure on which NUT data this description maps to. @sinclairpaul any hint welcome. I'd also be interested in discussing with you on discord @sinclairpaul :)
Now that I've a week of HA use, I'm starting to have visibility and ideas on how to improve this NUT addon. Look forward for news soon :)
Problem/Motivation
I have two identical APC BX1500M connected via USB. Only one is seen by the NUT add-on & integration.
Expected behavior
Both UPSes should show up.
Actual behavior
Only one UPS shows up.
Steps to reproduce