sysutils/nut: Added Nut widget
This is an (opinionated) widget for the Nut UPS plugin.
This is my first contribution, so I am happy to adjust or get any feedback.
@Monviech Thanks for your feedback. I'm not primarily a FE person, so it's useful! One issue since replacing the ajaxGet with the function from the Basewidget is that it's not returning any data. I know the UPS diagnostics can be a little slow, but I've tried it with some retries. Is there something obvious I am doing wrong here? I'll poke at it some more when I have a free minute.
Can you give me the json output of /api/nut/diagnostics/upsstatus then I can test the widget sometime later.
Also how long does the response take, longer than a second?
Cause when its really slow the action that gets the status might need to be cached.
https://github.com/opnsense/core/commit/06d507704ec6e4d97eddde2d5d08c056ec9f41c2
{"response":"battery.charge: 100\nbattery.charge.low: 10\nbattery.charge.warning: 20\nbattery.mfr.date: CPS\nbattery.runtime: 17475\nbattery.runtime.low: 300\nbattery.type: PbAcid\nbattery.voltage: 26.2\nbattery.voltage.nominal: 24\ndevice.mfr: CPS\ndevice.model: CP1500AVRLCD3\ndevice.serial: BHPNY7002755\ndevice.type: ups\ndriver.debug: 0\ndriver.flag.allow_killpower: 0\ndriver.name: usbhid-ups\ndriver.parameter.pollfreq: 30\ndriver.parameter.pollinterval: 2\ndriver.parameter.port: auto\ndriver.paramer.synchronous: auto\ndriver.state: quiet\ndriver.version: 2.8.2\ndriver.version.data: CyberPower HID 0.80\ndriver.version.internal: 0.53\ndriver.version.usb: libusb-1.0.0 (API: 0x1000102)\ninput.voltage: 121.0\ninput.voltage.nominal: 120\noutput.voltage: 121.0\nups.beeper.status: enabled\nups.delay.shutdown: 20\nups.delay.start: 30\nups.load: 0\nups.mfr: CPS\nups.model: CP1500AVRLCD3\nups.productid: 0601\nups.realpower.nominal: 900\nups.serial: BHPNY7002755\nups.status: OL\nups.test.result: No test initiated\nups.timer.shutdown: -60\nups.timer.start: -60\nups.vendorid: 0764\n\n\n"}
In the Service itself, the Diagnostics data takes 1-2 seconds to return.
Maybe try to set a cache_ttl here as linked in my prior post. Maybe 30s and see if it gets better. Unsure though.
https://github.com/opnsense/plugins/blob/64a38846959331313ac3b13a8484d267bf177c16/sysutils/nut/src/opnsense/service/conf/actions.d/actions_nut.conf#L25
Any updates on when this will be merged to production?
Thanks
I haven't had a chance to look at this again. I'll try to take a look this w/e.
@Monviech @fichtner @mimugmail This should now be ready for another review. I refactored it to be more like the other UPS plugin and that resolved the issues.
And I noticed someone else wrote another plugin. shrugs Choose whichever suits you.
@mimugmail , @jamtur01 - How do i use this in my opnsense?
It would be nice if this calculated the estimated load in watts
calculated the estimated load in watts
Sure. Done.
After internal discussion we merged #4188 -- it was a fifty fifty but a choice had to be made. Thanks for your contribution in any case. ❤️