Nut UPS configuration (default/override sections)

My UPS reports some values incorrectly, but in /etc//nut/ups.conf you can define default and override values (let's say default.output.voltage.nominal = 120 or override.input.transfer.low = 96). Then the server reports the correct values when you ask it though upsc.

But every time nut-server is restarted, the config files are rewritten from the values in /etc/config/nut_server. The documentation says that you can add "default" and "override" options to that file, but I'm not at all clear about the syntax. Can anyone help?

Same problem here, I tried using the override section in several different ways but without success, I have also compiled the last snapshot but with same result. To correctly use my ups I have to delete the symlinks in /etc/nut and use the standard nut config files.

Any help in using the override section in the correct way? Or simply it doesn't work?

There was a bug in the nut-server initscript (# 13359) that caused the override/default options to be written out wrong to the nut config file. It was also backported to the 19.07 branch (# 14269).

The syntax goes like this:
config override 'override_input_transfer_high'
option value '140'

config default 'default_output_voltage_nominal'
option value '120'

in /etc/config/nut_server becomes this in /etc/nut/ups.conf/:
override.input.transfer.high = 140
default.output.voltage.nominal = 120

I'm on nut 2.7.4-21, I thing I'm using the override section in the correct way, but without success.

I need an ups.conf as this:

[ups]
driver = blazer_usb
vendorid = xxxx
productid = xxxx
port = auto
override.battery.charge.low = 40

and I configured my nut_server in this way:

config driver 'ups'
        option driver blazer_usb
        option port auto
        option vendorid xxxx
        option productid xxxx
        option override override_battery_charge_low

config override 'override_battery_charge_low'
        option value '40'

but it generates this ups.conf:

[ups]
driver = blazer_usb
port = auto
vendorid = xxxx
productid = xxxx

What I'm doing wrongly? I tried with and without "option override override_battery_charge_low" with same result.

#Postedit
I understood that I was using it in the wrong way. Thanks a lot for the links :slight_smile:

You also need in the config driver section:
list override 'input_transfer_high'
list default 'output_voltage_nominal'

Not option but list.

My bad. I forgot.

Oh yes I solved thanks your first link :slight_smile:

Another question, I'm noticing that without "option runas root" in "config driver 'ups'" and "config upsd 'upsd'" I have this permission error:

daemon.err upsd[2828]: Can't open /etc/nut/ups.conf: Can't open /etc/nut/ups.conf: Permission denied

Have you also noticed this problem? Obviously /etc/nut/ups.conf is a symlink to /var/etc/nut/ups.conf that has the right permissions root:nut.

I have in etc/config/nut_server:
config upsd 'upsd'
option runas 'nut'

Is user nut part of group nut?

Yes, you are right, the problem was this -.-" my bad, I was pretty sure that this was an automatic operation and I haven't checked.

Thanks really a lot for your help. Thanks.