[Nut-upsdev] Looking for examples of var TYPE descriptions
roger at rogerprice.org
Fri Sep 3 08:54:38 BST 2021
On Thu, 2 Sep 2021, Glen Bakeman via Nut-upsdev wrote:
> To give a little more background, I'm working on a program that, among other
> things, will parse the variable type(s) that are passed to it from a NUT
> server. I'd like to understand just how exotic/complicated a variable type can
> get. If that means ENUMs are just enum and nothing else, great - although from
> my understanding in the master branch of the nut-ups code, it seems possible
> that variables can mix and match when the server responds to such a query. I'm
> hoping someone can maybe provide a few examples of what the most complex
> variables look like, since I don't seem to have those on my end.
There is no overall grammar for the "language" of the responses sent by a NUT
server to the client. Each command received by the server invites a response
with a very limited grammar available for that response.
The command GET TYPE <upsname> <varname> returns the type, i.e. the grammar of
the response. There is only one type per variable, and there is only one
grammar. Choosing the grammar of the response requires the server code to be
able to handle all the possible types, but the client will receive only one at
This is why the examples given are always simple, as in 188.8.131.52. command GET VAR
su700 ups.status and response VAR su700 ups.status "OB LB"
However some testing showed:
rprice at maria ~ nc localhost 3493
GET TYPE Eaton ups.status
TYPE Eaton ups.status NUMBER
GET VAR Eaton ups.status
VAR Eaton ups.status "OL"
"OL" is not a NUMBER. I cannot explain this. Perhaps others can.
More information about the Nut-upsdev