NUT Tools only 1 USB UPS at a time works - [SOLVED]

Hi all, got a strange NUT tools problem I don’t see covered by previous posts, YT videes, help needed and appreciated.

I have 2 x APC Smart 1000 UPS connected to USB on Dell Optiplex running latest HA OS

Nut tools add-on & integration installed

If I configure one device in the add-on then add a device in the integration, using “a0d7b954-nut” as the host, I can see the UPS reporting data, this is true for both UPSs but only one at a time

When I try to configure the add-on to have both devices, it will not start

Any pointers on how to get this working?

This works (1 device)

users:
  - username: nutuser
    password: nutpassword
    instcmds:
      - all
    actions: []
devices:
  - name: HA-CCTV-UPS
    driver: usbhid-ups
    port: /devices/pci0000:00/0000:00:14.0/usb1/1-6
    config:
        - vendorid = 051d
        - desc = HA-CCTV-UPS
    serial: AS10########    
mode: netserver
shutdown_host: false

This also works (the other device)

users:
  - username: nutuser
    password: nutpassword
    instcmds:
      - all
    actions: []
devices:
  - name: NAS-UPS
    driver: usbhid-ups
    port: /devices/pci0000:00/0000:00:14.0/usb1/1-8
    config:
        - vendorid = 051d
        - desc = NAS-UPS
    serial: 3S15########
mode: netserver
shutdown_host: false

This does NOT work, add-on will not start

users:
  - username: nutuser
    password: nutpassword
    instcmds:
      - all
    actions: []
devices:
  - name: HA-CCTV-UPS
    driver: usbhid-ups
    port: /devices/pci0000:00/0000:00:14.0/usb1/1-6
    config:
        - vendorid = 051d
        - desc = HA-CCTV-UPS
    serial: AS10########
  - name: NAS-UPS
    driver: usbhid-ups
    port: /devices/pci0000:00/0000:00:14.0/usb1/1-8
    config:
        - vendorid = 051d
        - desc = NAS-UPS
    serial: 3S15########
mode: netserver
shutdown_host: false

Log file for failed start

-----------------------------------------------------------
 Add-on: Network UPS Tools
 Manage battery backup (UPS) devices
-----------------------------------------------------------
 Add-on version: 0.13.1
 You are running the latest version of this add-on.
 System: Home Assistant OS 13.1  (amd64 / generic-x86-64)
 Home Assistant Core: 2024.8.3
 Home Assistant Supervisor: 2024.08.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-timezone: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
[20:55:11] INFO: Configuring timezone (Europe/London)...
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service base-addon-timezone successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/nut.sh
[20:55:11] INFO: Setting mode to netserver...
[20:55:11] INFO: Generating /etc/nut/upsd.users...
[20:55:11] INFO: Configuring user: nutuser
[20:55:12] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[20:55:12] INFO: Configuring Device named HA-CCTV-UPS...
[20:55:12] INFO: Configuring Device named NAS-UPS...
[20:55:12] INFO: Starting the UPS drivers...
WARNING: warn_if_bad_usb_port_filename(): port argument specified to
  the driver is "/devices/pci0000:00/0000:00:14.0/usb1/1-6" but USB drivers do not use it and rely on
  libusb walking all devices and matching their identification metadata.
  NUT documentation recommends port="auto" for USB devices to avoid confusion.
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
Using subdriver: APC HID 0.98
USB communication driver (libusb 1.0) 0.43
WARNING: warn_if_bad_usb_port_filename(): port argument specified to
  the driver is "/devices/pci0000:00/0000:00:14.0/usb1/1-8" but USB drivers do not use it and rely on
  libusb walking all devices and matching their identification metadata.
  NUT documentation recommends port="auto" for USB devices to avoid confusion.
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Can't claim USB device [051d:0003]@0/0: Entity not found
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
Driver failed to start (exit status=1)
Network UPS Tools - UPS driver controller 2.8.0
cont-init: info: /etc/cont-init.d/nut.sh exited 1
cont-init: info: running /etc/cont-init.d/nutclient.sh
cont-init: info: /etc/cont-init.d/nutclient.sh exited 0
cont-init: warning: some scripts exited nonzero
s6-rc: warning: unable to start service legacy-cont-init: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-timezone: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-timezone successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Don’t know the specifics here (TL;DR), but my guess is the code assumes one server, one UPS and breaks.

The fix (I’ve used before) is to assume there is one incoming mains supply, and find the UPS with the shortest run-time. Trigger shutdowns from the UPS to cut off first and broadcast to all linked devices.

Getting both UPS to log and email alerts is likely enough (e.g. battery fail).

I run nut in docker. In this cas you can add a second nut instance for the integration in HA devices and services

set port to auto and try again. As long as the Serial Number is set appropriately, NUT should use that to identify and connect to each UPS.

Thanks for the suggestion, set them both to auto, differentiated on serial, still fails to start

s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-timezone: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
[19:25:20] INFO: Configuring timezone (Europe/London)...
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service base-addon-timezone successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/nut.sh
[19:25:20] INFO: Setting mode to netserver...
[19:25:21] INFO: Generating /etc/nut/upsd.users...
[19:25:21] INFO: Configuring user: nutuser
[19:25:21] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[19:25:21] INFO: Configuring Device named HA-CCTV-UPS...
[19:25:21] INFO: Configuring Device named NAS-UPS...
[19:25:21] INFO: Starting the UPS drivers...
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Using subdriver: APC HID 0.98
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Can't claim USB device [051d:0003]@0/0: Entity not found
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
Driver failed to start (exit status=1)
Network UPS Tools - UPS driver controller 2.8.0
cont-init: info: /etc/cont-init.d/nut.sh exited 1
cont-init: info: running /etc/cont-init.d/nutclient.sh
cont-init: info: /etc/cont-init.d/nutclient.sh exited 0
cont-init: warning: some scripts exited nonzero
s6-rc: warning: unable to start service legacy-cont-init: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-timezone: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-timezone successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Here is another Forum User who was also trying to add a couple of UPSs and was finally able to succeed. However it sounds like something you already tried.

May I ask, what is the second UPS supplying backup power to? Another computer?

This would suggest the add-on can’t find the USB device. But if it works individually with each UPS, then there’s something else going on.

Try removing the - vendorid = 051d line from both sections of the config. Also not sure if you need the list_usb_devices: true as shown in the other config.

1 Like

Each UPS are used for different things.

I’ll take a look at the thread you linked to see if I can glean any info, cheers for posting

I’ll also add, that IMHO it is not a good idea to reference a USB port directly (USB1/1-x). The number (x) is arbitrarily assigned by the kernel as it sees the device on the physical USB port show up, so its not always the same.

didn’t know that, cheers for sharing

  • Port = auto
  • vendorID = removed
  • list usb devices = added

Still no joy

@wmaker I checked the other post you linked and they were watching the exact same video I was watching, where 2 UPSs were added, I also cannot replicate a working verison of this.

Updated Config

users:
  - username: nutuser
    password: nutpassword
    instcmds:
      - all
    actions: []
devices:
  - name: HA-CCTV-UPS
    driver: usbhid-ups
    port: auto
    config:
      - desc = HA-CCTV-UPS
    serial: AS10XXXXXXXX
  - name: NAS-UPS
    driver: usbhid-ups
    port: auto
    config:
      - desc = NAS-UPS
    serial: 3S15XXXXXXXX
mode: netserver
shutdown_host: false
list_usb_devices: true

Log

s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-timezone: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
[22:54:03] INFO: Configuring timezone (Europe/London)...
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service base-addon-timezone successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/nut.sh
[22:54:03] INFO: Setting mode to netserver...
[22:54:03] INFO: Connected USB devices:
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 051d:0003 American Power Conversion UPS
Bus 001 Device 008: ID 051d:0003 American Power Conversion UPS
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
[22:54:03] INFO: Generating /etc/nut/upsd.users...
[22:54:03] INFO: Configuring user: nutuser
[22:54:04] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[22:54:04] INFO: Configuring Device named HA-CCTV-UPS...
[22:54:04] INFO: Configuring Device named NAS-UPS...
[22:54:04] INFO: Starting the UPS drivers...
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Using subdriver: APC HID 0.98
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Can't claim USB device [051d:0003]@0/0: Entity not found
Network UPS Tools - Generic HID driver 0.47 (2.8.0)
USB communication driver (libusb 1.0) 0.43
Network UPS Tools - UPS driver controller 2.8.0
Driver failed to start (exit status=1)
cont-init: info: /etc/cont-init.d/nut.sh exited 1
cont-init: info: running /etc/cont-init.d/nutclient.sh
cont-init: info: /etc/cont-init.d/nutclient.sh exited 0
cont-init: warning: some scripts exited nonzero
s6-rc: warning: unable to start service legacy-cont-init: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-timezone: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-timezone successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped

Hello
The second UPS is to support the Rogers modem and Ubiquiti Router.

Hello
This is my yaml file (User name & Password are intentionally left out)

users:
  - username: 
    password: 
    instcmds:
      - all
    actions: []
devices:
  - name: Data_Rack
    driver: usbhid-ups
    port: auto
    config:
      - serial = P1FNQ2000020
  - name: Modem_Router
    driver: usbhid-ups
    port: auto
    config:
      - serial = CXXPQ2001295
mode: netserver
shutdown_host: false
list_usb_devices: true
1 Like

Shouldnt the ports be defined?

If it is auto how will it select ups 1 vs 2? Each ups shouklf be set to run on different oirt and integration pointing to those ports

You have serial indented under config, mine won’t even save if I do it like that.

How did you manage to save it?

It’s in the NUT documentation that USB devices should have their port set to auto. It uses other identifiers such as serial number to connect to the correct one. This is mostly because USB devices get assigned a virtual port when they are unplugged and plugged back in so the port it has now may not be the same port later.

Make sure it’s exact formatting. Not just indented but using the hyphen and an equals sign instead of the colon. Basic treat it as an attribute and not a header/key in the config.

1 Like

—SOLVED—

For anyone in the future. This is what was achieved

2 x APC USPs connected via USB to a PC running Home Assistant OS to be monitoried by NUT Tools

Steps to repeat for solution

  • Install the add-on

In the config of the add-on (working config below)

  • Set port to auto
  • Give it a meaningful name and description for when you add the devices later
  • Serial number is part of the config, MUST use “=” sign (thank you @mcoulton
    @squirtbrnr)

Add the NUT integration

  • Host a0d7b954-nut
  • username and password you entered in config
  • It should now present you with the 2 USPs (with names)
  • Add 1 of them
  • Open the integration and “add device” from the integration to add the 2nd UPS

My working config

users:
  - username: nutuser
    password: nutpassword
    instcmds:
      - all
    actions: []
devices:
  - name: HA-CCTV-UPS
    driver: usbhid-ups
    port: auto
    config:
      - desc = HA-CCTV-UPS
      - serial = AS10********
  - name: NAS-UPS
    driver: usbhid-ups
    port: auto
    config:
      - desc = HA-CCTV-UPS
      - serial = 3S15********
mode: netserver
shutdown_host: false
list_usb_devices: true

Hi Darren
Glad to see you got it working. I struggled with mine until someone pointed me in the right direction.

1 Like