UX-10: the last plain-language leftovers: log lines, two table rows, 'Why: Other', red at 0 s
- test_messages.py part 6: every dynamic part of a WARNING+ line is classified as data or as a built text, and every built text is produced by the real code and checked. This is the gap the 2d scan had: it counted `%s` as one word, so reasons built by loop_clamp_note() and friends were never seen. - Quoted reasons rewritten to STYLE.md (red-alarm shape, codes kept): OUTPUT_CLAMP, METER_FROZEN, CIRCULATING_POWER, STALE_READING, the peak guard (codes now PEAK_GUARD*), the migration report, price feed, price history and gate reasons. Plurals via messages.times()/count(). - Top table: Price history "96 prices over 24 hours for 26 Sep", Tariff "one every 15 minutes or every hour", "not final yet" dropped. - Levels and noise: per-cycle shadow line DEBUG, shadow on/off INFO, aiohttp access log only at log level debug, settings warnings once per start, one plain line per Home Assistant outage (hass.Outage). - INFO jargon and error texts: no "§8.3", ISO times, "banked", "keys ARE", "NOT_OBSERVED", "did NOT land", "AND". - Display bugs: WHY_WINNER covers every winner and safety reason (main.why_key(), part 7 finds them in the code); the meter row is amber "waiting for the first reading" inside its limit after a start; the missing-reading age is counted when the page asks. - STYLE.md and DECISIONS/UX-08-short-notifications.md (UX-10 section). No change to safety behaviour, alarm levels, notification ids, triggers, cadence or the banner cascade. One row colour changes (meter at start), justified in DECISIONS. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
125b0702a2
commit
23a3a3f5b5
@@ -315,6 +315,17 @@ def times(n) -> str:
|
||||
return "1 time" if int(n) == 1 else f"{int(n)} times"
|
||||
|
||||
|
||||
def count(n, noun, plural=None) -> str:
|
||||
"""`count(1, "price")` -> `1 price`, `count(3, "price")` -> `3 prices`."""
|
||||
return f"{int(n)} {noun if int(n) == 1 else plural or noun + 's'}"
|
||||
|
||||
|
||||
def when(at) -> str:
|
||||
"""`27 Sep at 09:15`, as the page writes a moment. `at` is already in the
|
||||
time zone the reader wants (the caller passes `price.brussels(t)`)."""
|
||||
return f"{at.day} {at:%b} at {at:%H:%M}"
|
||||
|
||||
|
||||
def for_unit(unit) -> str:
|
||||
"""` for inverter-b` on a site with several inverters, else nothing."""
|
||||
return f" for {unit}" if unit else ""
|
||||
@@ -383,6 +394,11 @@ def row_controller_stalled(age_s, veto_s) -> str:
|
||||
f"sets the inverter to 0 W after {seconds(veto_s)}.")
|
||||
|
||||
|
||||
def row_meter_waiting(limit_s) -> str:
|
||||
"""UX-10: no reading yet since the start, and still inside the limit."""
|
||||
return f"Meter: waiting for the first reading, limit {seconds(limit_s)}"
|
||||
|
||||
|
||||
def row_meter_stale(age_s, limit_s) -> str:
|
||||
return (f"Meter: no reading for {seconds(age_s)}, limit "
|
||||
f"{seconds(limit_s)}. The add-on log shows why.")
|
||||
@@ -766,6 +782,10 @@ WHY_WINNER = {
|
||||
"stopped": "Control is stopped",
|
||||
"inputs missing": "A reading is missing",
|
||||
"no claim was made": "Nothing asked for power",
|
||||
# UX-10: the claim reasons main.why_key() can return for a safety or
|
||||
# failsafe winner. test_messages.py part 7 finds every one in the code.
|
||||
"sign disagreement": "Safety stop, power went the wrong way",
|
||||
"unsplit": "The power could not be split, all at 0 W",
|
||||
}
|
||||
WHY_LIMIT = {
|
||||
"peak(quarter peak)": "the peak limit",
|
||||
@@ -898,6 +918,7 @@ def status_samples() -> list:
|
||||
("row_controller_ran", GREEN, row_controller_ran(2)),
|
||||
("row_controller_stalled", RED, row_controller_stalled(45, 30)),
|
||||
("row_meter_stale", RED, row_meter_stale(40, 10)),
|
||||
("row_meter_waiting", AMBER, row_meter_waiting(30)),
|
||||
("row_meter", GREEN, row_meter(-350, 2, 3, 340)),
|
||||
("row_meter_frozen", RED, row_meter_frozen()),
|
||||
*(("row_freeze_off", AMBER, row_freeze_off(k)) for k in FREEZE_OFF),
|
||||
|
||||
Reference in New Issue
Block a user