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
2.13k stars 355 forks source link

usb-hidups/mge-hid Nonsensical Variable Types #740

Open zegelin opened 5 years ago

zegelin commented 5 years ago

I have an Eaton Powerware 9130 connected to my server via USB.

I wrote a small Python program using nut2 (similar to the built-in PyNUT library), which communicates to NUT via TCP using the protocol detailed in the NUT documentation (9. Network protocol information).

My program prints the names, types, and values for all available variables for each UPS listed by the server.

I noticed that a significant number of variables have incorrect types.

For example, device.model is listed as type NUMBER, yet has the value 9130 1500VA-R, which is clearly a string.

Another is ups.status, which also has type NUMBER, yet has a string or enum value: OL.

Below is the output from my program, which is a full list of variables available from NUT for my UPS, along with their types and values. As you can see, many of the variables are listed as NUMBER when they are in-fact strings or enums.

UPS VAR TYPE VALUE
eaton battery.charge NUMBER 100
eaton battery.charge.low RW STRING:5 20
eaton battery.runtime NUMBER 2519
eaton battery.type NUMBER PbAc
eaton device.mfr NUMBER EATON Powerware
eaton device.model NUMBER 9130  1500VA-R
eaton device.serial NUMBER GC154A0168
eaton device.type NUMBER ups
eaton driver.name NUMBER usbhid-ups
eaton driver.parameter.bus NUMBER 001
eaton driver.parameter.pollfreq NUMBER 30
eaton driver.parameter.pollinterval NUMBER 2
eaton driver.parameter.port NUMBER auto
eaton driver.parameter.product NUMBER 9130
eaton driver.parameter.productid NUMBER FFFF
eaton driver.parameter.serial NUMBER GC154A0168
eaton driver.parameter.synchronous NUMBER no
eaton driver.parameter.vendor NUMBER EATON Powerware
eaton driver.parameter.vendorid NUMBER 0463
eaton driver.version NUMBER 2.7.4
eaton driver.version.data NUMBER MGE HID 1.39
eaton driver.version.internal NUMBER 0.41
eaton input.frequency NUMBER 60.0
eaton input.transfer.high RW STRING:5 144
eaton input.transfer.low RW STRING:5 70
eaton input.voltage NUMBER 119.0
eaton input.voltage.nominal NUMBER 120
eaton outlet.1.delay.shutdown RW STRING:5 65535
eaton outlet.1.delay.start RW STRING:5 0
eaton outlet.1.desc RW STRING:20 PowerShare Outlet 1
eaton outlet.1.id NUMBER 2
eaton outlet.1.status NUMBER on
eaton outlet.1.switchable NUMBER yes
eaton outlet.2.delay.shutdown RW STRING:5 65535
eaton outlet.2.delay.start RW STRING:5 0
eaton outlet.2.desc RW STRING:20 PowerShare Outlet 2
eaton outlet.2.id NUMBER 3
eaton outlet.2.status NUMBER on
eaton outlet.2.switchable NUMBER yes
eaton outlet.desc RW STRING:20 Main Outlet
eaton outlet.id NUMBER 1
eaton outlet.switchable NUMBER no
eaton output.current NUMBER 2.00
eaton output.frequency NUMBER 59.9
eaton output.frequency.nominal NUMBER 60
eaton output.voltage NUMBER 120.0
eaton output.voltage.nominal RW ENUM 120
eaton ups.beeper.status NUMBER enabled
eaton ups.delay.shutdown RW STRING:10 20
eaton ups.delay.start RW STRING:10 30
eaton ups.firmware NUMBER 0130
eaton ups.load NUMBER 16
eaton ups.load.high RW STRING:5 102
eaton ups.mfr NUMBER EATON Powerware
eaton ups.model NUMBER 9130  1500VA-R
eaton ups.power NUMBER 236
eaton ups.power.nominal NUMBER 1500
eaton ups.productid NUMBER ffff
eaton ups.realpower NUMBER 229
eaton ups.serial NUMBER GC154A0168
eaton ups.status NUMBER OL
eaton ups.temperature NUMBER 19.9
eaton ups.test.result NUMBER Done and passed
eaton ups.timer.shutdown NUMBER 0
eaton ups.timer.start NUMBER 0
eaton ups.vendorid NUMBER 0463
clepple commented 5 years ago

(fixed a few typos to help with searching)

More detail: #134