Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUT addon not able to communicate with IMD 3000A UPS #51

Closed
henkburnett opened this issue Sep 8, 2020 · 6 comments
Closed

NUT addon not able to communicate with IMD 3000A UPS #51

henkburnett opened this issue Sep 8, 2020 · 6 comments

Comments

@henkburnett
Copy link

henkburnett commented Sep 8, 2020

Problem/Motivation

NUT seems unable to communicate with Powercom IMD 3000A.

Expected behavior

Powercom IMD3000A works with the usbhid-ups driver

Actual behavior

I tested the UPS connected to a different Raspberry PI, running Hassbian. I then configured a nut server (NOT in a container)
NUT connected successfully to the UPS with the usbhid-ups driver
The ups.conf file:
[myups] driver = usbhid-ups port = auto

I then used the above variables in the NUT addon config in the following format:

users:
  - username: xxx
    password: xxx
    instcmds:
      - all
    actions: []
devices:
  - name: myups
    driver: usbhid-ups
    port: auto
    config:
      - vendorid = 0d9f`

I would have expected the config to work, as I confirmed that the ups.conf file within the container was correct. Via docker exec -it /bin/bash I checked the conf was populated correctly.
I do however receive the following error:

Add-on: Network UPS Tools
Manage battery backup (UPS) devices
-----------------------------------------------------------
Add-on version: 0.3.1
You are running the latest version of this add-on.
System: HassOS 4.12  (armv7 / raspberrypi3)
Home Assistant Core: 0.114.4
Home Assistant Supervisor: 242
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] nut.sh: executing... 
[21:25:21] INFO: Setting mode to netserver...
[21:25:22] INFO: Generating /etc/nut/upsd.users...
[21:25:23] INFO: Configuring user: upsadmin
[21:25:24] INFO: Password is NOT in the Have I Been Pwned database! Nice!
[21:25:26] INFO: Configuring Device named myups...
[21:25:27] INFO: Starting the UPS drivers...
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.41 (2.7.4)
No matching HID UPS found
USB communication driver 0.33
Driver failed to start (exit status=1)
[cont-init.d] nut.sh: exited 1.
[cont-finish.d] executing container finish scripts...
[cont-finish.d] 99-message.sh: executing... 
-----------------------------------------------------------
                Oops! Something went wrong.

We are so sorry, but something went terribly wrong when
starting or running this add-on.

Be sure to check the log above, line by line, for hints.
-----------------------------------------------------------
[cont-finish.d] 99-message.sh: exited 0.
[cont-finish.d] done

Steps to reproduce

I think this can only be reproduced on certain hardware

Proposed changes

I have done to following troubleshooting:

root@a0d7b954-nut:/$ lsusb
Bus 001 Device 096: ID 0d9f:0004 Powercom Co., Ltd
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

[ 6385.527594] hid-generic 0003:0D9F:0004.03C0: hiddev96,hidraw0: USB HID v1.00 Device [POWERCOM Co.,LTD HID UPS Battery] on usb-3f980000.usb-1.2/input0
[ 6389.187063] usb 1-1.2: USB disconnect, device number 103
[ 6391.787003] usb 1-1.2: new low-speed USB device number 104 using dwc_otg
[ 6391.953416] usb 1-1.2: New USB device found, idVendor=0d9f, idProduct=0004, bcdDevice= 0.02
[ 6391.960669] usb 1-1.2: New USB device strings: Mfr=3, Product=1, SerialNumber=2
[ 6391.964350] usb 1-1.2: Product: HID UPS Battery
[ 6391.967975] usb 1-1.2: Manufacturer: POWERCOM Co.,LTD
[ 6391.971542] usb 1-1.2: SerialNumber: 004-0D9F-000

So the container can definately detect the UPS.
I did however find that the specific vendorid and productid was not in 62-nut-usbups.rules

cat /lib/udev/rules.d/62-nut-usbups.rules
# PowerCOM
#  PowerCOM Vanguard and BNT-xxxAP  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0001", MODE="664", GROUP="root"
#  PowerCOM Vanguard and BNT-xxxAP  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0004", MODE="664", GROUP="root"
#  PowerCOM IMP - IMPERIAL Series  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a2", MODE="664", GROUP="root"
#  PowerCOM SKP - Smart KING Pro (all Smart series)  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a3", MODE="664", GROUP="root"
#  PowerCOM WOW  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a4", MODE="664", GROUP="root"
#  PowerCOM VGD - Vanguard  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a5", MODE="664", GROUP="root"
#  PowerCOM BNT - Black Knight Pro  - usbhid-ups
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a6", MODE="664", GROUP="root"
#  Unitek Alpha 1200Sx  - blazer_usb
ATTR{idVendor}=="0f03", ATTR{idProduct}=="0001", MODE="664", GROUP="root"

From https://wiki.archlinux.org/index.php/Network_UPS_Tools#Driver_configuration

USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)

It's most likely a problem with permissions for accessing the device. You can fix that by specifying an udev rule that sets the correct group

Can I suggest that the following be added to udev rules:

# Powercom IMP series
ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0004", MODE="664", GROUP="root"

@sinclairpaul
Copy link
Member

It's likely an Alpine issue, perhaps you could test under that?

There may be a library that includes the udev data, it is kind of difficult to actually test any of this without having the hardware...

@henkburnett
Copy link
Author

I now have the Pi Zero running Alpine OS, but I have no idea on how to get NUT installed on it :/

@sinclairpaul
Copy link
Member

Looking at this again, the rule is already listed (it's in the data you posted), so I am slightly confused.

I assume the backtick in your vendor id config is a copy paste issue?

@henkburnett
Copy link
Author

The backtick is a copy paste issue yes.
I also only now saw ATTR{idVendor}=="0d9f", ATTR{idProduct}=="0004", MODE="664", GROUP="root". I kept looking at the line with ATTR{idVendor}=="0d9f", ATTR{idProduct}=="00a4", MODE="664", GROUP="root"

So then it probably isn't a missing udev permission rule. Then I'm stumped and have no idea

@henkburnett
Copy link
Author

I have NUT installed on Alpine, but unable to get upsdrvctl to start. I suppose this is now more a Alpine than an addon issue.

localhost:~# upsdrvctl start
Error relocating /usr/sbin/upsdrvctl: __select_time64: symbol not found
Error relocating /usr/sbin/upsdrvctl: __difftime64: symbol not found
Error relocating /usr/sbin/upsdrvctl: __gettimeofday_time64: symbol not found
Error relocating /usr/sbin/upsdrvctl: __stat_time64: symbol not found

@henkburnett
Copy link
Author

I will close this issue, as I don't think it was an addon issue itself.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants