aramperes / nut-rs

rups: A Network UPS Tools (NUT) implementation in Rust.
https://crates.io/crates/rups
MIT License
24 stars 3 forks source link

Support `GET TYPE` #14

Closed aramperes closed 3 years ago

aramperes commented 3 years ago

https://networkupstools.org/docs/developer-guide.chunked/ar01s09.html

Form:
    GET TYPE <upsname> <varname>
    GET TYPE su700 input.transfer.low

Response:
    TYPE <upsname> <varname> <type>...
    TYPE su700 input.transfer.low ENUM

<type> can be several values, and multiple words may be returned:

    RW: this variable may be set to another value with SET
    ENUM: an enumerated type, which supports a few specific values
    STRING:n: this is a string of maximum length n
    RANGE: this is an numeric, either integer or float, comprised in the range (see LIST RANGE)
    NUMBER: this is a simple numeric value, either integer or float

ENUM, STRING and RANGE are usually associated with RW, but not always. The default <type>, when omitted, is numeric, so either integer or float. Each driver is then responsible for handling values as either integer or float.

Note that float values are expressed using decimal (base 10) english-based representation, so using a dot, in non-scientific notation. So hexadecimal, exponents, and comma for thousands separator are forbidden. For example: "1200.20" is valid, while "1,200.20" and "1200,20" are invalid.