networkupstools / nut

The Network UPS Tools repository. UPS management protocol Informational RFC 9271 published by IETF at https://www.rfc-editor.org/info/rfc9271 Please star NUT on GitHub, this helps with sponsorships!
https://networkupstools.org/
Other
1.96k stars 348 forks source link

Support some more Legrand devices #616

Open zykh opened 6 years ago

zykh commented 6 years ago

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 commented 5 years ago

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

zykh commented 5 years ago

@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 commented 3 years ago

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 commented 3 years ago

Seems this support was added after the 2.7.4 release, and a 2.7.5 is sadly still pending. If you can try building from sources available on Github, you can confirm if that would support your device or some further work is needed.

On Sat, Jul 24, 2021 at 2:56 PM Christian Raab @.***> wrote:

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

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/networkupstools/nut/issues/616#issuecomment-886049978, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFCFFNKXGWTIZMINTL3TZK2ABANCNFSM4FUJGXRQ .

nseries100 commented 3 years ago

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

greyslater commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

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 https://github.com/networkupstools/nut/pull/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 commented 3 years ago

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

blecher-at commented 2 years ago

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 https://github.com/networkupstools/nut/issues/1023 I'll add more information there.

jimklimov commented 2 years ago

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

deepbluese commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

/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 commented 2 years ago

/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 commented 2 years ago

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

deepbluese commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 d831a9ae). 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 commented 2 years ago

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

deepbluese commented 2 years ago

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

jimklimov commented 2 years ago

Generally, the Operation not permitted probably mean that your NUT run-time user account may not write (or even read?) the device filesystem nodes for the USB device. It should be permitted to access (or even "own") the device for the UPS, and apply that across reboots and possibly device re-plugs, which may be a very different adventure depending on the OS used (e.g. USB ports may get re-enumerated based on their population with connected devices or hubs).

One alternative, not perfect but usable, would be to run the NUT driver as root.

UPDATE: Re-reading your log, I see you've also hit the issue with ups.conf not accessible to your test user so you re-ran the driver via sudo; in that case check if some OS/kernel subsystem (such as udev) may be grabbing and holding your UPS as a HID device. A build of NUT should generate config snippets for several device-management frameworks to tell them that a NUT driver is responsible for a matching device.

blecher-at commented 2 years ago

@jimklimov can we merge this? or what's missing. It runs on my device for over a month now without issues.

jimklimov commented 2 years ago

Thanks for confirmation, hope to take another look soon, then.

On Thu, Dec 2, 2021, 13:09 Stephan @.***> wrote:

@jimklimov https://github.com/jimklimov can we merge this? or what's missing. It runs on my device for over a month now without issues.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/networkupstools/nut/issues/616#issuecomment-984569310, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFFCZUHNWB4HFJFWFB3UO5OXXANCNFSM4FUJGXRQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

muetdhiver commented 2 years ago

I got 2x of those Keor 800 and the patch is working well. Thank you for it.

Mr-sulu commented 2 years ago

Hi, I've a KEOR 800 too attached to a synology 220+. Is not clear to me how to apply the patch to NUT insite DSM to have the legrand recognized. Someone can help me please? Many thanks!

johndekroon commented 2 years ago

Hi, I've a KEOR 800 too attached to a synology 220+. Is not clear to me how to apply the patch to NUT insite DSM to have the legrand recognized. Someone can help me please? Many thanks!

Unless you have root access and able to compile it yourself, you have to wait until this is merged, they release a new version and Synology updates NUT.

nseries100 commented 2 years ago

Any news here? What we are waiting for?

jimklimov commented 2 years ago

The merge to master was done last month; release of NUT and eventual updated packaging in different distros is still on the menu - got some loose ends to tie up first, and late-coming fixes.

