You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 29, 2020. It is now read-only.
On my UPS the regular ups.status response would be "OL CHRG"
When I add ups.status to nut_vars JSON, I get the following error:
VAR ups ups.status "OL CHRG"
Traceback (most recent call last):
File "/etc/nut/influx_nut/influx_nut.py", line 337, in
cli()
File "/etc/nut/influx_nut/influx_nut.py", line 332, in cli
influx_creds=config['influx_creds'])
File "/etc/nut/influx_nut/influx_nut.py", line 274, in update
var_value = info['type'](nut_conn.request_var(nut_ups, var))
File "/etc/nut/influx_nut/influx_nut.py", line 159, in request_var
resp = VarResponse(*(raw_resp.split(' ')))
TypeError: new() takes 5 positional arguments but 6 were given
This suggests that raw_resp is split by space char and this results in splitting "OL CHRG" into two separate elements.
My apologies beforehand, because my Python programming skills are beyond horrible, but the way I fixed it for myself is by rewriting request_var function (lines mentioning / working with list "tmp_resp" are the new ones):
Had the same issue parsing my UPS's model, went in a different direction, did a simple regex. Don't know if it will parse everything or not, but seems to work for my basic needs.
@jValdron thanks! I think it's possible to fix this with split() by changing it to split(' ', 3) (I just found out about that optional parameter after reading the docs today). I don't have a UPS which causes this bug so I can't test such a fix. I would gladly accept a pull request to fix this bug if you want to make one.
On my UPS the regular ups.status response would be "OL CHRG"
When I add ups.status to nut_vars JSON, I get the following error:
VAR ups ups.status "OL CHRG"
Traceback (most recent call last):
File "/etc/nut/influx_nut/influx_nut.py", line 337, in
cli()
File "/etc/nut/influx_nut/influx_nut.py", line 332, in cli
influx_creds=config['influx_creds'])
File "/etc/nut/influx_nut/influx_nut.py", line 274, in update
var_value = info['type'](nut_conn.request_var(nut_ups, var))
File "/etc/nut/influx_nut/influx_nut.py", line 159, in request_var
resp = VarResponse(*(raw_resp.split(' ')))
TypeError: new() takes 5 positional arguments but 6 were given
This suggests that raw_resp is split by space char and this results in splitting "OL CHRG" into two separate elements.
My apologies beforehand, because my Python programming skills are beyond horrible, but the way I fixed it for myself is by rewriting request_var function (lines mentioning / working with list "tmp_resp" are the new ones):
The text was updated successfully, but these errors were encountered: