Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changing the shutdown battery level for UPS Legrand #2014

Open
ITPotatoo opened this issue Aug 6, 2023 · 9 comments
Open

Changing the shutdown battery level for UPS Legrand #2014

ITPotatoo opened this issue Aug 6, 2023 · 9 comments
Labels
Legrand Devices produced and/or branded by Legrand Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved

Comments

@ITPotatoo
Copy link

ITPotatoo commented Aug 6, 2023

Hello
i want to know how i can change the shutdown battery charge level, so my nut client linux host shutdown when for exemple the battery level fall to 40%
i tried with upsrw command in a client nut server :

:; upsrw -s battery.charge.low=40 Legrand@192.168.1.10

i got this error message

Unexpected response from upsd: ERR ACCES-DNIED

here the information of my UPS :

  • the battery.charge.low value does not exist
:; upsc Legrand@localhost
Init SSL without certificate database
battery.charge: 100
battery.voltage: 2.22
battery.voltage.high: 78.00
battery.voltage.low: 62.40
battery.voltage.nominal: 72.0
device.mfr: Legrand
device.model: Dk+ 3kVA
device.type: ups
driver.name: nutdrv_qx
driver.parameter.pollfreq: 30
driver.parameter.pollinterval: 1
driver.parameter.port: auto
driver.parameter.productid: 0035
driver.parameter.synchronous: auto
driver.parameter.vendorid: 1CB0
driver.version: 2.8.0
driver.version.data: Megatec 0.06
driver.version.internal: 0.32
driver.version.usb: libusb-1.0.26 (API: 0x1000109)
input.current.nominal: 13.0
input.frequency: 49.9
input.frequency.nominal: 50
input.voltage: 222.8
input.voltage.fault: 105.0
input.voltage.nominal: 230
output.voltage: 229.6
ups.beeper.status: enabled
ups.delay.shutdown: 30
ups.delay.start: 180
ups.firmware: AS1L185H
ups.load: 14
ups.productid: 0035
ups.status: OL
ups.temperature: 45.0
ups.type: online
ups.vendorid: 1cb0

Please can you help, i don't find the solution in the internet

MAINTAINER NOTE: Slightly edited with markdown for readability

@jimklimov
Copy link
Member

For upsrw you need to pass the user name and password, as defined in your upsd.conf (see docs/examples if nothing is defined yet; check OS permissions on the file as insecure ones ought to be ignored) as an account with a SET permission.

@jimklimov
Copy link
Member

jimklimov commented Aug 6, 2023

Generally, though, you might have to set such value in ups.conf as an override.battery.charge.low

And note there is currently an open discussion whether this works as it should (at least as far as propagating the value into the device, for UPSes that do not remember settings after power cycling) => #1993

@ITPotatoo
Copy link
Author

ITPotatoo commented Aug 6, 2023

Here my configuration of upsd

upsd.conf
LISTEN 0.0.0.0 3493

upsd.users
[admin]
password = secret
instcmds = all
actions = SET

when i use the command : upsrw -s battery.charge.low=40 Legrand@192.168.1.10

Username (root) : admin
Password : secret
Unexpected response from upsd: ERR VAR-NOT-SUPPORTED
is there anything wrong ?

@ITPotatoo
Copy link
Author

Unexpected response from upsd: ERR VAR-NOT-SUPPORTED

@jimklimov
Copy link
Member

Seems right regarding credentials (and since it no longer complains about access denied - OS permissions on the file are also ok)

@jimklimov
Copy link
Member

jimklimov commented Aug 6, 2023

So the remaining bit is that this var for this subdriver is not defined, possibly the device does not handle it, or the driver authors were not aware of protocol bits to request/query the value (if they exist).

At least it is not in the mapping https://github.com/networkupstools/nut/blob/v2.8.0/drivers/nutdrv_qx_megatec.c

A few subdrivers do have this mapping, and it is very different among them.

@jimklimov jimklimov added service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others Legrand Devices produced and/or branded by Legrand labels Aug 6, 2023
@jimklimov
Copy link
Member

jimklimov commented Aug 6, 2023

I think there were some discussions over time, recently too, that an "LB" state could be raised by the drivers generally (or by upsmon configured per host in other proposals) - based on available battery.charge or battery.runtime readings and respective (override.|default.)*.low settings. But I do not quickly see anything in current codebase to that effect, so probably a PR is welcome.

Alternatives per discussion could be to take a look at upssched and handling scripts you write that it would call, if it can do something in this regard (especially to ensure different charges/runtimes remaining to shut down different hosts based on their priority to you).

@ITPotatoo
Copy link
Author

I didnt get it, what i can try or configure to solve it ?
im sorry, im new to this NUT solution :)

@jimklimov
Copy link
Member

As a quick approach, I'd suggest investigating (googling) if upssched makes something like this possible, to work around UPSes/drivers that do not have a built-in way to report a low-power situation by customized settings.

I am a bit surprised to not see a built-in solution based on those measurements after the decades that NUT is out there, so maybe I'm missing or forgetting something (and/or spoiled by experience with more capable devices/drivers which did not need workarounds), but it seems that currently it is not there, or too well hidden :)

I'll ask if the mailing list users have fresher experience with that.

@jimklimov jimklimov added the Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved label Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Legrand Devices produced and/or branded by Legrand Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others service/daemon start/stop General subject for starting and stopping NUT daemons (drivers, server, monitor); also BG/FG/Debug Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved
Projects
Status: Todo
Development

No branches or pull requests

2 participants