Well, the intention generally is to use it as a driver, so the more abilities the merrier (PR would be welcome) :)
Per comments to initial PR that added it, https://github.com/networkupstools/nut/pull/1044 : > The idea of introducing this driver is to enable creation and prototyping of smart UPS based on Arduino, which is inexpensive versatile platform very much suitable for custom fully open-source UPS development. I don't think it was supposed to end and be finished work at that point, but distractions happen... It might be worth asking @abratchik if he has something tinkered over this time and ready to upstream, as well. Jim Klimov On Sun, Nov 12, 2023, 22:46 Kelly Byrd <[email protected]> wrote: > I posted earlier on this list about getting an Arduino Pro Micro using > https://github.com/abratchik/HIDPowerDevice in a simple sketch to > monitor a DIY UPS I have built. With the changes from that thread (I had a > PR merged), I was able to get usbhid-ups to recognize my device and could > setup NUT the rest of the way. My intended configuration is to run NUT on a > Raspberry Pi, have that device be master and then have clients of that NUT > install take action when ACPresent goes from true to false. > > The problem I ran into is `upsc diyups@locahost` was always showing > ups.status as "OB". I ran tests and confirmed the raw reports > included "UPS.PowerSummary.PresentStatus.ACPresent correctly showing 1 and > 0 as appropriate as well as correctly reporting the > UPS.PowerSummary.PresentStatus.Charging > and UPS.PowerSummary.PresentStatus.Discharging bitfields. > > I traced the problem down to drivers/arduino.c. Apparently the Arduino > subdriver doesn't have an entry > for "UPS.PowerSummary.PresentStatus.ACPresent" in it's arduino_hid2nut[] > definition. The only sections present are commented as: > /* USB HID PDC defaults */ > > I my local source tree, I made changes to these entries copied from > another USB HID-based subdriver, to add: > /* USB HID UPS Status*/ > {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Charging", NULL, > NULL, HU_FLAG_QUICK_POLL, charging_info}, > {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.Discharging", NULL, > NULL, HU_FLAG_QUICK_POLL, discharging_info}, > {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.NeedReplacement", > NULL, NULL, 0, replacebatt_info}, > {"BOOL", 0, 0, "UPS.PowerSummary.PresentStatus.ACPresent", NULL, > NULL, HU_FLAG_QUICK_POLL, online_info}, > > and now everything works as expected! My question for this list is why > there were not included in the Arduino subdriver already? AFAICT, the > author of the HIDPowerDevice Arduino library added the Arduino subdriver > via a PR a few years ago along with basic support for the common Arduino > VID:PID combinations in other parts of the code. But, that same library > definitely reports more than > UPS.PowerSummary.DelayBeforeShutdown, UPS.PowerSummary.DelayBeforeStartup, > etc. > and the example code he gives primarily demonstrates how to report > ACPresent, Charging, and also remaining run time. > > Am I missing something? Is there a runtime config based way to instruct > NUT how to map ACPresent, Charging, etc HID statuses to NUT's specific > structure? Over on the GitHub for the other project, others have reported > success with NUT and Arduinos using that library, but I don't know what > "success" means to them. I can't see how it's actually useful without the > addition of the above lines. I'm probably missing the original intent. > > Any insight or advice is appreciated. If I'm on the right track, I'll do > another PR to add the above status flags (and others you all think are > important) to Arduino.c > > _______________________________________________ > Nut-upsdev mailing list > [email protected] > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev >
_______________________________________________ Nut-upsdev mailing list [email protected] https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsdev
