You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CodeRabbit review on PR #29 surfaced two real bugs and four
quality-of-life issues. All addressed in one commit; piggy-backs the
unrelated README badge restyle (Federico-requested) since it's
trivial.
Bugs fixed:
1. **voltage.py: reject wrong-side transfer points before clamping.**
A NUT driver reporting a high value (e.g., `input.transfer.low=250`)
in the LOW transfer field passed the existing ±25% sanity check
(|250-207|=43 ≤ 230×0.25=57.5) and produced `warning_low=255V` --
making perfectly normal 230V mains read as a brownout on every
poll. Symmetric bug on the high side (low value in high field
would yield warning_high=195V, below the 207V low warning, an
impossible band).
Fix: low_transfer must be < nominal AND high_transfer must be >
nominal before being accepted as a clamp candidate. Without the
guard, the bogus value is silently ignored and we fall back to
±10%. Added regression tests covering 250/230V on the low side and
200/230V on the high side, plus boundary cases (transfer == nominal
is also rejected).
2. **voltage.py: don't claim EN 50160 accepts the UPS switch threshold.**
The mild-event notification text said `UPS will not switch to
battery until 280.0V (firmware setting); EN 50160 considers up to
that level acceptable` -- which read as if EN 50160 sanctions 280V
on a 230V grid. EN 50160 actually caps at nominal × 1.1 (253V),
well below typical UPS switch points. The two are independent
thresholds with different purposes.
Fix: rewritten as `UPS will not switch to battery until 280.0V
(firmware setting); this is a grid-quality issue (outside the
EN 50160 ±10% envelope), not an imminent power loss.` -- accurate
to the spec and applies symmetrically to high and low events.
Updated the corresponding test_mild_overvoltage test to assert the
new wording AND that the buggy phrasing must NOT appear.
Quality-of-life:
3. **docs/notifications.md, docs/triggers.md: "non-severe" instead
of "10–15%".** With narrow UPS transfer points, the warning band
can be tighter than ±10%, so non-severe events can fire at less
than 10% deviation. The previous wording implied a fixed band.
4. **docs/triggers.md: replaced 122V-on-120V flap example.** 122V on
a 120V grid is +1.7%, well within the normal band -- it would NOT
trigger any warning, so it was a misleading example. Replaced with
105V (12.5% under, past the ±10% warning threshold but not severe).
5. **docs/triggers.md: language hint on new fenced code blocks.**
Added `text` to the log-output blocks for markdownlint MD040
compliance. Existing yaml/shell blocks unchanged.
6. **tests/e2e/groups/single-ups.sh Test 6: tightened assertions.**
The previous `grep -i "voltage\|brownout"` matched the startup
`Voltage Monitoring Active` line, so a regression that broke
BROWNOUT_DETECTED would still pass. Now requires the actual
`BROWNOUT_DETECTED` event marker AND the rc9 `% below nominal`
framing -- both as fail-closed `exit 1` instead of soft-warn.
README badge restyle (Federico-requested):
All 6 README badges switched to the dark/minimal `for-the-badge`
style with `labelColor=090909` and `color=e8e8ed` for visual
consistency. Codecov badge swapped from `codecov.io/...graph/badge.svg`
(no `for-the-badge` variant) to `img.shields.io/codecov/c/...` --
same data source, same link target, but now the style is honoured.
Codecov coverage % and PyPI version still display dynamically; only
their colour is overridden to keep the row uniform.
Tests: 747 -> 749 (+2 for the new transfer-side guards). All green.
Co-Authored-By: Claude Opus 4.7 <[email protected]>
0 commit comments