upshift-docker / nut-upsd

42 stars 41 forks source link

Docker run command forces UPS to move to different device path #2

Open jm20122012 opened 3 years ago

jm20122012 commented 3 years ago

Just downloaded the docker container on CentOS 8. When I plug in my UPS, it gets assigned to "/dev/bus/usb/00x/00x". When I use the docker run command I use:

docker run --name tripplite --detach --publish 3943:3943 --device /dev/bus/usb/00x/00x -e UPS_NAME="Tripplite" -e UPS_DRIVER=usbhid-ups -e UPS_DESC=Tripplite -e API_USER="upsmon" -e API_PASSWORD="xxxxx" upshift/nut-upsd

If the device path was originally "/dev/bus/usb/002/001" it will get reassigned to "/dev/bus/usb/002/002" after starting the docker container, which results in never ending "Poll UPS [Tripplite@localhost] failed - Data stale" messages in the log. I'm assuming because the UPS has moved to a new device path as a result of the run command forcing it to move.

Not sure what to do to fix this.

jlazkano commented 2 years ago

Hello,

I have same problem, I have fixed the UPS to a static dev with udev and this is the device line in the compose:

` devices:

If I reboot the host, and the device goes to different bus, it can not connect, like in this example:

$ lsusb | grep Power Bus 004 Device 002: ID 051d:0002 American Power Conversion Uninterruptible Power Supply

I need to change the compose line to the new bus:

` devices:

How could we fix this?

How do you configure your compose files?

KC-inDomus commented 2 years ago

same problem here. will follow

yetkinergun commented 1 year ago

just pass the full usb path like this:

devices:
      - /dev/bus/usb:/dev/bus/usb