News for hackers. Stuff that matters.
Re:Show HN: Monitor your el-cheapo UPS via SNMP by AstroNoise58 on Sunday March 14, 2021 @08:10AM (#26454660)
Not sure what problem you see with that, care to elaborate and/or open an issue?
Re:Show HN: Monitor your el-cheapo UPS via SNMP by readflaggedcomm on Sunday March 14, 2021 @12:45PM (#26456698)
It never returns 1, and returns 4 in two cases. This varies from the comment before the function, which I presume documents return values (though at first glance I thought the "name(number)" format was a function call example).
Re:Show HN: Monitor your el-cheapo UPS via SNMP by AstroNoise58 on Sunday March 14, 2021 @02:25PM (#26457497)
Oh, ok, I guess that might be a bit confusing. :)

The comment documents the interpretation (by the UPS MIB) of possible return values. The same is true for the surrounding few functions (upsAutoRestart, upsBeeperStatus and upsOutputSource) that are similar in form and purpose. Obviously, there is no requirement that all possible output values are generated (exactly once or at all).

The function upsBatteryStatus returns 4 in two cases, because in both of those cases the battery is deemed 'depleted'. And it does not return 1 because there is no input case from upsc (that I know of, at least) where it would make sense to report the battery status as 'unknown'.