Regarding this issue, so far not closing it as the early discussion mentioned some follow-up work, though it has its own tickets (e.g. #619)

jimklimov commented 2 years ago

To review what's left to do - if there are any more issues to formulate - as part of 2.8.1

nseries100 commented 2 years ago

I'm trying @blecher-at setup:

but after make command I'm getting this error: make: *** No rule to make target '../common/libcommon.la', needed by 'al175'. Stop. Any hint?

jimklimov commented 2 years ago

As the recent comment says, changes from @blecher-at were in PR #1075 and merged in the winter. So should be just part of current master and NUT 2.8.0 release.

In your sample, if that is verbatim what you did, you check out some default branch, probably master that is currently some 3k commits behind the "real" current NUT codebase. Note that source branch of the PR was deleted by author after the merge.

nseries100 commented 2 years ago

I cloned master branch and its working fine now with my KEOR 800. Thx

vyruz1986 commented 2 years ago

I cloned master branch and its working fine now with my KEOR 800. Thx

Would you be so kind and share the output you're getting from upsc with us? I'm on the fence for a KEOR 800 PDU but would like to know whether it reports output current total and per output plug. Thanks in advance!

blecher-at commented 2 years ago

It outputs the current of all devices, the PDU800 doesnt support metrics per output plug.

upsc lups

battery.charge: 100 battery.charge.low: 10 battery.charge.warning: 20 battery.runtime: 2520 battery.voltage: 1.4 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: auto driver.parameter.productid: 0038 driver.parameter.synchronous: no driver.parameter.vendorid: 1cb0 driver.version: 2.7.4-4539-gefb9ee45 driver.version.data: Legrand HID 0.2 driver.version.internal: 0.45 driver.version.usb: libusb-1.0.24 (API: 0x1000108) input.transfer.high: 270 input.transfer.low: 180 input.voltage: 236 input.voltage.nominal: 230 output.frequency: 50 output.voltage: 6 ups.delay.shutdown: 20 ups.delay.start: 30 ups.load: 20 ups.mfr: Legrand ups.model: KEOR PDU 800 ups.productid: 0038 ups.realpower.nominal: 480 ups.serial: ups.status: OL CHRG ups.vendorid: 1cb0

MonsieurPoutounours commented 2 years ago

Hi,

Thanks to everyone implied in Keor PDU support.

With nut version 2.8.0, compiled from source with root user, i am still facing issues. (EDIT: same with package from experimental branch)

Here is the output (loop) of /usr/local/ups/sbin/upsd -DDD

Network UPS Tools upsd 2.8.0
   0.000000     fopen /var/state/ups/upsd.pid: No such file or directory
   0.000012     Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!

   0.000197     [D3] listen_add: added 192.168.10.2:3493
   0.000264     [D1] debug level is '3'
   0.000274     [D3] setuptcp: try to bind to 192.168.10.2 port 3493
   0.000302     listening on 192.168.10.2 port 3493
   0.000477     /var/state/ups is world readable
   0.000570     Can't connect to UPS [keor] (usbhid-ups-keor): Connection refused
   0.000864     [D2] user_add_action: adding 'SET' for admin
   0.000875     [D2] user_add_instcmd: adding 'ALL' for admin
   0.000886     Running as foreground process, not saving a PID file
   0.000894     [D1] mainloop: UPS [keor] is not currently connected
   0.000905     [D1] mainloop: UPS [keor] is now connected as FD -1
   0.000909     [D2] mainloop: polling 1 filedescriptors
   2.002955     [D2] mainloop: no data available
   2.003004     [D1] mainloop: UPS [keor] is not currently connected
   2.003042     [D1] mainloop: UPS [keor] is now connected as FD -1
   2.003050     [D2] mainloop: polling 1 filedescriptors
   4.005320     [D2] mainloop: no data available
   4.005370     [D1] mainloop: UPS [keor] is not currently connected
   4.005410     [D1] mainloop: UPS [keor] is now connected as FD -1
   4.005416     [D2] mainloop: polling 1 filedescriptors
   6.007459     [D2] mainloop: no data available
   6.007508     [D1] mainloop: UPS [keor] is not currently connected
   6.007546     [D1] mainloop: UPS [keor] is now connected as FD -1
   6.007552     [D2] mainloop: polling 1 filedescriptors
jimklimov commented 2 years ago

This is a log of the data server that says it failed to connect to a driver socket. What does the driver log say? Did you start it? :)

On Tue, Jul 19, 2022 at 12:58 PM Monsieur Poutounours < @.***> wrote:

Hi,

Thanks to everyone implied in Keor PDU support.

With nut version 2.8.0, compiled from source with root user, i am still facing issues.

Here is the output (loop) of /usr/local/ups/sbin/upsd -DDD

Network UPS Tools upsd 2.8.0 0.000000 fopen /var/state/ups/upsd.pid: No such file or directory 0.000012 Could not find PID file '/var/state/ups/upsd.pid' to see if previous upsd instance is already running!

0.000197 [D3] listen_add: added 192.168.10.2:3493 0.000264 [D1] debug level is '3' 0.000274 [D3] setuptcp: try to bind to 192.168.10.2 port 3493 0.000302 listening on 192.168.10.2 port 3493 0.000477 /var/state/ups is world readable 0.000570 Can't connect to UPS [keor] (usbhid-ups-keor): Connection refused 0.000864 [D2] user_add_action: adding 'SET' for admin 0.000875 [D2] user_add_instcmd: adding 'ALL' for admin 0.000886 Running as foreground process, not saving a PID file 0.000894 [D1] mainloop: UPS [keor] is not currently connected 0.000905 [D1] mainloop: UPS [keor] is now connected as FD -1 0.000909 [D2] mainloop: polling 1 filedescriptors 2.002955 [D2] mainloop: no data available 2.003004 [D1] mainloop: UPS [keor] is not currently connected 2.003042 [D1] mainloop: UPS [keor] is now connected as FD -1 2.003050 [D2] mainloop: polling 1 filedescriptors 4.005320 [D2] mainloop: no data available 4.005370 [D1] mainloop: UPS [keor] is not currently connected 4.005410 [D1] mainloop: UPS [keor] is now connected as FD -1 4.005416 [D2] mainloop: polling 1 filedescriptors 6.007459 [D2] mainloop: no data available 6.007508 [D1] mainloop: UPS [keor] is not currently connected 6.007546 [D1] mainloop: UPS [keor] is now connected as FD -1 6.007552 [D2] mainloop: polling 1 filedescriptors

— Reply to this email directly, view it on GitHub https://github.com/networkupstools/nut/issues/616#issuecomment-1188910545, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMPTFC5OW73UHIVOMJXMFLVU2C4HANCNFSM4FUJGXRQ . You are receiving this because you were mentioned.Message ID: @.***>

MonsieurPoutounours commented 2 years ago

You're right. Driver was not starting correctly and i was fooled by "UPS [keor] is now connected as FD -1". It is now working on a Keor PDU 800 with 2.8.0 package from Debian experimental branch (has dependencies from the unstable branch too).

Thanks @jimklimov

mrMiimo commented 2 years ago

I think I have the same problem described in this thread... My setup:

[UPS]
driver=usbhid-ups
port = auto
providerid = 1cb0

And I always have this error:

No matching HID UPS found
Controller failed to start (exit status = 1)

Does anyone know when this PR will be merged? Tnks

matushorvath commented 2 years ago

@mrMiimo You could try this:

[UPS]
        driver = nutdrv_qx
        port = auto

It seems 1cb0 is mentioned in nutdrv_qx, so there is a chance it will work. It worked for me with a different Legrand device (mine is provider 0665). https://github.com/networkupstools/nut/blob/master/drivers/nutdrv_qx.c#L1972

jimklimov commented 2 years ago

Also, not provider(id) but vendor(id). Terms matter.

"This PR" as reworked by @blecher-at was merged almost a year ago. Are you running NUT v2.8.0 or newer (current master from github)?

mrMiimo commented 2 years ago

@mrMiimo You could try this:

[UPS]
        driver = nutdrv_qx
        port = auto

It seems 1cb0 is mentioned in nutdrv_qx, so there is a chance it will work. It worked for me with a different Legrand device (mine is provider 0665). https://github.com/networkupstools/nut/blob/master/drivers/nutdrv_qx.c#L1972

i just tried but it doesn't work 🤷🏻‍♂️

mrMiimo commented 2 years ago

Also, not provider(id) but vendor(id). Terms matter.

"This PR" as reworked by @blecher-at was merged almost a year ago. Are you running NUT v2.8.0 or newer (current master from github)?

ok, i realized i am not running "nut 2.8" or new, but nut 2.7.4, this is the version i see when i run "upsdrvctl start":

Network UPS Tools - UPS driver controller 2.7.4
Network UPS Tools - Generic Q * USB / Serial driver 0.28 (2.7.4)

Sorry but I'm new to NUT... I am trying to install 2.8 but it seems to me that there is no package for Linux raspberrypi 5.15 Bulleye 🫤

jimklimov commented 2 years ago

Packages are not for "Pi" but for OS distro, like Debian (here usually Raspbian, Armbian and other derivatives). Package update by Debian team maintainer was AFAIK proposed some time ago and stalled in "experimental" or "unstable" layer, I think - something to track in the distro. NUT as a project has little leverage in others' sandboxes.

mrMiimo commented 2 years ago

Packages are not for "Pi" but for PS distro, like Debian (here usually Raspbian, Armbian and other derivatives). Package update by Debian team maintainer was AFAIK proposed some time ago and stalled in "experimental" or "unstable" layer, I think - something to track in the distro. NUT as a project has little leverage in others' sandboxes.

well, after a couple of initial problems .. I installed and compiled NUT 2.8 ... but now I get this error:

Network UPS Tools - UPS driver controller 2.8.0-Windows-30-g692bad99b
Network UPS Tools - Generic HID driver 0.49 (2.8.0-Windows-30-g692bad99b)
USB communication driver (libusb 0.1) 0.43
interrupt pipe disabled (add 'pollonly' flag to 'ups.conf' to get rid of this message)
HIDParse: LogMax is less than LogMin. Vendor HID report descriptor may be incorrect; interpreting LogMax -1 as 65535 in ReportID: 0x0f
HIDParse: LogMax is less than LogMin. Vendor HID report descriptor may be incorrect; interpreting LogMax -1 as 255 in ReportID: 0x12
HIDParse: LogMax is less than LogMin. Vendor HID report descriptor may be incorrect; interpreting LogMax -1 as 255 in ReportID: 0x13
HIDParse: LogMax is less than LogMin. Vendor HID report descriptor may be incorrect; interpreting LogMax -1 as 65535 in ReportID: 0x32
Using subdriver: Legrand HID 0.2

with this ups.conf

[ups]
        driver = "usbhid-ups"
        port = "auto"
    pollonly
        desc = "Legrand"
    vendorid = "1cb0"
    productid = "0038"

I think maybe I'll have to look for other ways 🫤

jimklimov commented 2 years ago

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)?

mrMiimo commented 2 years ago

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 commented 2 years ago

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).

mrMiimo commented 2 years ago

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: