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

Update riello (ser, usb) for shutdown/reboot delays (Fixes #530) #1280

Merged
merged 4 commits into from
Feb 11, 2022

Conversation

geoghegan
Copy link
Contributor

This should address the issues in #530. Tested with an IDG1600

Output from upsc below

battery.capacity: 9
battery.voltage: 27.0
battery.voltage.nominal: 24
device.mfr: RPS S.p.a.
device.model: UNV1
device.serial:
device.type: ups
driver.name: riello_usb
driver.parameter.pollinterval: 2
driver.parameter.port: /dev/ttyUSB0
driver.parameter.synchronous: no
driver.version: 2.7.4-4547-gc911e825
driver.version.internal: 0.07
input.bypass.frequency: 409.50
input.bypass.voltage: 4095
input.frequency: 50.10
input.voltage: 240
output.frequency: 50.10
output.frequency.nominal: 50.0
output.L1.current: 0
output.L1.power: 0
output.L1.realpower: 0
output.L2.current: 0
output.L2.power: 0
output.L2.realpower: 0
output.L3.current: 0
output.L3.power: 0
output.L3.realpower: 0
output.power.percent: 0
output.voltage: 237
output.voltage.nominal: 230
ups.delay.reboot: 5
ups.delay.shutdown: 5
ups.firmware: SWM038-02-04
ups.load: 0
ups.mfr: RPS S.p.a.
ups.model: UNV1
ups.power.nominal: 1600
ups.productid: 5500
ups.realpower.nominal: 960
ups.serial:
ups.status: OL
ups.vendorid: 04b4

@jimklimov
Copy link
Member

Thanks, sorry for having missed that comment in #530 (comment)

Compared to the patch quoted there (from https://www.mail-archive.com/nut-upsdev@alioth-lists.debian.net/msg00106.html message) this PR misses the riello_ser.c fix to be on par. Would you please paste that one in also?

Additionally, the dstate assignment from unsigned int should not be formatted as %d but as %u, right?

drivers/riello_usb.c Outdated Show resolved Hide resolved
@geoghegan
Copy link
Contributor Author

@jimklimov PR updated - riello_ser amended and I fixed the formatting on riello_usb to take into account the unsigned ints (good catch, thanks!).

@jimklimov jimklimov changed the title Fixes #530 Update riello (ser, usb) for shutdown/reboot delays (Fixes #530) Feb 11, 2022
@NilByte
Copy link

NilByte commented Feb 11, 2022

Great to see these updates.

Is there a chance that this will also fix the problem on shutdown.return command reported in #957 ?

@geoghegan
Copy link
Contributor Author

It should address #957 as ups.delay.shutdown is no longer undefined / NULL in this PR.

@geoghegan
Copy link
Contributor Author

I had a look through the open issues - Looks like this PR may address #530 , #957, and at least a portion of #738

@geoghegan
Copy link
Contributor Author

geoghegan commented Feb 11, 2022

How do I set variables on the UPS itself, @jimklimov ?

e.g. if I want to set ups.delay.shutdown and ups.delay.reboot? My concern is the static definition of 5 seconds in this PR. I want to check that a user assigned override will actually pass through to the UPS.

I have attempted the following

./drivers/riello_usb -a ups -x ups.delay.reboot=10
Network UPS Tools - Riello USB driver 0.07 (2.7.4-4549-ga1572032)
Warning: This is an experimental driver.
Some features may not function correctly.


Fatal error: 'ups.delay.reboot' is not a valid variable name for this driver.

@jimklimov
Copy link
Member

I think the override.* namespace for arguments should help here, e.g. override.ups.delay.reboot = 10

@jimklimov jimklimov merged commit 3d04a01 into networkupstools:master Feb 11, 2022
@jimklimov jimklimov added the Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others label Feb 11, 2022
@geoghegan
Copy link
Contributor Author

Yep! I was able to set the override, and upsc shows the correct value when polling the UPS.

Thanks for the merge :-)

@NilByte
Copy link

NilByte commented Feb 12, 2022

@geoghegan Thanks for your effort. Appreciate it a lot. :)

I build NUT according to:

https://github.com/networkupstools/nut/wiki/Building-NUT-on-Debian,-Raspbian-and-Ubuntu

Unsupported parameters are gone as expected and new parameters ups.delay.reboot and ups.delay.shutdown now listed as expected.

upscmd -u <user> -p <password> <ups> shutdown.return is giving result OK

I can set new values for ups.delay.reboot and ups.delay.shutdown but as you experience, these don't survive a reboot. What worked for me as example was:

sudo /lib/nut/riello_usb -a <ups> -x override.ups.delay.reboot=10

Testing power failure however, doesn't end up cutting the power to the UPS as I had hoped it would, so at least for me it seems like the part on not powering off mentioned in #530 was not solved by this update.

Have you tested power failure and was the UPS finally powering off?

I also expected that it would now be possible to use offdelay and bootdelay in ups.conf to override defaults values of ups.delay.shutdown and ups.delay.reboot with this driver version, but as far as I experience setting these are not working.

What is working for me is to add to ups.conf:

[<ups>]
        driver = riello_usb
        port = auto
        desc = "Riello IDG400"
        override.ups.delay.shutdown = 14
        override.ups.delay.reboot = 7

Reload driver sudo upsdrvctl start

upsc result showing driver version

Init SSL without certificate database
battery.capacity: 7
battery.voltage: 13.5
battery.voltage.nominal: 12
device.mfr: RPS S.p.a.
device.model: UNV1
device.serial:
device.type: ups
driver.name: riello_usb
driver.parameter.pollinterval: 2
driver.parameter.port: auto
driver.parameter.synchronous: no
driver.version: 2.7.4-4609-g61862059
driver.version.internal: 0.07
input.bypass.frequency: 409.50
input.bypass.voltage: 4095
input.frequency: 50.00
input.voltage: 230
output.frequency: 50.00
output.frequency.nominal: 50.0
output.L1.current: 0
output.L1.power: 0
output.L1.realpower: 0
output.L2.current: 0
output.L2.power: 0
output.L2.realpower: 0
output.L3.current: 0
output.L3.power: 0
output.L3.realpower: 0
output.power.percent: 0
output.voltage: 226
output.voltage.nominal: 230
ups.delay.reboot: 7
ups.delay.shutdown: 14
ups.firmware: SWM038-01-02
ups.load: 0
ups.mfr: RPS S.p.a.
ups.model: UNV1
ups.power.nominal: 400
ups.productid: 5500
ups.realpower.nominal: 240
ups.serial:
ups.status: OL
ups.vendorid: 04b4

@NilByte
Copy link

NilByte commented Feb 16, 2022

#530 , #976 and #750 could probably also be closed now.

@jimklimov jimklimov added the Riello Riello UPS devices (serial, usb), usually with a variant of Qx protocol label Nov 13, 2023
@jimklimov jimklimov added this to the 2.8.0 milestone Nov 13, 2023
@jimklimov jimklimov added USB Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved labels Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Qx protocol driver Driver based on Megatec Q<number> such as new nutdrv_qx, or obsoleted blazer and some others Riello Riello UPS devices (serial, usb), usually with a variant of Qx protocol Shutdowns and overrides and battery level triggers Issues and PRs about system shutdown, especially if battery charge/runtime remaining is involved USB
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

None yet

3 participants