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

Support some more Legrand devices #616

Open
7 of 8 tasks
zykh opened this issue Sep 10, 2018 · 64 comments
Open
7 of 8 tasks

Support some more Legrand devices #616

zykh opened this issue Sep 10, 2018 · 64 comments
Assignees
Labels
DDL enhancement HCL Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) USB USB-HID encoding/LogMin/LogMax Issues and solutions (PRs) specifically about incorrect values in bitstream
Milestone

Comments

@zykh
Copy link
Contributor

zykh commented Sep 10, 2018

This is to track the progress on the topic.
Reference: https://alioth-lists.debian.net/pipermail/nut-upsdev/2018-July/007392.html

Anything else?

Current branch: https://github.com/zykh/nut/tree/issue-441+legrand_updated
(this is likely to cause some conflicts with the libusb branches, so I'd prefer to wait for #300 to be solved before rebasing and merging this one)

@aquette
Copy link
Member

aquette commented Feb 28, 2019

@zykh do you think this one can still go into 2.7.5 if we want to release now?

@zykh
Copy link
Contributor Author

zykh commented Mar 2, 2019

@aquette: sure, it's ready, but, as mentioned above, if 2.7.5 will contain one of the libusb branches, I'd prefer to (rebase and) merge this one after the libusb branch, to avoid possible conflicts there.

@greyslater
Copy link

Hello together,
just bought a new Legrand KEOR PDU 800 and can't get it recognized by the drivers under version 2.7.4
I found compatibility (from 2016) with the KEOR Multiplug but I guess this was the previous Hardware version.
the new products seem to be different

Cheerz, Chris

@jimklimov
Copy link
Member

jimklimov commented Jul 28, 2021 via email

@nseries100
Copy link

Hi there, @greyslater I'm waiting for Keor 800 support too :)

@greyslater
Copy link

@jimklimov
unfortunately i can't but do we have any progress in general here on 2.7.5
as far as i understand @zykh already implemented it in the forked repository

@greyslater
Copy link

hi @nseries100 - i came upon all this because i connected the Keor 800 to a QNAP NAS and it's not recognized
found out that QTS (QNAP OS) uses NUT under the hood

@blecher-at
Copy link
Contributor

blecher-at commented Aug 19, 2021

Got this branch running on current master by resolving some of the conflicts.
removed metasys changes for now as there were too many conflicts, anything else built fine. (still need to figure out the metasys (don't have such a device), or split the issue

see PR #1075

after compiling (on my raspian) using the guide here https://github.com/networkupstools/nut/wiki/Building-NUT-on-Debian,-Raspbian-and-Ubuntu

./configure --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc/nut --localstatedir=/var --libexecdir=/usr/lib/nut --srcdir=. --enable-maintainer-mode --disable-silent-rules --libdir=/usr/lib/$(gcc -print-multiarch) --with-ssl --with-nss --with-cgi --with-dev --enable-static --with-statepath=/var/run/nut --with-altpidpath=/var/run/nut --with-drvpath=/lib/nut --with-cgipath=/usr/lib/cgi-bin/nut --with-htmlpath=/usr/share/nut/www --with-pidpath=/var/run/nut --datadir=/usr/share/nut --with-pkgconfig-dir=/usr/lib/$(gcc -print-multiarch)/pkgconfig --with-user=nut --with-group=nut --with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system --with-usb --disable-dependency-tracking
and then overwriting the binaries
cp drivers/usbhid-ups /usr/lib/nut/usbhid-ups

i was able to have my Legrand KEOR PDU 800 report the variables. didnt test anything else yet.
what else needs to be done on this PR?

@reitermarkus
Copy link

My Legrand KEOR PDU 800 is also working (reporting values) with @blecher-at's updated branch.

@blecher-at
Copy link
Contributor

I checked this branch with updates from master again and noticed that after values like UPS.Input.Voltage now report an invalid value of -0.1. However I believe the issue lies outside the legrand subdrivers, as also dumping usb-hid values using the explore command (as outlined here https://github.com/networkupstools/nut/blob/master/docs/hid-subdrivers.txt) now shows them as invalid. My best guess is this being a regression of #1023
I'll add more information there.

@jimklimov
Copy link
Member

Thanks for the report about possible regression, I've posted a PR to help investigate this. THX: #1138

@deepbluese
Copy link

Got this branch running on current master by resolving some of the conflicts. removed metasys changes for now as there were too many conflicts, anything else built fine. (still need to figure out the metasys (don't have such a device), or split the issue

see PR #1075

after compiling (on my raspian) using the guide here https://github.com/networkupstools/nut/wiki/Building-NUT-on-Debian,-Raspbian-and-Ubuntu

./configure --includedir=/usr/include --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc/nut --localstatedir=/var --libexecdir=/usr/lib/nut --srcdir=. --enable-maintainer-mode --disable-silent-rules --libdir=/usr/lib/$(gcc -print-multiarch) --with-ssl --with-nss --with-cgi --with-dev --enable-static --with-statepath=/var/run/nut --with-altpidpath=/var/run/nut --with-drvpath=/lib/nut --with-cgipath=/usr/lib/cgi-bin/nut --with-htmlpath=/usr/share/nut/www --with-pidpath=/var/run/nut --datadir=/usr/share/nut --with-pkgconfig-dir=/usr/lib/$(gcc -print-multiarch)/pkgconfig --with-user=nut --with-group=nut --with-udev-dir=/lib/udev --with-systemdsystemunitdir=/lib/systemd/system --with-usb --disable-dependency-tracking and then overwriting the binaries cp drivers/usbhid-ups /usr/lib/nut/usbhid-ups

i was able to have my Legrand KEOR PDU 800 report the variables. didnt test anything else yet. what else needs to be done on this PR?

After compiling still the same issue:

sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.43 (2.7.4-2984-g3d7d9597)
USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)
any ideas? thx

@blecher-at
Copy link
Contributor

blecher-at commented Oct 28, 2021

is it really connected? what does lsusb say?
what about /usr/lib/nut/usbhid-ups -DDD -a lups
(lups is the name of the config section in /etc/nut/ups.conf, which in my case looks like this:

[lups]
driver = usbhid-ups
port = auto
vendorid = 1cb0
productid = 0038

also I need need to reset the device when driver was already running (can be done physically, or using the usbreset utulity https://wiki.ubuntuusers.de/usbreset/)

@deepbluese
Copy link

/home/pi/nut# lsusb
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 003: ID 1cb0:0038
Bus 001 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
slush its fine

@deepbluese
Copy link

/home/pi/nut# /usr/lib/nut/usbhid-ups -DDD -a ups
Network UPS Tools - Generic HID driver 0.43 (2.7.4-2984-g3d7d9597)
USB communication driver 0.33
0.000000 [D1] debug level is '3'
0.002045 [D2] Initializing an USB-connected UPS with library (null) (NUT subdriver name='USB communication driver' ver='0.33')
0.002124 [D1] upsdrv_initups (non-SHUT)...
0.029510 [D3] usb_busses=0x18af90
0.029616 [D2] Checking device (1D6B/0003) (002/001)
0.058555 [D2] - VendorID: 1d6b
0.058632 [D2] - ProductID: 0003
0.058687 [D2] - Manufacturer: unknown
0.058734 [D2] - Product: unknown
0.058777 [D2] - Serial Number: unknown
0.058819 [D2] - Bus: 002
0.058868 [D2] - Device: 001
0.058914 [D2] - Device release number: 0510
0.058957 [D2] Trying to match device
0.059002 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.059062 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.059110 [D2] Device does not match - skipping
0.059578 [D2] Checking device (1CB0/0038) (001/003)
0.059732 [D2] - VendorID: 1cb0
0.059782 [D2] - ProductID: 0038
0.059825 [D2] - Manufacturer: unknown
0.059870 [D2] - Product: unknown
0.059915 [D2] - Serial Number: unknown
0.059958 [D2] - Bus: 001
0.060004 [D2] - Device: 003
0.060050 [D2] - Device release number: 0200
0.060092 [D2] Trying to match device
0.060135 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.060187 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.060236 [D2] Device does not match - skipping
0.060299 [D2] Checking device (2109/3431) (001/002)
0.060400 [D2] - VendorID: 2109
0.060450 [D2] - ProductID: 3431
0.060492 [D2] - Manufacturer: unknown
0.060536 [D2] - Product: unknown
0.060589 [D2] - Serial Number: unknown
0.060632 [D2] - Bus: 001
0.060673 [D2] - Device: 002
0.060716 [D2] - Device release number: 0421
0.060767 [D2] Trying to match device
0.060820 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.060870 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.060914 [D2] Device does not match - skipping
0.060981 [D2] Checking device (1D6B/0002) (001/001)
0.061076 [D2] - VendorID: 1d6b
0.061125 [D2] - ProductID: 0002
0.061167 [D2] - Manufacturer: unknown
0.061209 [D2] - Product: unknown
0.061251 [D2] - Serial Number: unknown
0.061293 [D2] - Bus: 001
0.061338 [D2] - Device: 001
0.061389 [D2] - Device release number: 0510
0.061434 [D2] Trying to match device
0.061477 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.061525 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.061572 [D2] Device does not match - skipping
0.061641 [D2] libusb: No appropriate HID device found
0.061698 No matching HID UPS found
looks not good: no matching HID device found

@blecher-at
Copy link
Contributor

blecher-at commented Oct 28, 2021

You compiled the wrong commit, 3d7d959 the pull request you need to build is this one:
#1075 -> https://github.com/blecher-at/nut/tree/issue-441%2Blegrand_updated-3

@deepbluese
Copy link

ok thx
I used this guide:
https://github.com/networkupstools/nut/wiki/Building-NUT-on-Debian,-Raspbian-and-Ubuntu
eher was my misstake?

@blecher-at
Copy link
Contributor

blecher-at commented Oct 28, 2021

You need to clone the repo from this PR:

git clone https://github.com/blecher-at/nut.git && cd nut && git checkout issue-441+legrand_updated-3

and then build

or wait for this PR to be merged

@deepbluese
Copy link

your build same problem:
root@raspberrypi:/home/pi# /usr/lib/nut/usbhid-ups -DDD -a ups
Network UPS Tools - Generic HID driver 0.43 (2.7.4-2486-gaa0b3d1d)
USB communication driver 0.33
0.000000 [D1] debug level is '3'
0.002261 [D2] Initializing an USB-connected UPS with library (null) (NUT subdriver name='USB communication driver' ver='0.33')
0.002347 [D1] upsdrv_initups (non-SHUT)...
0.037190 [D3] usb_busses=0x23ff90
0.037302 [D2] Checking device (1D6B/0003) (002/001)
0.066162 [D2] - VendorID: 1d6b
0.066234 [D2] - ProductID: 0003
0.066286 [D2] - Manufacturer: unknown
0.066337 [D2] - Product: unknown
0.066388 [D2] - Serial Number: unknown
0.066893 [D2] - Bus: 002
0.067149 [D2] - Device: 001
0.067583 [D2] - Device release number: 0510
0.068013 [D2] Trying to match device
0.068447 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.068976 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.069033 [D2] Device does not match - skipping
0.069883 [D2] Checking device (1CB0/0038) (001/003)
0.070281 [D2] - VendorID: 1cb0
0.070469 [D2] - ProductID: 0038
0.070771 [D2] - Manufacturer: unknown
0.071070 [D2] - Product: unknown
0.071369 [D2] - Serial Number: unknown
0.071673 [D2] - Bus: 001
0.071721 [D2] - Device: 003
0.071765 [D2] - Device release number: 0200
0.071808 [D2] Trying to match device
0.072032 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.072419 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.072801 [D2] Device does not match - skipping
0.073344 [D2] Checking device (2109/3431) (001/002)
0.073791 [D2] - VendorID: 2109
0.074031 [D2] - ProductID: 3431
0.074411 [D2] - Manufacturer: unknown
0.074775 [D2] - Product: unknown
0.075140 [D2] - Serial Number: unknown
0.075556 [D2] - Bus: 001
0.075866 [D2] - Device: 002
0.076049 [D2] - Device release number: 0421
0.076230 [D2] Trying to match device
0.076412 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.076608 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.076803 [D2] Device does not match - skipping
0.077250 [D2] Checking device (1D6B/0002) (001/001)
0.077499 [D2] - VendorID: 1d6b
0.077684 [D2] - ProductID: 0002
0.077737 [D2] - Manufacturer: unknown
0.077780 [D2] - Product: unknown
0.077823 [D2] - Serial Number: unknown
0.077865 [D2] - Bus: 001
0.078093 [D2] - Device: 001
0.078491 [D2] - Device release number: 0510
0.078705 [D2] Trying to match device
0.078919 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.079146 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.079369 [D2] Device does not match - skipping
0.079626 [D2] libusb: No appropriate HID device found
0.079852 No matching HID UPS found
root@raspberrypi:/home/pi# sudo upsdrvctl start
Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic HID driver 0.43 (2.7.4-2486-gaa0b3d1d)
USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)
Network UPS Tools - Generic HID driver 0.43 (2.7.4-2486-gaa0b3d1d)
USB communication driver 0.33
No matching HID UPS found
Driver failed to start (exit status=1)

@blecher-at
Copy link
Contributor

blecher-at commented Oct 28, 2021

your log still shows it was built from the wrong commit. (expecting 2.7.4-3009-gd831a9ae). please check you're on the branch and repo I mentioned (commit d831a9a). looks like you didnt checkout the PR branch after cloning my fork...
Other than that I don't know what you're doing wrong, maybe wait for this PR to be merged and then try the official build

@deepbluese
Copy link

Ok thx I will try it tomorrow, when will the official version be released?

@deepbluese
Copy link

Next Problem:

Driver failed to start (exit status=1)
Network UPS Tools - Generic HID driver 0.43 (2.7.4-3009-gd831a9ae)
USB communication driver 0.33
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Can't claim USB device [1cb0:0038]: could not detach kernel driver from interface 0: Operation not permitted
Driver failed to start (exit status=1)
Network UPS Tools - Generic HID driver 0.43 (2.7.4-3009-gd831a9ae)
USB communication driver 0.33
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
Can't claim USB device [1cb0:0038]: could not detach kernel driver from interface 0: Operation not permitted
Driver failed to start (exit status=1)
pi@raspberrypi:~ $ usbreset
Usage:
usbreset PPPP:VVVV - reset by product and vendor id
usbreset BBB/DDD - reset by bus and device number
usbreset "Product" - reset by product name

Devices:
Number 002/002 ID 090c:1000 Flash Drive FIT
Number 001/003 ID 24ae:2013 Rapoo 2.4G Wireless Device
Number 001/002 ID 2109:3431 USB2.0 Hub
Number 001/004 ID 1cb0:0038 KEOR PDU 800
pi@raspberrypi:~ $ /usr/lib/nut/usbhid-ups -DDD -a ups
Network UPS Tools - Generic HID driver 0.43 (2.7.4-3009-gd831a9ae)
USB communication driver 0.33
0.000000 Can't open /etc/nut/ups.conf: Can't open /etc/nut/ups.conf: Permission denied
pi@raspberrypi:~ $ sudo /usr/lib/nut/usbhid-ups -DDD -a ups
Network UPS Tools - Generic HID driver 0.43 (2.7.4-3009-gd831a9ae)
USB communication driver 0.33
0.000000 [D1] debug level is '3'
0.002137 [D2] Initializing an USB-connected UPS with library (null) (NUT subdriver name='USB communication driver' ver='0.33')
0.002229 [D1] upsdrv_initups (non-SHUT)...
0.004143 [D3] usb_busses=0x1c434b8
0.004246 [D2] Checking device (090C/1000) (002/002)
0.004437 [D2] - VendorID: 090c
0.004505 [D2] - ProductID: 1000
0.004568 [D2] - Manufacturer: unknown
0.004627 [D2] - Product: unknown
0.004686 [D2] - Serial Number: unknown
0.004747 [D2] - Bus: 002
0.004805 [D2] - Device: 002
0.004863 [D2] - Device release number: 1100
0.004923 [D2] Trying to match device
0.004983 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.005059 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.005122 [D2] Device does not match - skipping
0.005211 [D2] Checking device (1D6B/0003) (002/001)
0.005343 [D2] - VendorID: 1d6b
0.005408 [D2] - ProductID: 0003
0.005467 [D2] - Manufacturer: unknown
0.005525 [D2] - Product: unknown
0.005584 [D2] - Serial Number: unknown
0.005645 [D2] - Bus: 002
0.005703 [D2] - Device: 001
0.005761 [D2] - Device release number: 0510
0.005820 [D2] Trying to match device
0.005879 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.005947 [D2] match_function_subdriver (non-SHUT mode): failed to match a subdriver to vendor and/or product ID
0.006007 [D2] Device does not match - skipping
0.006094 [D2] Checking device (1CB0/0038) (001/004)
0.006245 [D2] - VendorID: 1cb0
0.006308 [D2] - ProductID: 0038
0.006366 [D2] - Manufacturer: unknown
0.006427 [D2] - Product: unknown
0.006484 [D2] - Serial Number: unknown
0.006543 [D2] - Bus: 001
0.006602 [D2] - Device: 004
0.006662 [D2] - Device release number: 0200
0.006719 [D2] Trying to match device
0.006780 [D2] match_function_subdriver (non-SHUT mode): matching a device...
0.006844 interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
0.006907 [D3] match_function_regex: matching a device...
0.007057 [D2] Device matches
0.007131 [D2] failed to claim USB device: could not claim interface 0: Operation not permitted
0.007202 [D2] failed to detach kernel driver from USB device: could not detach kernel driver from interface 0: Operation not permitted
0.007270 [D2] failed to claim USB device: could not claim interface 0: Operation not permitted
0.007333 [D2] failed to detach kernel driver from USB device: could not detach kernel driver from interface 0: Operation not permitted
0.007395 [D2] failed to claim USB device: could not claim interface 0: Operation not permitted
0.007456 [D2] failed to detach kernel driver from USB device: could not detach kernel driver from interface 0: Operation not permitted
0.007523 [D2] failed to claim USB device: could not claim interface 0: Operation not permitted
0.007588 [D2] failed to detach kernel driver from USB device: could not detach kernel driver from interface 0: Operation not permitted
0.007652 Can't claim USB device [1cb0:0038]: could not detach kernel driver from interface 0: Operation not permitted

@mrMiimo
Copy link

mrMiimo commented Sep 24, 2022

These are not errors but info messages - many vendors do not really follow the protocol correctly so we tried to guess what they meant (since 2.8.0); maybe some readings will yield trash that we can't vouch for.

Did the driver start however? With a running upsd server, does it report info (e.g. to upsc CLI client)?

i don't think it started, i think i'm missing something ... when i run upsd i get this:

root@raspberrypi:/home/pi# /usr/local/ups/sbin/upsd ups@localhost
Network UPS Tools upsd 2.8.0-Windows-30-g692bad99b
fopen /var/state/ups/upsd.pid: No such file or directory
Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!

Network server for UPS data.

i am trying to understand, maybe i miss starting a service

@jimklimov
Copy link
Member

Can't hep but ask: did you read documentation? Command-line help? NUT design overview (the 3 layers of drivers-dataserver-clients)?

At best upsd would ignore the ups@localhost at least if it does not abort outright. (The message about PID file is just that - it can't determine if an older copy of upsd is running and so would conflict)

When you have the driver(s) and a data server running on same system, you can use clients like upsc to query for info from the same or different system, like upsc upsname(@localhost).

@jimklimov jimklimov added the USB-HID encoding/LogMin/LogMax Issues and solutions (PRs) specifically about incorrect values in bitstream label Sep 24, 2022
@mrMiimo
Copy link

mrMiimo commented Sep 24, 2022

Can't hep but ask: did you read documentation? Command-line help? NUT design overview (the 3 layers of drivers-dataserver-clients)?

You are right to ask (I would have asked at the first attempt 😅)
I have read everything (Im surprised by the complete documentation), some things I do not fully understand .. but rereading and practicing I understand them ..

At best upsd would ignore the ups@localhost at least if it does not abort outright. (The message about PID file is just that - it can't determine if an older copy of upsd is running and so would conflict)

When you have the driver(s) and a data server running on same system, you can use clients like upsc to query for info from the same or different system, like upsc upsname(@localhost).

oh... ok.
A little while ago I found a docker image of an old version of NUT I suppose:

/etc/nut # upsdrvctl -V
Network UPS Tools - UPS driver controller 20220715-1526-gded7a4cdc7

I just had to configure the container ports and other stuff, but after configuring ups.conf and nut.conf, everything worked on the first try. I get a reply from ups:

pi@raspberrypi:~ $ upsc ups@localhost
Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.runtime: 1620
battery.voltage: 1.3
battery.voltage.nominal: 1.2
device.mfr: Legrand 
device.model: KEOR PDU 800
device.serial:                 
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/bus/usb/001/004
driver.parameter.synchronous: auto
driver.version: 20220715-1526-gded7a4cdc7
driver.version.data: Legrand HID 0.2
.................

now my goal is:

  • configure upsmon and upssched
  • make sure it turns off all devices (switch, nvr, udm etc) on the network when it reaches a critical battery level
  • and configure the sending of e-mails and SMS at each event

@mrMiimo
Copy link

mrMiimo commented Sep 24, 2022

now my goal is:

  • configure upsmon and upssched
  • make sure it turns off all devices (switch, nvr, udm etc) on the network when it reaches a critical battery level
  • and configure the sending of e-mails and SMS at each event

done everything, including sms alerts! Thanks jimklimov!!!

IMG_24FAF1031CE5-1

@mmhorda
Copy link

mmhorda commented Nov 25, 2022

battery.voltage: 1.3
battery.voltage.nominal: 1.2

is this a bug? I thoght that volatege should be a bit higher.

@VozDeOuro
Copy link

hello i saw that NUT support some SMS Legrand devices
i want to know if you has plans to implement others SMS Legrand drives, like SMS Power View modules.

if you want i can send to you the program that they made available for us

@jimklimov
Copy link
Member

battery.voltage: 1.3 battery.voltage.nominal: 1.2

is this a bug? I thoght that volatege should be a bit higher.

If that is what they report... an UPS running on AA batteries? :)
However, a typical six-pack of cells in one accumulator battery might mean 1.2V * 6 = 7.2V which rings a bell, for example...

There were some changes about detection/guesswork of battery cell count and so overall voltage. proposed for a nutdrv_qx driver type in #1279 / #1652 which might get merged soon; but they won't directly help for usbhid-ups as a separate driver.

@jimklimov
Copy link
Member

hello i saw that NUT support some SMS Legrand devices i want to know if you has plans to implement others SMS Legrand drives, like SMS Power View modules.

if you want i can send to you the program that they made available for us

Is that a binary program, or sources (licensed so) that someone might read and port that to NUT?

Generally, this would need a developer (random but enthusiastic volunteer from the community, ideally with access to HW and specs) to implement or sniff and reverse-engineer the protocol needed. I do hope and encourage that you find and entice someone to do this. Other than that, no "plans" exist, unfortunately.

@jimklimov jimklimov modified the milestones: 2.8.1, 2.8.2 Jan 6, 2023
@MatteoScg
Copy link

@greyslater
hi nseries100 - i came upon all this because i connected the Keor 800 to a QNAP NAS and it's not recognized
found out that QTS (QNAP OS) uses NUT under the hood

Hi @greyslater,
have you found the way to let your QNAP NAS recognize the Legrand UPS?
I am encountering the same issue by connecting my Legrand Keor SP 1000 to my QNAP TS-251A.

Thank you

@jimklimov jimklimov moved this to Todo in NUT HCL/DDL May 25, 2023
@gyulaasztalos
Copy link

gyulaasztalos commented Jul 18, 2023

battery.voltage: 1.3 battery.voltage.nominal: 1.2
is this a bug? I thoght that volatege should be a bit higher.

If that is what they report... an UPS running on AA batteries? :) However, a typical six-pack of cells in one accumulator battery might mean 1.2V * 6 = 7.2V which rings a bell, for example...

There were some changes about detection/guesswork of battery cell count and so overall voltage. proposed for a nutdrv_qx driver type in #1279 / #1652 which might get merged soon; but they won't directly help for usbhid-ups as a separate driver.

Hi @jimklimov

I have the Legrand KEOR PDU 800 (1cb0:0038) and I also got the incorrect voltage values.
I could fix it with this:

diff --git a/drivers/hidparser.c b/drivers/hidparser.c
index 0d7b53f80..6dd448ed9 100644
--- a/drivers/hidparser.c
+++ b/drivers/hidparser.c
@@ -332,7 +332,7 @@ static int HIDParse(HIDParser_t *pParser, HIDData_t *pData)
                                        pParser->Data.LogMax,
                                        pParser->Value,
                                        pParser->Data.ReportID);
-                               pParser->Data.LogMax = (long) pParser->Value;
+                               pParser->Data.LogMax = 65535;
                        }
                        break;
 
diff --git a/drivers/legrand-hid.c b/drivers/legrand-hid.c
index 371555328..5d7dc31cd 100644
--- a/drivers/legrand-hid.c
+++ b/drivers/legrand-hid.c
@@ -134,9 +134,9 @@ static hid_info_t legrand_hid2nut[] = {
        { "input.voltage.nominal", 0, 0, "UPS.Flow.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL },
 
        /* Battery Data */
-       { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, divide_by_10_conversion },
+       { "battery.voltage.nominal", 0, 0, "UPS.PowerSummary.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL },
        { "battery.voltage.nominal", 0, 0, "UPS.BatterySystem.Battery.ConfigVoltage", NULL, "%.0f", HU_FLAG_STATIC, NULL },
-       { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.0f", 0, divide_by_10_conversion },
+       { "battery.voltage", 0, 0, "UPS.PowerSummary.Voltage", NULL, "%.0f", 0, NULL },

@@ -144,8 +144,8 @@ static hid_info_t legrand_hid2nut[] = {
        { "battery.charge.low", 0, 0, "UPS.PowerSummary.RemainingCapacityLimit", NULL, "%.0f", HU_FLAG_STATIC, NULL },
 
        /* Output Data */
-       { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%.0f", 0, NULL },
-       { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.0f", 0, legrand_times10M_info },
+       { "output.voltage", 0, 0, "UPS.Output.Voltage", NULL, "%03.1f", 0, NULL },
+       { "output.voltage", 0, 0, "UPS.PowerConverter.Output.Voltage", NULL, "%.0f", 0, NULL },

And the result:

Init SSL without certificate database
battery.charge: 100
battery.charge.low: 10
battery.charge.warning: 20
battery.runtime: 1620
battery.voltage: 14
battery.voltage.nominal: 12
device.mfr: Legrand 
device.model: KEOR PDU 800
device.serial:                 
device.type: ups
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 15
driver.parameter.port: auto
driver.parameter.productid: 0038
driver.parameter.synchronous: auto
driver.parameter.vendorid: 1cb0
driver.state: quiet
driver.version: 2.8.0-Windows-726-g73ee107fa
driver.version.data: Legrand HID 0.2
driver.version.internal: 0.49
driver.version.usb: libusb-0.1 (or compat)
input.transfer.high: 270
input.transfer.low: 180
input.voltage: 236
input.voltage.nominal: 230
output.frequency: 50
output.voltage: 235.6
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 32
ups.mfr: Legrand 
ups.model: KEOR PDU 800
ups.productid: 0038
ups.realpower.nominal: 480
ups.serial:                 
ups.status: OL CHRG
ups.vendorid: 1cb0

I’m not a developer, I don’t know how such fix should be done properly or how should I report this. I just wanted to fix my PDU800 and I'm trying to help, but I'm afraid this could break voltage display on other Legrand devices or might cause other problems.

@jimklimov
Copy link
Member

Thanks, so it seems some devices have it fixed and others not... Maybe the conversion function should stay, and detect somehow (device id? value range? config option?) whether it should act or keep the value as is.

@jimklimov jimklimov moved this from Todo to Done in NUT HCL/DDL Aug 31, 2023
@jimklimov jimklimov added the Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) label Aug 31, 2023
jimklimov added a commit to jimklimov/nut-ddl that referenced this issue Aug 31, 2023
@pczolee
Copy link

pczolee commented Jan 9, 2024

Hello.

I have an Legrand Keor SP UPS. I built the latest nut, so the UPS is recognized and it look like working, but there is a little problem, the reported values (input/output voltage) are bad (but sometimes are good). For example there is two output:

upsc lups

battery.charge: 80
battery.charge.warning: 30
battery.runtime: 2811
battery.voltage: 13.4
battery.voltage.nominal: 12
device.mfr: Legrand
device.model: Legrand UPS
device.type: ups
driver.debug: 0
driver.flag.allow_killpower: 0
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0032
driver.parameter.synchronous: auto
driver.parameter.vendorid: 1cb0
driver.state: quiet
driver.version: 2.8.1.1
driver.version.data: Legrand HID 0.2
driver.version.internal: 0.52
driver.version.usb: libusb-1.0.21 (API: 0x1000105)
input.transfer.high: 240.0
input.transfer.low: 170
input.voltage: 25.0
input.voltage.nominal: 230
output.voltage: 840.0
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 0
ups.mfr: Legrand
ups.model: Legrand UPS
ups.productid: 0032
ups.realpower.nominal: 800
ups.status: OL CHRG
ups.vendorid: 1cb0

And after a few minutes:

upsc lups

battery.charge: 100
battery.charge.warning: 30
battery.runtime: 2811
battery.voltage: 13.4
battery.voltage.nominal: 12
device.mfr: Legrand
device.type: ups
driver.debug: 0
driver.flag.allow_killpower: 0
driver.name: usbhid-ups
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.productid: 0032
driver.parameter.synchronous: auto
driver.parameter.vendorid: 1cb0
driver.state: quiet
driver.version: 2.8.1.1
driver.version.data: Legrand HID 0.2
driver.version.internal: 0.52
driver.version.usb: libusb-1.0.21 (API: 0x1000105)
input.transfer.high: 240.0
input.transfer.low: 170
input.voltage: 217.0
input.voltage.nominal: 230
output.voltage: 10.0
ups.delay.shutdown: 20
ups.delay.start: 30
ups.load: 0
ups.mfr: Legrand
ups.productid: 0032
ups.realpower.nominal: 800
ups.status: OL CHRG
ups.vendorid: 1cb0

How can I help to debug and solve this issue?

Thanks.

@pczolee
Copy link

pczolee commented Jan 9, 2024

It fix

On Tue, Jan 9, 2024 at 9:23 AM pczolee @.> wrote: Hello. I have an Legrand Keor SP UPS. I built the latest nut, so the UPS is recognized and it look like working, but there is a little problem, the reported values (input/output voltage) are bad (but sometimes are good). For example there is two output: upsc lups battery.charge: 80 battery.charge.warning: 30 battery.runtime: 2811 battery.voltage: 13.4 battery.voltage.nominal: 12 device.mfr: Legrand device.model: Legrand UPS device.type: ups driver.debug: 0 driver.flag.allow_killpower: 0 driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.productid: 0032 driver.parameter.synchronous: auto driver.parameter.vendorid: 1cb0 driver.state: quiet driver.version: 2.8.1.1 driver.version.data: Legrand HID 0.2 driver.version.internal: 0.52 driver.version.usb: libusb-1.0.21 (API: 0x1000105) input.transfer.high: 240.0 input.transfer.low: 170 input.voltage: 25.0 input.voltage.nominal: 230 output.voltage: 840.0 ups.delay.shutdown: 20 ups.delay.start: 30 ups.load: 0 ups.mfr: Legrand ups.model: Legrand UPS ups.productid: 0032 ups.realpower.nominal: 800 ups.status: OL CHRG ups.vendorid: 1cb0 And after a few minutes: upsc lups battery.charge: 100 battery.charge.warning: 30 battery.runtime: 2811 battery.voltage: 13.4 battery.voltage.nominal: 12 device.mfr: Legrand device.type: ups driver.debug: 0 driver.flag.allow_killpower: 0 driver.name: usbhid-ups driver.parameter.pollfreq: 30 driver.parameter.pollinterval: 2 driver.parameter.port: auto driver.parameter.productid: 0032 driver.parameter.synchronous: auto driver.parameter.vendorid: 1cb0 driver.state: quiet driver.version: 2.8.1.1 driver.version.data: Legrand HID 0.2 driver.version.internal: 0.52 driver.version.usb: libusb-1.0.21 (API: 0x1000105) input.transfer.high: 240.0 input.transfer.low: 170 input.voltage: 217.0 input.voltage.nominal: 230 output.voltage: 10.0 ups.delay.shutdown: 20 ups.delay.start: 30 ups.load: 0 ups.mfr: Legrand ups.productid: 0032 ups.realpower.nominal: 800 ups.status: OL CHRG ups.vendorid: 1cb0 How can I help to debug and solve this issue? Thanks. — Reply to this email directly, view it on GitHub <#616 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BARD2PAHFF3464E2LVSLPA3YNVOIBAVCNFSM4FUJGXR2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCOBYGMZDKMZTHE4A . You are receiving this because you are subscribed to this thread.Message ID: @.>

Can you explain what do you mean? Thanks

@muetdhiver
Copy link

muetdhiver commented Jan 10, 2024

Hello,
I think my Grafana's monitoring illustrates what pczolee is pointing. (Yes I have 2 Keor on 2 different monophased incoming power lines)
my VOut is not reporting correct values.
shot-2024-01-10_23-31-52

my compiled version is old by the way and it should be upgraded on my side:
Installed versions: 9999*l{tbz2}[2](14:41:17 03/17/23)

edit: an upgrade was done after this post, 2.8.1-283-gaeb0c3ca
Vout collected datas remain the same.

Regards

@pczolee
Copy link

pczolee commented Jan 12, 2024

The situation is much worse for me (it should be around 230V)! :(

Vin:
kép

Vout:
kép

@pczolee
Copy link

pczolee commented Jan 30, 2024

No idea? :(

@jimklimov
Copy link
Member

jimklimov commented Jan 30, 2024

@pczolee : sorry, travelling these weeks. OTOH, you might want to bump debug verbosity, and since you are using now a custom build of NUT - tinker with code (add more debugs where you think visibility is missing) to see where and based on what inputs the value jumps from normal range (Vin seems to be there sometimes) to obscenely wrong.

Some further ideas:

  • NUT v2.8.0 introduced a Log Min/Max fixup for bad USB report descriptors (see Extract values in HIDParse correctly when compiled in 64-bit (LP64) mode #1024 and issue/PR trail from there). 2.8.1 added a run-time config toggle to disable the fixup, mostly to check if we misunderstood something about USB and the fix adds more problems than it solves on certain devices. I don't remember the name while commuting, but give it a shot.
  • Check USB cabling and its surroundings! Maybe some EMI noise (motors, fridges, neon lights...) just cause random bits to be seen? Try a cable with grounding mesh in the skin, etc.

@jimklimov jimklimov modified the milestones: 2.8.2, 2.8.3 Apr 4, 2024
@jimklimov jimklimov modified the milestones: 2.8.3, 2.8.4 Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DDL enhancement HCL Incorrect or missing readings On some devices driver-reported values are systemically off (e.g. x10, x0.1, const+Value, etc.) USB USB-HID encoding/LogMin/LogMax Issues and solutions (PRs) specifically about incorrect values in bitstream
Projects
Status: Done
Development

No branches or pull requests