diff --git a/STYLE.md b/STYLE.md new file mode 100644 index 0000000..7bbb891 --- /dev/null +++ b/STYLE.md @@ -0,0 +1,48 @@ +# STYLE.md - how user-facing text is written (UX-08) + +This applies to everything a home owner or installer reads: notifications, phone pushes, the add-on page, refusals, add-on log lines at WARNING and above, and the names and descriptions of options. It is enforced by `goodwe_controller/test_messages.py`. Kinds that have not been rewritten yet are on its allowlist, and that allowlist only shrinks. + +## 1. Shape +- **Title**: at most 5 everyday words. It says what is wrong ("Meter reading may be stuck"). No "GoodWe:" prefix, no full stop. +- **Body**: **one sentence** of at most 25 words, saying what happened and what to do. A **red alarm** may use up to **3 sentences** (70 words, each sentence at most 30 words), so that no action a person must take is lost. +- **Details**: the last line links to the add-on documentation and names the section with the rest: `Details: add-on documentation, section "" under Notifications.` Background, figures, reason codes and history go there or into the log, never into the body. +- **Status row**: at most 15 words. **Banner**: at most 12 words. **Refusal**: at most 30 words, naming the setting by its label. **Option name**: at most 6 words, not counting the group prefix. **Option description**: at most 30 words. Where a value comes from belongs in DOCS.md. +- **Log line** (WARNING/ERROR): one line, at most 25 words. The reasoning goes on a DEBUG line. Log lines stay in English and are not translated. +- **Sentences**: one idea each, active voice, present tense, with nothing nested in brackets and no semicolons (a semicolon is a second sentence in disguise). These translate well into Dutch and French. + +## 2. Numbers +Use a number only if it helps the reader act, for example the peak limit, or what was asked and what was sent in a fault report. Write it the way `app/messages.py` does: `5 000 W`, `20 %`, `10 minutes`, `14:05`. + +## 3. Severity +Severity is shown by the title and the colour, never by CAPITALS or by words like "BUG SIGNAL". + +| Level | Colour | When | +|---|---|---| +| alarm | red | Control stopped, money or energy lost now, a fault, or a person must act now. Up to 3 sentences. | +| warning | orange | Control is still running, but something needs a look. 1 sentence. | +| info | grey | No action needed. 1 sentence. | +| resolved | green | An earlier alarm or warning has cleared. 1 sentence. | + +A rewrite never changes an alarm's severity, `notification_id` or cadence. + +## 4. Words - the same word for the same thing everywhere +| Say | Not | +|---|---| +| battery | pack, BMS pack | +| inverter, or its name | unit, device, actuator | +| controller | loop, planner | +| meter | P1 feed, telegram | +| peak limit / this month's peak | ceiling, capaciteitstarief, billed quarter | +| 15-minute period | quarter | +| battery level | SoC, state of charge | +| cut-out level | BMS floor, `bms_soc_floor` | +| peak reserve | `peak_soc_floor`, EMS floor | +| inverter rating | `max_w`, rail | +| control is stopped / every inverter is set to 0 W | failsafe, trip, latch, parked | +| software fault | BUG SIGNAL | +| control board | master, ESP32 | +| shadow mode | a mode that makes every decision but commands 0 W. The name is kept. | + +**Banned in titles and bodies** (the test fails on them): SAFETY-/TARIFF-/TEL-/CFG-/FW-/HW-nn and other card ids, integrator, anti-windup, windup, clamp, clamped, saturated, BUG SIGNAL, latch, latched, arbiter, allocator, register, `0x…`, layer 1/2/3, heartbeat, watchdog, telegram, ACK, CRC, OTA, Modbus, planner, `§n`, file names, IP addresses, option keys in snake_case, **HA entity ids**, and runs of 2 or more CAPITALISED words. + +HA entity ids are allowed only in refusals and validator messages, where the installer has to find that entity. They are never allowed in alarms or status rows. diff --git a/goodwe_controller/DECISIONS/UX-08-short-notifications.md b/goodwe_controller/DECISIONS/UX-08-short-notifications.md new file mode 100644 index 0000000..488a082 --- /dev/null +++ b/goodwe_controller/DECISIONS/UX-08-short-notifications.md @@ -0,0 +1,14 @@ +# UX-08 phase 2a: short notifications, and what moved out of them + +The owner decided on 2026-09-27: a title of at most about 5 everyday words and a one-sentence body. A red safety alarm may use up to 3 sentences, so no action-relevant information is lost. Titles are neutral, with no "GoodWe:" prefix. HA entity ids appear only in refusals. The rule is `STYLE.md` at the repository root, the texts are in `app/messages.py`, and `test_messages.py` enforces both. The detail each notification used to carry is in DOCS.md under "Notifications", and the body links to it. + +**Unchanged:** every `notification_id`, every trigger and cadence (edges, SAFETY-34 re-announce, per-unit ids), every log line and every status row. The status banner and rows are phase 2b, refusals and option texts 2c, logs 2d; `ux08_allowlist.txt` lists them until then. + +## Where a choice was made +1. **Severity of "not delivering" (SAFETY-42).** The notification is an *alarm*, so it may use 3 sentences. Its log line is ERROR and the alarm is latched. The page banner stays amber, as SAFETY-42 decided, because control keeps running; the two answer different questions (is control running / must a person act) and HA shows no colour on a notification. The three checks stay in their original order. Clearing it takes stop then start, and the body says so. +2. **Figures left the bodies** of the frozen-meter card (the rail and the command), the circulating-power card (the watts and the time window) and the peak cards (the projection). None of them is needed to act, and all of them are still in the reason text that the log line and the status row carry. `test_freeze.py` and `test_watchdog.py` now pin that. The frozen-meter card can therefore no longer quote a wrong rail (SAFETY-20), because it quotes none. +3. **The over-rating alarm keeps its numbers** (asked, sent, and which limit cut it), because they are what a fault report needs. `ClampWatchdog.facts` carries them under the same keep-the-bug rule as `reason`, so the words and the numbers always describe the same tick, with asked before sent (SAFETY-40, `test_clamp.py` part 6). +4. **SAFETY-25 stays in the peak-reserve alarm** as its last sentence ("the reserve only limits peak shaving … down to its cut-out level"). The alarm now gives each branch its own action: at the reserve, lower it; battery level unread, check the sensor; floor unknown, set the cut-out level. That last branch is `soc_floor is None`, which happens when an inverter's cut-out level is missing, not the peak reserve (that option always has a value). Before, every branch said "lower peak_soc_floor". The title, "Battery stopped limiting the peak", is true on all three branches. +5. **SAFETY-32 at a roster of one.** The body no longer ends in a separate "WHICH PACK" paragraph. The pack's name is part of the first sentence ("The battery of inverter-b …"), and at a roster of one that is the only difference. +6. **Dropped as background, now in DOCS:** "charging stays blocked" (peak reserve), "why no other guard fired" (circulating power, not delivering), and the saturation-freeze distinction (over-rating). "The meter cannot see this" stays in the circulating-power card, as the owner asked. +7. **The Details link** opens the add-on's documentation page (`/hassio/addon/<slug>/documentation`, with the slug taken from the container hostname) and names the section. A `#heading` anchor was not used because nobody has checked that Home Assistant's documentation tab renders heading ids; if it does, adding one is a one-line change. Outside an add-on container it names the section without a link. diff --git a/goodwe_controller/DOCS.md b/goodwe_controller/DOCS.md index a4a7faf..6260c62 100644 --- a/goodwe_controller/DOCS.md +++ b/goodwe_controller/DOCS.md @@ -2802,6 +2802,126 @@ it. | `estop_fitted` | Whether the RS485 e-stop is installed. Drives the warning banner | | `log_level` | `trace`/`debug`/`info`/`warning`/`error` | +## Notifications + +Each Home Assistant notification this add-on raises has a short title, one +sentence (a red alarm may use three), and a **Details** link to the add-on +documentation that names the section below. This section holds what the +notification leaves out. The wording rule is `STYLE.md` in the repository; the +texts live in `app/messages.py`. Every notification keeps a fixed +`notification_id`, so a repeat replaces the card instead of adding one. + +| Title | Severity | id | +|---|---|---| +| Battery is not keeping up | warning | `goodwe_integrator_bound` | +| Power request too high | alarm | `goodwe_output_clamp` | +| Load too high for battery | alarm | `goodwe_peak_saturated` | +| Battery stopped limiting the peak | alarm | `goodwe_peak_soc_floor` | +| Inverters working against each other | alarm | `goodwe_circulating_power` | +| *name* is not delivering | alarm | `goodwe_not_delivering_<name>` | +| Meter reading may be stuck | alarm | `goodwe_meter_frozen` | + +### Battery is not keeping up + +The grid-following loop's integrator reached its anti-windup bound +(`integrator_max_w`): the controller has been asking for more than the battery +delivers for a while. This is SAFETY-40, and it is **not** a fault. No command +went over the rating and control keeps running. Short spells after a big load +or solar step are normal. If it keeps coming back, check that the battery +follows its commands. The bound and the command of that tick are in the add-on +log (WARNING, reason code `OUTPUT_CLAMP`). See *The winding-loop alarm* for the +full story. + +### Power request too high + +The controller computed a command above a limit, and the command was cut to that +limit before it was written. The notification names what was asked, what was +sent, and which limit cut it: the configured inverter rating (`max_w`), the +inverter's own limit (the setpoint device's range), or the inverter rating on +the loop side. Asked always comes first. This is a **software fault** (the old +wording was "BUG SIGNAL"). It is not the inverter failing to follow a legal +command, which is the saturation freeze and does not alarm. Control keeps +running. Report it with the add-on log, whose ERROR line carries the reason code +`OUTPUT_CLAMP` and the full figures. See *The winding-loop alarm*. + +### Load too high for battery + +The capacity-peak guard (SAFETY-07) is asking for everything the inverter can +discharge, and the running 15-minute average is still projected over the peak +limit. That 15-minute period will set or raise the month's billed peak +(capaciteitstarief). The controller is not at fault: the house load is larger +than the inverter. Switching off load in the next few minutes is the only thing +that still changes the bill. The projection and the watts are in the add-on log +and on the status page. See *The capacity-peak guard*. + +### Battery stopped limiting the peak + +Two words in this notification are settings. The **peak reserve** is +*Peak guard will not discharge below (%)* (`peak_soc_floor`). The +**cut-out level** is *Battery cut-out level (%)* (`bms_soc_floor`), where the +battery's own system stops discharging. + +The peak guard wanted to discharge to hold the 15-minute peak, but it may not go +below the peak reserve (`peak_soc_floor`, SAFETY-24). It also stops when the +battery level cannot be read, or when an inverter's cut-out level is not set, +because the reserve is graded against it. So this 15-minute +period will go over the peak limit and set or raise the month's billed peak. +Charging from the grid stays blocked meanwhile. On a site with several inverters +the notification names the battery at its limit (SAFETY-32): each battery is +graded against its own cut-out level (`bms_soc_floor`), and raising the other +batteries' settings will not change this one. + +⚠️ **The reserve binds the peak guard only (SAFETY-25).** It is not a +whole-battery reserve. Ordinary self-consumption has no such floor and goes on +discharging below it, down to the battery's own cut-out level. See *What +`peak_soc_floor` does not protect*. + +### Inverters working against each other + +Two inverters were pushing power into each other: one discharging while another +charged (SAFETY-31). **The meter cannot see this.** The two flows cancel at the +P1 meter, so the site reads idle while both batteries cycle through two +conversion stages. Every other guard reads that net figure, so none of them +fires. The add-on has **stopped control and commands 0 W on every inverter**. +If the grid reading does not move after that, one inverter is no longer +listening to the add-on; this has happened on this hardware, once for +6 h 25 min. Switch the inverters off at the isolator. The alarm is latched: a +Home Assistant or add-on restart does not clear it, and the card is raised +again every 5 min until you start control on the add-on page. The watts and the time +window are in the add-on log and on the status page. See *The circulating-power +alarm*. + +### An inverter is not delivering + +One inverter has stood well short of its share of the site target for longer +than the hold time (SAFETY-42), while the others have not. No other check sees +this. A unit at 0 W is absent rather than pushing the wrong way, so the per-unit +sign check and the circulation check stay quiet. **Nothing is commanded +differently.** The guard only reports: commanding an inverter that has stopped +listening achieves nothing, and the only fallback the add-on has is +all-or-nothing. The other inverters keep regulating, and the site is short by up +to the missing unit's rating. Check, in this order: + +1. Is the inverter answering on RS485 at all? +2. Is its battery colder or emptier than its configured cut-out level + (`bms_soc_floor`) says? If so, that setting does not describe this battery. +3. Is anything else writing to it? + +The alarm is latched and survives restarts. Control is still running, so to +clear it, press *Start / stop control* twice (stop, then start) once you know +why. See *A unit that stops DELIVERING is a third fault again*. + +### Meter reading may be stuck + +The meter keeps answering, but its value has not changed for longer than the +hold time while the command stands at the power limit (SAFETY-18). The loop is +regulating against a number that has stopped moving. The age is still fresh, so +no other guard stops it. This is an alarm only: control keeps running and keeps +following the reading. Held for a whole 15-minute period, it can set the month's +billed peak. Check the meter; if it is stuck, stop control on the add-on page. +The limit and command figures are in the add-on log and on the status page. See +*The frozen-meter alarm*. + ## The Web UI The ingress panel shows live values, why the controller is commanding what it diff --git a/goodwe_controller/app/clamp.py b/goodwe_controller/app/clamp.py index e25a704..9f8bda7 100644 --- a/goodwe_controller/app/clamp.py +++ b/goodwe_controller/app/clamp.py @@ -362,6 +362,9 @@ class ClampWatchdog: self.since: datetime | None = None self.last_alarm: datetime | None = None self.reason = "" + # UX-08: the numbers behind `reason`, for the notification - set under + # the same rule as `reason`, so both always describe the same tick. + self.facts = () self.clean_cycles = 0 # SAFETY-41. Consecutive engaged cycles, and whether THIS episode has # spoken yet - the two the escalation clause needs. @@ -386,7 +389,7 @@ class ClampWatchdog: return True def note(self, engaged: bool, reason: str, now: datetime, - bug: bool = True) -> bool: + bug: bool = True, facts=()) -> bool: """Advance one cycle. True when the caller should raise the alarm. `now` is the caller's clock, the same discipline as @@ -408,6 +411,7 @@ class ClampWatchdog: self.bug_spoken = False if bug or not self.bug: self.reason = reason + self.facts = tuple(facts) self.bug = self.bug or bug if bug and not self.bug_spoken and self._due(self.last_bug_alarm, now): return self._speak(now, True) @@ -465,6 +469,7 @@ class ClampWatchdog: # above. The episode ends; the notification budget does not reset # with it. self.reason = "" + self.facts = () self.bug = False self.clean_cycles = 0 return False diff --git a/goodwe_controller/app/main.py b/goodwe_controller/app/main.py index e8160d4..0a10050 100644 --- a/goodwe_controller/app/main.py +++ b/goodwe_controller/app/main.py @@ -53,6 +53,7 @@ from .clamp import ( clamp_to_rating, is_commandable, loop_clamp_note, ) from . import freshness +from . import messages from .freeze import ( FreezeWatchdog, FreezeWatchdogConfig, looks_frozen, rail_unreachable, rail_w, ) @@ -997,6 +998,8 @@ class Controller: # the value a clamp bit is a value written to ONE device. # (engaged, note, over_rating) - SAFETY-40 splits the last one out. self.loop_clamped: tuple[bool, str, bool] = (False, "", False) + # UX-08: the numbers of a loop-side over-rating, for the notification. + self.loop_clamp_facts: tuple = () self.stopping = False # SAFETY-61. time.monotonic() at the end of the last run_control() pass. self.loop_pass_mono = None @@ -3280,6 +3283,9 @@ class Controller: loop_clamp_note(decision), decision.clamped, ) + self.loop_clamp_facts = ( + (messages.Clamp(None, decision.requested_w, decision.clamped_w, + "rating"),) if decision.clamped else ()) # SITE. compute() regulates `grid_w` - the P1 measurement - to # zero. Its subject is the meter, and §6.2's architecture is ONE # integrator on P1 whose output is then SPLIT. This is the claim the @@ -3303,6 +3309,7 @@ class Controller: # rather than letting the last value stand is what makes the alarm # de-assert when control is stopped. self.loop_clamped = (False, "", False) + self.loop_clamp_facts = () # SAFETY-28. A new resolution is a new tick, and the previous record is # stale from this line onwards. Incremented BEFORE resolve() so that the @@ -3726,10 +3733,17 @@ class Controller: if engaged_write: reason = (", ".join(f"{inv.name}: {inv.clamp_last.describe()}" for inv in clamped_units) + ". " + CLAMP_BUG_SIGNAL) + _named = len(self.inverters) > 1 + facts = [messages.Clamp(inv.name if _named else None, + inv.clamp_last.requested_w, + inv.clamp_last.applied_w, + inv.clamp_last.bound) + for inv in clamped_units] else: reason = loop_note if engaged else "" + facts = self.loop_clamp_facts if engaged else () fired = self.clamp_wd.note(engaged, reason, datetime.now(timezone.utc), - bug=bug) + bug=bug, facts=facts) # --- THE ACTION LOG, AND IT IS COALESCED PER EPISODE ------------------ # Every engagement is recorded, but consecutive ones are recorded by @@ -3766,14 +3780,8 @@ class Controller: # it can never replace a BUG SIGNAL notice still on screen. _LOG.warning("SAFETY-03 - %s Engagements so far: %d.", self.clamp_wd.reason, self.clamp_wd.engagements) - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_integrator_bound", - "title": "GoodWe: the control loop is at its integrator bound", - "message": (f"{self.clamp_wd.reason}\n\nNo command exceeded " - f"the rating and the controller is STILL RUNNING. " - f"See the add-on documentation, 'The winding-loop " - f"alarm'."), - }) + await self.hass.call("persistent_notification", "create", + messages.loop_bound().data()) return _LOG.error( "SAFETY-03 - %s Silently clipping this is how a winding integrator " @@ -3785,16 +3793,10 @@ class Controller: # A fixed notification_id, for the reason check_meter_frozen() gives - # and a DIFFERENT one from every other alarm this add-on raises, because # a clamp is not a frozen meter and neither is a saturation freeze. - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_output_clamp", - "title": "GoodWe: a computed setpoint exceeded the rating", - "message": ( - f"{self.clamp_wd.reason}\n\nThe command has been clamped and " - f"the controller is STILL RUNNING. This is NOT the inverter " - f"failing to follow a legal command (that is the saturation " - f"freeze, which is normal and does not alarm) - the value asked " - f"for was itself out of range."), - }) + # UX-08: the words are messages.output_clamp()'s; the numbers are the + # ones `reason` was written from (ClampWatchdog.facts), asked first. + await self.hass.call("persistent_notification", "create", + messages.output_clamp(self.clamp_wd.facts).data()) async def check_peak_saturated(self) -> None: """SAFETY-07. Alarm ONLY when the guard has run out of inverter. @@ -3836,18 +3838,8 @@ class Controller: # A fixed notification_id, and a DIFFERENT one from every other alarm # here - check_meter_frozen() gives the reasoning. A saturated peak guard # is not a frozen meter and is not an out-of-range setpoint. - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_peak_saturated", - "title": "GoodWe: the capacity-peak guard has run out of inverter", - "message": ( - f"{g.reason}.\n\nThe battery is being commanded to everything " - f"it can give and the quarter is STILL projected over the " - f"{g.ceiling_w:.0f} W ceiling, so this quarter will set or raise " - f"the month's billed capaciteitstarief peak. This is not a " - f"controller fault - the load is simply larger than the " - f"inverter. Shedding load in the next few minutes is the only " - f"thing that changes the bill."), - }) + await self.hass.call("persistent_notification", "create", + messages.peak_saturated(g.ceiling_w).data()) async def check_peak_floor_limited(self) -> None: """SAFETY-24. Alarm when the EMS SoC floor stops the guard shaving. @@ -3912,45 +3904,23 @@ class Controller: # think the pack is AT it. `decide()` guards its own reason string the # same way; a f-string that formats a None here would turn the one # notification that matters into a traceback. - _at_floor = ("at the floor" if g.soc_floor is None - else f"at {float(g.soc_floor):.0f} %") # ⚠️ SAFETY-32. WHICH PACK STOPPED THE SITE. `g.soc_floor` is the floor # the decision was actually taken with, so this re-grades nothing and # cannot disagree with the alarm it is printed inside. At a roster of one - # the sentence is omitted entirely and this notification is byte-for-byte - # what SAFETY-25 shipped - there is exactly one pack and naming it would - # be noise on every existing install. + # no pack is named - there is exactly one. _blocked = [name for name, why in peakguard.pack_permissions(self.packs, g.soc_floor) if why is not None] - _which = ("" if len(self.inverters) < 2 else - f"\n\nSAFETY-32 - WHICH PACK: this is graded per pack against " - f"that pack's own BMS cut-out (bms_soc_floor), and the " - f"pack(s) at or below their own floor right now are " - f"{', '.join(_blocked) if _blocked else '(none - see the reason above)'}" - f". The other packs on the roster are not the reason the guard " - f"stopped and raising their cut-out will not change this.") - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_peak_soc_floor", - "title": "GoodWe: the capacity-peak guard has run out of battery", - "message": ( - f"{g.reason}.\n\nTHIS QUARTER WILL GO OVER THE " - f"{g.ceiling_w:.0f} W ceiling and will set or raise the " - f"month's billed capaciteitstarief peak, because the peak guard " - f"is not allowed to discharge any further: {g.soc_floor_reason}." - f" This is not a controller fault - it is the EMS-side energy " - f"floor (peak_soc_floor) doing what it is set to do, and it sits " - f"deliberately above the pack's own BMS cut-out. Charging stays " - f"blocked. Shedding load is the only thing that changes the bill " - f"now; if this pack can afford a deeper discharge, lower " - f"peak_soc_floor.\n\nSAFETY-25 - WHAT THIS FLOOR IS NOT: " - f"peak_soc_floor bounds THE PEAK GUARD ONLY. It is not a " - f"pack-wide reserve, and the battery is NOT being held " - f"{_at_floor} - ordinary self-consumption has no SoC " - f"floor at all and will go on discharging past it, down to the " - f"pack's own BMS cut-out. What has stopped is the guard buying " - f"you a lower bill, not the pack being spent." + _which), - }) + # ⚠️ SAFETY-25's sentence (the reserve binds the peak guard only) is + # part of messages.peak_reserve() on every branch, the unreadable-SoC + # one included. + await self.hass.call("persistent_notification", "create", + messages.peak_reserve( + g.ceiling_w, soc_unread=g.soc is None, + floor_unknown=(g.soc is not None + and g.soc_floor is None), + packs=(_blocked if len(self.inverters) > 1 + else ())).data()) async def check_circulating(self) -> None: """SAFETY-31 + SAFETY-34. The alarm, and it must survive a restart. @@ -3989,36 +3959,13 @@ class Controller: names = self.units pos, neg = opposing([inv.batt for inv in self.inverters], min_w=self.circ_wd.cfg.min_w / 2.0) - who = "" - if pos and neg: - who = ("\n\nRight now " + ", ".join(names[i] for i in pos) - + " is discharging while " + ", ".join(names[i] for i in neg) - + " charges.") # A fixed notification_id, and a DIFFERENT one from every other alarm - # this add-on raises - check_meter_frozen() gives the reasoning. A - # circulating loop is not a frozen meter, is not an out-of-range - # setpoint and is not a saturated peak guard. - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_circulating_power", - "title": "GoodWe: the inverters are pushing against each other", - "message": ( - f"{self.circ_wd.reason}{who}\n\nTHE METER CANNOT SEE THIS. " - f"Circulating power nets to zero at P1, so the site reads idle " - f"while the packs are cycled through two conversion stages " - f"continuously. Every other guard in this add-on is a consumer " - f"of that net figure, which is why none of them fired.\n\n" - f"CONTROL HAS BEEN STOPPED - every inverter is commanded 0 W " - f"and held there. That removes this controller as one of the " - f"two participants, and it makes anything still happening " - f"VISIBLE at the meter instead of cancelled at it.\n\n" - f"⚠️ IF THE GRID READING DOES NOT MOVE AFTER THIS, one inverter " - f"is no longer listening to this add-on and no command will " - f"reach it - that has happened twice on this hardware, once for " - f"6 h 25 m. The remaining actuator is a human at the isolator.\n" - f"\nThis alarm survives a Home Assistant restart. Restarting " - f"will not clear it; start control from the add-on UI once you " - f"know why two inverters were opposing."), - }) + # this add-on raises - check_meter_frozen() gives the reasoning. + await self.hass.call("persistent_notification", "create", + messages.circulating( + [names[i] for i in pos] if pos and neg else (), + [names[i] for i in neg] if pos and neg else (), + ).data()) def _reannounce_due(self, notification_id: str) -> bool: """SAFETY-34: has this latched alarm gone REANNOUNCE_S without being re-asserted?""" @@ -4075,38 +4022,8 @@ class Controller: # surface is best-effort by design. self._delivery_announced.add(inv.name) self._announced_mono[nid] = _mono() - peers = ", ".join(n for n in names if n != inv.name) or "no sibling" - await self.hass.call("persistent_notification", "create", { - "notification_id": nid, - "title": f"GoodWe: {inv.name} is not delivering its share", - "message": ( - f"{inv.delivery_wd.reason}\n\nWHY NOTHING ELSE SAID SO. A " - f"unit sitting at 0 W against a non-zero share is not " - f"pushing the wrong way, it is ABSENT: the per-unit sign " - f"check needs opposition on both sides of " - f"{self.unit_sign_cfg.min_w:.0f} W and never opens, the " - f"site sum still agrees with the meter in " - f"direction, and circulating power is exactly zero when one " - f"unit does nothing. The only other trace is a saturation " - f"freeze, which this add-on's own code calls an alarm " - f"operators learn to ignore.\n\nNOTHING HAS BEEN COMMANDED " - f"DIFFERENTLY. This guard reports and does not act. " - f"Commanding an inverter that has stopped listening " - f"achieves nothing - that has happened on this hardware, " - f"once for 6 h 25 m - and the only re-allocation this " - f"add-on can express is all-or-nothing, which would throw " - f"away the output of a unit that is delivering PART of its " - f"share. So {peers} is still regulating and the site is " - f"short by up to {inv.rating_w():.0f} W until somebody " - f"looks at {inv.name}.\n\nWHAT TO CHECK, in order: is " - f"{inv.name} answering on RS485 at all; is its pack colder " - f"or emptier than its configured bms_soc_floor says (if it " - f"is, that setting does not describe this battery and this " - f"alarm is telling you so); and is anything else writing to " - f"it.\n\nThis alarm survives a Home Assistant restart. " - f"Restarting will not clear it; start control from the " - f"add-on UI once you know why."), - }) + await self.hass.call("persistent_notification", "create", + messages.not_delivering(inv.name, slug).data()) async def check_meter_frozen(self) -> None: """SAFETY-18. Alarm on a meter that answers forever without changing. @@ -4144,14 +4061,8 @@ class Controller: # ⚠️ A fixed notification_id, so a second episode REPLACES the first # rather than stacking. An operator who has to dismiss eleven identical # notifications learns to dismiss the twelfth without reading it. - await self.hass.call("persistent_notification", "create", { - "notification_id": "goodwe_meter_frozen", - "title": "GoodWe: the P1 meter may be frozen", - "message": ( - f"{self.freeze_wd.reason}.\n\nThe controller is STILL RUNNING " - f"and still following this reading. Check the meter; if it is " - f"stuck, stop control from the add-on UI."), - }) + await self.hass.call("persistent_notification", "create", + messages.meter_frozen(unchanged).data()) # -- tasks --------------------------------------------------------------- # -- OPT-04: the background tariff refresh ------------------------------- diff --git a/goodwe_controller/app/messages.py b/goodwe_controller/app/messages.py new file mode 100644 index 0000000..b1682d7 --- /dev/null +++ b/goodwe_controller/app/messages.py @@ -0,0 +1,250 @@ +"""Every Home Assistant notification this add-on raises, in plain words (UX-08). + +The rule is `STYLE.md` at the repository root; `test_messages.py` enforces it. +Titles, bodies and severities live here and nowhere else, so `main.py` only +decides WHEN to raise a notice and this file decides WHAT it says. The detail +that used to fill the bodies is in DOCS.md, under "Notifications", one section +per title; the body ends with a link to it. +""" + +import os +import re +from dataclasses import dataclass + +# Severity (STYLE.md section 3). An ALARM may use up to three sentences so +# that no action a person must take is lost; everything else gets one. +ALARM, WARNING, INFO, RESOLVED = "alarm", "warning", "info", "resolved" + +DOCS_SECTION = "Notifications" + + +def watts(value) -> str: + """`7412` -> `7 412 W`: a magnitude, grouped for reading, no sign.""" + return f"{abs(float(value)):,.0f} W".replace(",", " ") + + +def duration(seconds) -> str: + s = float(seconds) + if s < 120: + return f"{s:.0f} seconds" + return f"{s / 60:.0f} minutes" + + +def names(items) -> str: + items = list(items) + if len(items) <= 1: + return "".join(items) + return ", ".join(items[:-1]) + " and " + items[-1] + + +def addon_slug() -> str | None: + """This add-on's Supervisor slug, from the container hostname. + + The Supervisor names an add-on's host after its slug with `_` spelled `-` + (`local_goodwe_controller` -> `local-goodwe-controller`). Anything else, + e.g. a test run, gets no link rather than a wrong one. + """ + host = os.environ.get("HOSTNAME", "") + if re.fullmatch(r"[a-z0-9]+-goodwe-controller", host): + return host.replace("-", "_") + return None + + +def details(title: str) -> str: + where = f"section “{title}” under {DOCS_SECTION}" + slug = addon_slug() + if slug is None: + return f"Details: add-on documentation, {where}." + return (f"Details: [add-on documentation](/hassio/addon/{slug}/documentation)," + f" {where}.") + + +@dataclass(frozen=True) +class Notice: + id: str + severity: str + title: str + body: str + section: str = "" # the DOCS.md heading, when it is not the title itself + + @property + def docs(self) -> str: + return self.section or self.title + + def data(self) -> dict: + """The `persistent_notification.create` payload.""" + return {"notification_id": self.id, "title": self.title, + "message": f"{self.body}\n\n{details(self.docs)}"} + + +# --- the catalogue ---------------------------------------------------------- +# Each title below is also a DOCS.md heading (test_messages.py checks it). + +T_LOOP_BOUND = "Battery is not keeping up" +T_OUTPUT_CLAMP = "Power request too high" +T_PEAK_SATURATED = "Load too high for battery" +T_PEAK_RESERVE = "Battery stopped limiting the peak" +T_CIRCULATING = "Inverters working against each other" +T_NOT_DELIVERING = "{unit} is not delivering" +S_NOT_DELIVERING = "An inverter is not delivering" +T_METER_FROZEN = "Meter reading may be stuck" + +ID_LOOP_BOUND = "goodwe_integrator_bound" +ID_OUTPUT_CLAMP = "goodwe_output_clamp" +ID_PEAK_SATURATED = "goodwe_peak_saturated" +ID_PEAK_RESERVE = "goodwe_peak_soc_floor" +ID_CIRCULATING = "goodwe_circulating_power" +ID_NOT_DELIVERING = "goodwe_not_delivering_{slug}" +ID_METER_FROZEN = "goodwe_meter_frozen" + +# Which limit cut a command (clamp.ClampResult.bound, plus the loop's own). +LIMIT_WORDS = { + "max_w": "the configured inverter rating", + "device": "the inverter's own limit", + "max_w+device": "the configured inverter rating and the inverter's own limit", + "rating": "the inverter rating", +} + + +def loop_bound() -> Notice: + """SAFETY-40: the integrator bound. Normal in short bursts; not a fault.""" + return Notice(ID_LOOP_BOUND, WARNING, T_LOOP_BOUND, + "The battery cannot give what the controller asks, which is " + "normal for a moment but needs a check if it keeps happening.") + + +@dataclass(frozen=True) +class Clamp: + """One command that was cut: what was asked, what was sent, and by what.""" + unit: str | None + asked_w: float + sent_w: float + limit: str # a key of LIMIT_WORDS + + +def output_clamp(clamps) -> Notice: + """SAFETY-03: a computed command above the limit. A software fault. + + Asked comes before sent, always - reading them the other way round turns + the alarm backwards (test_clamp.py part 6). + """ + if not clamps: + return Notice(ID_OUTPUT_CLAMP, ALARM, T_OUTPUT_CLAMP, + "The controller asked for more power than the inverter " + "rating and was cut back. Control is still running. This " + "is a software fault, so please report it to your " + "installer.") + c = clamps[0] + who = f"For {c.unit}, the" if c.unit else "The" + others = [x.unit for x in clamps[1:] if x.unit] + running = (f"{names(others)} {'was' if len(others) == 1 else 'were'} cut " + f"too, and control is still running." if others + else "Control is still running.") + return Notice(ID_OUTPUT_CLAMP, ALARM, T_OUTPUT_CLAMP, + f"{who} controller asked for {watts(c.asked_w)}, above " + f"{LIMIT_WORDS.get(c.limit, LIMIT_WORDS['rating'])}, and sent " + f"{watts(c.sent_w)} instead. {running} " + f"This is a software fault, so please report it to your " + f"installer.") + + +def peak_saturated(ceiling_w) -> Notice: + """SAFETY-07: the battery gives all it can and the peak still goes up.""" + return Notice(ID_PEAK_SATURATED, ALARM, T_PEAK_SATURATED, + f"The battery is giving all it can, but this 15-minute period " + f"will still go over your {watts(ceiling_w)} peak limit and " + f"raise this month's peak. Switch off large loads in the next " + f"few minutes. This is not a fault: the load is bigger than " + f"the inverter.") + + +def peak_reserve(ceiling_w, *, soc_unread: bool, floor_unknown: bool, + packs=()) -> Notice: + """SAFETY-24/25/32: the peak guard may not discharge any further. + + The last sentence is SAFETY-25 and must stay: the reserve binds the peak + guard only, and normal home use goes on discharging below it. + `packs` names the batteries at their limit, only on a site with several. + `floor_unknown`: the floor the guard grades against is None, which at a + roster means some inverter's cut-out level is missing (the peak reserve + itself always has a value) - so the action names the cut-out level. + """ + if soc_unread: + why = "The battery level cannot be read" + act = "Switch off large loads, and check the battery level sensor." + elif floor_unknown: + why = "The cut-out level of a battery is not known" + act = ("Switch off large loads, and set each battery's cut-out level " + "in the settings.") + else: + why = (f"The battery of {names(packs)} is at its peak reserve" if packs + else "The battery is at its peak reserve") + act = ("Switch off large loads, or lower the peak reserve if the " + "battery allows it.") + return Notice(ID_PEAK_RESERVE, ALARM, T_PEAK_RESERVE, + f"{why}, so this 15-minute period will go over your " + f"{watts(ceiling_w)} peak limit and raise this month's peak. " + f"{act} The reserve only applies to keeping the peak down: normal home use " + f"can still discharge the battery below it, down to its " + f"cut-out level.") + + +def circulating(discharging=(), charging=()) -> Notice: + """SAFETY-31: the inverters push power round each other. Control stopped.""" + if discharging and charging: + what = (f"{names(discharging)} was discharging while " + f"{names(charging)} was charging, and your meter cannot see " + f"this.") + else: + what = ("One inverter was charging from another, and your meter " + "cannot see this.") + return Notice(ID_CIRCULATING, ALARM, T_CIRCULATING, + f"{what} Every inverter is set to 0 W: if the grid power does " + f"not change now, switch the inverters off at the isolator. " + f"Control stays stopped, even after a restart, until you " + f"start it on the add-on page once you know why.") + + +def not_delivering(unit: str, slug: str) -> Notice: + """SAFETY-42: one inverter gives less than its share. Reports, never acts.""" + return Notice( + ID_NOT_DELIVERING.format(slug=slug), ALARM, + T_NOT_DELIVERING.format(unit=unit), + f"{unit} gives less power than it is asked for, but nothing was " + f"changed and control keeps running. Check that {unit} is " + f"on and connected, that its battery is not empty or cold, and that " + f"nothing else controls it. A restart does not clear this: once you " + f"know why, stop and start control on the add-on page.", + section=S_NOT_DELIVERING) + + +def meter_frozen(unchanged_s) -> Notice: + """SAFETY-18: the meter answers but its value does not move.""" + return Notice(ID_METER_FROZEN, ALARM, T_METER_FROZEN, + f"The meter has shown the same value for " + f"{duration(unchanged_s)} while the controller asks the " + f"battery for full power. Control is still running and still " + f"follows this reading. Check the meter, and if it is stuck, " + f"stop control on the add-on page.") + + +def samples() -> list: + """One rendering of every notice, with realistic values, for the test.""" + return [ + loop_bound(), + output_clamp([Clamp(None, 7412, 5000, "rating")]), + output_clamp(()), + output_clamp([Clamp("inverter-a", -3000, -2500, "device"), + Clamp("inverter-b", 6000, 4600, "max_w+device")]), + peak_saturated(5000), + peak_reserve(5000, soc_unread=False, floor_unknown=False), + peak_reserve(5000, soc_unread=False, floor_unknown=False, + packs=["inverter-b"]), + peak_reserve(5000, soc_unread=True, floor_unknown=False), + peak_reserve(5000, soc_unread=False, floor_unknown=True), + circulating(["inverter-a"], ["inverter-b"]), + circulating(), + not_delivering("inverter-b", "inverter_b"), + meter_frozen(600), + meter_frozen(90), + ] diff --git a/goodwe_controller/test_clamp.py b/goodwe_controller/test_clamp.py index d6dcdf6..f4e4cda 100644 --- a/goodwe_controller/test_clamp.py +++ b/goodwe_controller/test_clamp.py @@ -83,6 +83,7 @@ from datetime import datetime, timedelta, timezone from named_absence import given, nth, present +from app import messages from app.clamp import ( CLEAR_CYCLES, REASON_CODE, REASSERT_S, SUSTAINED_CYCLES, ClampWatchdog, clamp_to_rating, @@ -510,9 +511,9 @@ check("...one episode, re-asserted rather than one per cycle", ctl_r.clamp_wd.episodes == 1 and len(notes_r) < ctl_r.clamp_wd.engagements) # SAFETY-40: on a default install this runaway is the INTEGRATOR bound, so it # says so, and does not call anti-windup a bug (part 8 grades the wording). -check("...and it names the integrator bound, not a BUG SIGNAL", - bool(notes_r) and "anti-windup bound" in notes_r[0]["message"] - and "BUG SIGNAL" not in notes_r[0]["message"]) +check("...and it is the integrator-bound notice, which calls nothing a fault", + bool(notes_r) and notes_r[0]["title"] == messages.T_LOOP_BOUND + and "fault" not in notes_r[0]["message"]) rows_r = [e for e in ctl_r.events if REASON_CODE in e] check(f"the action log records every engagement, coalesced into one row per " f"episode ({len(rows_r)} row(s), {ctl_r.clamp_wd.engagements} " @@ -1002,7 +1003,9 @@ check("AC 3: the guard alarmed on write-path evidence alone", ctl_w.clamp_wd.engagements == 1 and len(notes_w) == 1) check("...and the operator is told WHICH bound bit, so a device-rating clamp " "is not reported as a max_w one", - bool(notes_w) and "device bound" in notes_w[0]["message"]) + bool(notes_w) + and messages.LIMIT_WORDS["device"] in notes_w[0]["message"] + and messages.LIMIT_WORDS["max_w"] not in notes_w[0]["message"]) check("...and the action log carries the row, written by write_setpoint()", any(REASON_CODE in e and "device bound" in e for e in ctl_w.events)) @@ -1094,19 +1097,24 @@ check("⚠️ THE ORDERED PAIR IN THE §15 ACTION-LOG ROW (main.py:1366). The " "reading backwards on the one line an operator is woken by", any(f"the computed setpoint {_asked_x:+.0f} W was clamped to " f"{_sent_x:+.0f} W" in e for e in _rows_x)) -check("⚠️ ...AND IN THE ClampWatchdog NOTIFICATION REASON (main.py:2452), " - "which is a SECOND surface off the same sentence and has to be pinned " - "separately - SAFETY-38 round 3's whole lesson was that pinning one call " - "site leaves the other shipping", - bool(notes_x) - and f"the computed setpoint {_asked_x:+.0f} W was clamped to " - f"{_sent_x:+.0f} W" in notes_x[0]["message"]) +# UX-08: the notification is a SECOND surface off the same numbers, in its own +# words (messages.output_clamp): asked first, sent second. +def _asked_then_sent(msg, asked, sent): + return (f"asked for {messages.watts(asked)}," in msg + and f"and sent {messages.watts(sent)} instead" in msg + and msg.index(messages.watts(asked)) < msg.index("and sent")) + + +check("⚠️ ...AND IN THE ClampWatchdog NOTIFICATION, which is a SECOND surface " + "off the same numbers and has to be pinned separately - SAFETY-38 round " + "3's whole lesson was that pinning one call site leaves the other " + "shipping", + bool(notes_x) and _asked_then_sent(notes_x[0]["message"], _asked_x, _sent_x)) check("...and the TRANSPOSED sentence appears on NEITHER surface, so the two " "checks above discriminate rather than decorate", not any(f"the computed setpoint {_sent_x:+.0f} W was clamped to " f"{_asked_x:+.0f} W" in e for e in _rows_x) - and f"the computed setpoint {_sent_x:+.0f} W was clamped to " - f"{_asked_x:+.0f} W" not in nth(notes_x, 0)["message"] + and not _asked_then_sent(nth(notes_x, 0)["message"], _sent_x, _asked_x) and present(nth(notes_x, 0))) # The DEVICE bound, off part 6c's controller: same sentence, other stage. The # unit of coverage is the call site, and `bound` is the only thing that differs @@ -1118,8 +1126,7 @@ check("...and the same ordered pair holds on the DEVICE-bound row, where the " f"{_asked_w:+.0f}" != f"{_sent_w:+.0f}" and any(f"the computed setpoint {_asked_w:+.0f} W was clamped to " f"{_sent_w:+.0f} W" in e for e in ctl_w.events) - and f"the computed setpoint {_asked_w:+.0f} W was clamped to " - f"{_sent_w:+.0f} W" in nth(notes_w, 0)["message"]) + and _asked_then_sent(nth(notes_w, 0)["message"], _asked_w, _sent_w)) # ============================================================================== @@ -1973,8 +1980,8 @@ check("at the bound nothing is described as 'above' or 'over' the rating", for d, t, r in wind)) notes_i = clamp_notes(hass_i) check("it still NOTIFIES (not suppressed), under a title that claims no bug", - notes_i and all("integrator bound" in n["title"] - and "exceeded" not in n["title"] for n in notes_i)) + notes_i and all(n["title"] == messages.T_LOOP_BOUND + and "fault" not in n["message"] for n in notes_i)) check("...under its OWN notification_id, so it cannot replace a BUG SIGNAL " "notice still on screen", notes_i and all(n["notification_id"] == BOUND_ID for n in notes_i)) @@ -2008,10 +2015,14 @@ check("defect 3: 'clamped to' is the clamp's own result, not self.target", check("...and the 14 768 W rationale is still in its ERROR", any(x.levelno == logging.ERROR and "14 768 W" in x.getMessage() for x in log_o)) -check("...under the 'exceeded the rating' title, with a red status row", +check("...under the over-rating title, quoting a tick's own asked and sent " + "numbers in that order, with a red status row", clamp_notes(hass_o) - and all("exceeded the rating" in n["title"] - and n["notification_id"] == CLAMP_ID for n in clamp_notes(hass_o)) + and all(n["title"] == messages.T_OUTPUT_CLAMP + and n["notification_id"] == CLAMP_ID + and any(_asked_then_sent(n["message"], _f(d, 'requested_w'), + _f(d, 'clamped_w')) for d, t, r in over) + for n in clamp_notes(hass_o)) and any(not c["warn"] and "OUTPUT CLAMP ENGAGED" in c["text"] for c in red_o)) diff --git a/goodwe_controller/test_delivery.py b/goodwe_controller/test_delivery.py index 6e53bb1..b387b0a 100644 --- a/goodwe_controller/test_delivery.py +++ b/goodwe_controller/test_delivery.py @@ -33,6 +33,7 @@ from datetime import datetime, timedelta, timezone from named_absence import given, present +from app import messages from app.control import Tuning from app.delivery import ( DELIVERY_OPTION_DEFAULTS, DELIVERY_SHARE_FRACTION, REASON_CODE, @@ -1232,7 +1233,7 @@ check("the notification NAMES THE UNIT - in its id, its title and its body - " check("...and it says, in the operator's own sentence, that nothing has been " "commanded differently. An alarm that let somebody believe the add-on " "had handled it would be worse than no alarm", - "NOTHING HAS BEEN COMMANDED DIFFERENTLY" in _note[2]["message"]) + "nothing was changed and control keeps running" in _note[2]["message"]) print(f" id={_note[2]['notification_id']!r} title={_note[2]['title']!r}") _before_calls = len(_rh2.calls) await_again = asyncio.run(_r2.check_not_delivering()) diff --git a/goodwe_controller/test_freeze.py b/goodwe_controller/test_freeze.py index 661113d..a10166e 100644 --- a/goodwe_controller/test_freeze.py +++ b/goodwe_controller/test_freeze.py @@ -85,6 +85,7 @@ from pathlib import Path import aiohttp +from app import messages from app.control import Tuning, compute from app.freeze import ( RAIL_FRAC, FreezeWatchdog, FreezeWatchdogConfig, looks_frozen, @@ -773,7 +774,7 @@ def _is_freeze_note(d): calls itself frozen, which would be a confusable alarm on its own account. """ return (d.get("notification_id") == FREEZE_NOTE_ID - or "frozen" in str(d.get("title", "")).lower()) + or d.get("title") == messages.T_METER_FROZEN) def notes_of(hass): @@ -788,7 +789,7 @@ def notes_by_text_of(hass): both would be true by construction. """ return [d for d in all_notes_of(hass) - if "frozen" in str(d.get("title", "")).lower()] + if d.get("title") == messages.T_METER_FROZEN] def wired(unchanged_s, grid, cycles=60, dev=(-5000.0, 5000.0), **over): @@ -858,7 +859,7 @@ check("...with a fixed notification_id so repeats replace, not stack", [d.get("notification_id") for d in notes_by_text_of(hass_f)] == [FREEZE_NOTE_ID]) check("...and it says the controller is still running", - bool(notes) and "STILL RUNNING" in notes[0]["message"]) + bool(notes) and "Control is still running" in notes[0]["message"]) check("the status page carries a failed row saying so", len(frozen_rows) == 1 and not frozen_rows[0]["ok"] and not frozen_rows[0]["warn"]) check("the event log names it", any("METER FROZEN" in e for e in ctl_f.events)) @@ -1180,11 +1181,16 @@ check("...and at or above the device rail, which is why it must", check("THE ALARM FIRES through the real cycle() - the rating reaches the " "predicate from the controller, not just from a unit call", len(_n20) == 1 and _c20.freeze_wd.active) -check("...and the notification the operator gets quotes the capped rail, " - "not the max_w one", +# UX-08: the notification no longer quotes a rail at all (the reader's action +# is "check the meter"), so it cannot quote the wrong one; the capped rail is +# still what the reason - the log line and the status row - carries. +check("...and the notification the operator gets names no max_w rail, and the " + "reason behind it quotes the capped rail", bool(_n20) + and f"{rail_w(LIVE_INSTALL_MAX_W):.0f} W" + not in str(_n20[0].get("message", "")) and f"{rail_w(LIVE_INSTALL_MAX_W, dev_min=-4700.0, dev_max=4700.0):.0f} W" - in str(_n20[0].get("message", ""))) + in _c20.freeze_wd.reason) # p1_enabled is what a homewizard_local install has - set by hand here for the # same reason part 4 sets it, see freeze_rows(). _c20.p1_enabled = True diff --git a/goodwe_controller/test_messages.py b/goodwe_controller/test_messages.py new file mode 100644 index 0000000..46582bc --- /dev/null +++ b/goodwe_controller/test_messages.py @@ -0,0 +1,409 @@ +"""UX-08: user-facing text follows STYLE.md. RUN: python3 -B test_messages.py + +1. Every notification in `app/messages.py` obeys the rule. The test renders + each one with realistic values and checks the title length, the number of + sentences and words for its severity, the banned terms, the entity ids and + the Details line. +2. No notification is worded anywhere else. An AST scan of `app/` fails any + `persistent_notification` call whose payload is not built by + `app/messages.py`. +3. THE RATCHET for the kinds not rewritten yet. Every status-row and banner + literal, every validator refusal, every WARNING+ log line and every option + name and description in `translations/en.yaml` must either obey its limit + or appear in `ux08_allowlist.txt`. A new string that breaks the rule and is + not listed goes red. So does a listed entry that no longer matches a + failing string, so the list can only shrink: remove the line when you + rewrite the string. +4. DOCS.md has a section for every notification, under "## Notifications". +5. Mutations: each rule is shown to catch a spoiled input (habit 1 of + MUTATION.md). + +Run `python3 -B test_messages.py --violations` to print what part 3 sees. +""" + +import ast +import hashlib +import os +import re +import sys +from pathlib import Path + +HERE = Path(__file__).resolve().parent +sys.path.insert(0, str(HERE / "tools")) + +from app import messages # noqa: E402 +import translations_lint as TL # noqa: E402 + +fails = [] + + +def check(name, cond): + print(f" {'ok ' if cond else 'FAIL'} {name}") + if not cond: + fails.append(name) + + +# --- the rule (STYLE.md sections 1 and 4) -------------------------------------- +BANNED = re.compile( + r"\b(?:(?:SAFETY|TARIFF|TEL|CFG|FCST|OPT|UX|HW|FW|WITNESS|PKG|ARCH)-\d+|" + r"integrator|anti-?windup|windup|clamp(?:ed|s)?|i_clamped|saturat\w*|" + r"BUG SIGNAL|latch(?:ed)?|arbiter|allocator|registers?|0x[0-9A-Fa-f]+|" + r"layer [123]|heartbeat|watchdog|telegrams?|ACKs?|CRC|OTA|Modbus|planner|" + r"capaciteitstarief|journalctl|ssh|grep|" + r"\d+\.\d+\.\d+\.\d+|[\w-]+\.(?:py|md|yaml|json|db))\b|§\s?\d", re.I) +ENTITY = re.compile(r"\b(?:sensor|number|binary_sensor|input_\w+|switch|select)" + r"\.[a-z0-9_*]+") +SNAKE = re.compile(r"\b[a-z0-9]+(?:_[a-z0-9]+)+\b") +SHOUT = re.compile(r"\b[A-Z]{2,}[A-Z0-9]*(?:[\s-]+[A-Z]{2,}[A-Z0-9]*)+\b") +PLACEHOLDER = re.compile(r"\{[^{}]*\}|%[-+ #0-9.]*[sdrfgx%]") + + +def words(text): + return [w for w in re.findall(r"\S+", PLACEHOLDER.sub("X", text)) + if re.search(r"[A-Za-z0-9]", w)] + + +def sentences(text): + """Sentence count: a stop followed by a space and a capital, or the end.""" + t = PLACEHOLDER.sub("X", text.strip()) + t = re.sub(r"\b(e\.g|i\.e|etc)\.", "eg", t) + return len([s for s in re.split(r"[.!?](?:\s+|$)", t) if s.strip()]) + + +def title_problems(title): + out = [] + if len(words(title)) > 5: + out.append(f"title over 5 words ({len(words(title))})") + if title.lower().startswith("goodwe"): + out.append("title carries a GoodWe prefix") + if title.rstrip().endswith("."): + out.append("title ends in a full stop") + return out + text_problems(title, keys=False, entities=False) + + +def text_problems(text, *, keys, entities): + t = PLACEHOLDER.sub("X", text) + out = [] + hit = sorted({m.group(0) for m in BANNED.finditer(t)}) + if hit: + out.append("banned: " + ", ".join(hit[:4])) + if not entities and ENTITY.search(t): + out.append("entity id: " + ENTITY.search(t).group(0)) + if not keys and SNAKE.search(ENTITY.sub("", t)): + out.append("option key: " + SNAKE.search(ENTITY.sub("", t)).group(0)) + if SHOUT.search(t): + out.append("capitals: " + SHOUT.search(t).group(0)) + return out + + +def body_problems(body, severity): + out = [] + n_s, n_w = sentences(body), len(words(body)) + if severity == messages.ALARM: + if n_s > 3: + out.append(f"alarm body over 3 sentences ({n_s})") + if n_w > 70: + out.append(f"alarm body over 70 words ({n_w})") + long = [s for s in re.split(r"(?<=[.!?])\s+", body) if len(words(s)) > 30] + if long: + out.append(f"sentence over 30 words ({len(words(long[0]))})") + else: + if n_s > 1: + out.append(f"{severity} body over 1 sentence ({n_s})") + if n_w > 25: + out.append(f"{severity} body over 25 words ({n_w})") + if ";" in body: + out.append("semicolon: split it into sentences or drop a clause") + return out + text_problems(body, keys=False, entities=False) + + +def notice_problems(n): + out = [] + if n.severity not in (messages.ALARM, messages.WARNING, messages.INFO, + messages.RESOLVED): + out.append(f"unknown severity {n.severity!r}") + out += title_problems(n.title) + body_problems(n.body, n.severity) + if not ends_in_details(n.data()["message"], n.docs): + out.append("message does not end in its Details line") + return out + + +def ends_in_details(message, docs): + return message.endswith("\n\n" + messages.details(docs)) + + +# ============================================================================== # +print("1. every notification obeys the rule") +SAMPLES = messages.samples() +for n in SAMPLES: + p = notice_problems(n) + check(f"{n.severity:8} {n.title!r}: {len(words(n.body))} words, " + f"{sentences(n.body)} sentence(s){' - ' + '; '.join(p) if p else ''}", + not p) +ids = {v for k, v in vars(messages).items() if k.startswith("ID_")} +seen = {re.sub(r"inverter_b$", "{slug}", n.id) for n in SAMPLES} +check(f"the samples cover every notification id in the catalogue " + f"(missing: {sorted(ids - seen)})", ids <= seen) +check("the payload carries exactly the three keys Home Assistant accepts", + all(set(n.data()) == {"notification_id", "title", "message"} + for n in SAMPLES)) +os.environ["HOSTNAME"] = "abcd1234-goodwe-controller" +check("inside the add-on the Details line links to its documentation page", + "(/hassio/addon/abcd1234_goodwe_controller/documentation)" + in SAMPLES[0].data()["message"]) +os.environ["HOSTNAME"] = "some-laptop" +check("...and anywhere else it names the section without a guessed link", + "](" not in SAMPLES[0].data()["message"] + and "under Notifications" in SAMPLES[0].data()["message"]) +del os.environ["HOSTNAME"] +check("the output-clamp alarm quotes asked before sent", + messages.output_clamp([messages.Clamp(None, 7412, 5000, "rating")]).body + .index("7 412 W") < messages.output_clamp( + [messages.Clamp(None, 7412, 5000, "rating")]).body.index("5 000 W")) + + +# ============================================================================== # +print("\n2. no notification is worded outside app/messages.py") +APP = HERE / "app" + + +def render(node): + """A string expression as text, placeholders as {expr}; None otherwise.""" + if isinstance(node, ast.Constant) and isinstance(node.value, str): + return node.value + if isinstance(node, ast.JoinedStr): + return "".join(v.value if isinstance(v, ast.Constant) + else "{" + ast.unparse(v.value) + "}" for v in node.values) + if isinstance(node, ast.BinOp) and isinstance(node.op, ast.Add): + a, b = render(node.left), render(node.right) + if a is None and b is None: + return None + return (a if a is not None else "{…}") + (b if b is not None else "{…}") + if isinstance(node, ast.IfExp): + a, b = render(node.body), render(node.orelse) + if a is None and b is None: + return None + return (a or "") + " / " + (b or "") + return None + + +def notification_calls(tree): + for node in ast.walk(tree): + if (isinstance(node, ast.Call) and node.args + and ast.unparse(node.func).endswith("call") + and render(node.args[0]) == "persistent_notification"): + yield node + + +bad_calls, n_calls = [], 0 +for f in sorted(APP.glob("*.py")): + for call in notification_calls(ast.parse(f.read_text(encoding="utf-8"))): + n_calls += 1 + payload = call.args[2] if len(call.args) > 2 else None + ok = (isinstance(payload, ast.Call) + and isinstance(payload.func, ast.Attribute) + and payload.func.attr == "data" + and "messages." in ast.unparse(payload.func.value)) + if not ok: + bad_calls.append(f"{f.name}:{call.lineno}") +check(f"the scan found the add-on's notification calls ({n_calls})", n_calls >= 7) +check(f"every one is built by app/messages.py (not: {bad_calls})", not bad_calls) + + +# ============================================================================== # +print("\n3. the ratchet: other user-facing text obeys its limit or is listed") + +LIMITS = { # kind: (words, keys ok, entity ids ok) + "row": (15, False, False), + "banner": (12, False, False), + "refusal": (30, True, True), + "log": (25, True, True), + "option-name": (6, False, False), + "option-desc": (30, True, True), +} +LOG_CALL = re.compile(r"(?:^|\.)(?:_LOG|log|logger|LOG)\.(warning|error|critical|exception)$") + + +def strings_in(node): + """Top-level string expressions inside `node` (not their parts).""" + t = render(node) + if t is not None: + yield node, t + return + for child in ast.iter_child_nodes(node): + yield from strings_in(child) + + +def collect(): + """(kind, where, text) for every user-facing literal of a ratcheted kind.""" + out = [] + for f in sorted(APP.glob("*.py")): + if f.name == "messages.py": + continue + tree = ast.parse(f.read_text(encoding="utf-8")) + for node in ast.walk(tree): + if isinstance(node, ast.Dict): + for k, v in zip(node.keys, node.values): + key = render(k) if k is not None else None + if key in ("text", "banner"): + for n, t in strings_in(v): + out.append(("row" if key == "text" else "banner", + f"{f.name}:{n.lineno}", t)) + elif isinstance(node, ast.Assign) and f.name == "main.py": + tgt = ast.unparse(node.targets[0]).replace(" ", "").strip("()") + if tgt in ("level,banner", "banner"): + for n, t in strings_in(node.value): + if len(words(t)) > 1: + out.append(("banner", f"{f.name}:{n.lineno}", t)) + elif isinstance(node, ast.Call): + name = ast.unparse(node.func) + if LOG_CALL.search(name) or name.endswith("._moan"): + arg = node.args[1 if name.endswith("._moan") else 0] \ + if node.args else None + if arg is not None: + for n, t in strings_in(arg): + out.append(("log", f"{f.name}:{n.lineno}", t)) + elif re.search(r"problems\.(append|extend)$", name): + for a in node.args: + for n, t in strings_in(a): + if len(words(t)) > 1: + out.append(("refusal", f"{f.name}:{n.lineno}", t)) + tr = TL.parse_translation_file(HERE / "translations" / "en.yaml") + + def walk(conf, path): + for key, v in (conf or {}).items(): + if not isinstance(v, dict): + continue + if isinstance(v.get("name"), str): + out.append(("option-name", f"en.yaml:{path}{key}", + v["name"].split("·")[-1].strip())) + if isinstance(v.get("description"), str): + out.append(("option-desc", f"en.yaml:{path}{key}", + v["description"])) + if isinstance(v.get("fields"), dict): + walk(v["fields"], f"{path}{key}.") + walk(tr.get("configuration"), "") + return out + + +def problems_of(kind, text): + lim, keys, ents = LIMITS[kind] + p = [] + if len(words(text)) > lim: + p.append(f"over {lim} words ({len(words(text))})") + return p + text_problems(text, keys=keys, entities=ents) + + +def key_of(kind, text): + return f"{kind} {hashlib.sha1(text.encode('utf-8')).hexdigest()[:12]}" + + +ALLOW_FILE = HERE / "ux08_allowlist.txt" +# The allowlist may never grow. The test demands the list be exactly this long, +# so deleting lines means lowering this number in the same change, and adding +# one means raising it where a reviewer sees it. +ALLOWLIST_MAX = 200 + + +def read_allowlist(path): + keys = set() + for line in path.read_text(encoding="utf-8").splitlines(): + line = line.split("#", 1)[0].strip() + if line: + keys.add(" ".join(line.split()[:2])) + return keys + + +found = collect() +violating = {} +for kind, where, text in found: + p = problems_of(kind, text) + if p: + violating.setdefault(key_of(kind, text), (kind, where, text, p)) +if "--violations" in sys.argv: + for k, (kind, where, text, p) in sorted(violating.items(), + key=lambda kv: kv[1][:2]): + print(f"{k} # {where} {'; '.join(p)} :: {text[:70]!r}") + sys.exit(0) + +allow = read_allowlist(ALLOW_FILE) +by_kind = {} +for kind, *_ in found: + by_kind[kind] = by_kind.get(kind, 0) + 1 +check(f"the scan found every ratcheted kind ({by_kind})", + all(by_kind.get(k, 0) >= 5 for k in LIMITS)) +new = sorted(k for k in violating if k not in allow) +for k in new: + kind, where, text, p = violating[k] + print(f" NEW {where}: {'; '.join(p)} :: {text[:90]!r}\n" + f" (rewrite it to STYLE.md; listing it needs a reason)") +check(f"no new string breaks the rule ({len(new)} new)", not new) +stale = sorted(k for k in allow if k not in violating) +for k in stale: + print(f" STALE {k} - that string now obeys the rule or is gone: " + f"delete its line from ux08_allowlist.txt") +check(f"no allowlist entry is stale, so the list only shrinks " + f"({len(stale)} stale)", not stale) +check(f"the allowlist is exactly its cap ({len(allow)} entries, cap " + f"{ALLOWLIST_MAX}): lower the cap when you delete lines", + len(allow) == ALLOWLIST_MAX) +print(f"CI: UX-08 allowlist {len(allow)} entries " + + ", ".join(f"{k} {sum(1 for x in allow if x.startswith(k + ' '))}" + for k in LIMITS)) + + +# ============================================================================== # +print("\n4. DOCS.md holds the detail of every notification") +DOCS = (HERE / "DOCS.md").read_text(encoding="utf-8") +part = DOCS.split("\n## Notifications\n", 1) +check("DOCS.md has a '## Notifications' section", len(part) == 2) +section = part[-1].split("\n## ", 1)[0] if len(part) == 2 else "" +heads = set(re.findall(r"^### (.+)$", section, re.M)) +missing = sorted({n.docs for n in SAMPLES} - heads) +check(f"...with a heading for every Details line (missing: {missing})", not missing) + + +# ============================================================================== # +print("\n5. mutations: each rule catches a spoiled input") +N = messages.Notice +check("a six-word title is refused", + bool(title_problems("The meter reading may be stuck"))) +check("a GoodWe prefix is refused", bool(title_problems("GoodWe: meter stuck"))) +check("a second sentence in a warning is refused", + bool(body_problems("The battery lags. Check it.", messages.WARNING))) +check("a semicolon run-on is refused, in an alarm too", + bool(body_problems("It stopped; check it.", messages.ALARM))) +check("a fourth sentence in an alarm is refused", + bool(body_problems("One. Two. Three. Four.", messages.ALARM))) +check("an internal name is refused", bool(body_problems( + "The integrator reached its bound.", messages.WARNING))) +check("a card id is refused", bool(body_problems( + "See SAFETY-25.", messages.WARNING))) +check("shouting is refused", bool(body_problems( + "Control is STILL RUNNING.", messages.WARNING))) +check("an entity id in an alarm is refused", bool(body_problems( + "Check sensor.battery_power now.", messages.ALARM))) +check("...but allowed in a refusal", not problems_of( + "refusal", "Check sensor.battery_power in Developer Tools.")) +check("an option key in an alarm is refused", bool(body_problems( + "Lower peak_soc_floor.", messages.ALARM))) +check("a message that lost its Details line is refused", + ends_in_details(N("x", messages.WARNING, "Meter stuck", "It is.") + .data()["message"], "Meter stuck") + and not ends_in_details("It is.", "Meter stuck")) +_fake = " x = {'text': 'THE METER IS FROZEN AND NOTHING WORKS AT ALL'}\n" +_n = [t for node in ast.walk(ast.parse(_fake.strip())) + if isinstance(node, ast.Dict) for _, t in strings_in(node.values[0])] +check("a new shouting status row is seen by the scan and is not listed", + _n and problems_of("row", _n[0]) + and key_of("row", _n[0]) not in allow) +_bad = ast.parse("await self.hass.call('persistent_notification', 'create', " + "{'title': 'x', 'message': 'y'})", mode="exec") +check("a hand-written notification payload is seen by part 2", + any(not (isinstance(c.args[2], ast.Call)) for c in notification_calls(_bad))) + +print() +if fails: + print(f"{len(fails)} FAILED") + sys.exit(1) +print("all passed") diff --git a/goodwe_controller/test_peakguard.py b/goodwe_controller/test_peakguard.py index 9f19bd9..1884bbd 100644 --- a/goodwe_controller/test_peakguard.py +++ b/goodwe_controller/test_peakguard.py @@ -114,6 +114,7 @@ from datetime import datetime, timedelta, timezone from math import inf, isinf from pathlib import Path +from app import messages from app import peakguard from named_absence import first, given, nth, present @@ -2522,13 +2523,21 @@ check("...and shortening the banner did NOT shorten the row: the full AC 3 " and "BMS cut-out" in rows25[0]["text"]) _body25 = hass25.last_message("goodwe_peak_soc_floor") + + +def _says_scope(body): + """SAFETY-25 in messages.peak_reserve()'s words: the reserve binds the peak + guard only, and home use goes on discharging below it to the cut-out.""" + return ("The reserve only applies to keeping the peak down" in body + and "normal home use can still discharge the battery below it" in body + and "down to its cut-out level" in body) + + print(f" notification body tail: ...{_body25[-180:]}") check("...and so does the persistent notification, which outlives the page and " "is the thing an operator reads on a phone at 19:00. It names what has " "stopped - the guard buying a lower bill - and what has not", - "peak_soc_floor bounds THE PEAK GUARD ONLY" in _body25 - and "not a" in _body25 and "pack-wide reserve" in _body25 - and "BMS cut-out" in _body25) + _says_scope(_body25)) # --- 10f. THE CLAIM-SOURCE SET, PINNED -------------------------------------- @@ -4332,8 +4341,8 @@ check("the notification an operator reads at 19:00 NAMES THE PACK that stopped " "the site, and names only that one. 'the battery is at its floor' on a " "site with two batteries is an instruction to go and look at both, and " "the wrong one is the one that is fine", - "SAFETY-32" in _body32 and "inverter-b" in _body32 - and "inverter-a" not in _body32.split("WHICH PACK")[-1]) + "The battery of inverter-b is at its peak reserve" in _body32 + and "inverter-a" not in _body32) # The mirror again, on the SoC axis: swap which pack is empty and the name # swaps. A hardwired `self.inverters[1].name` passes the line above. _body32b = asyncio.get_event_loop_policy().new_event_loop().run_until_complete( @@ -4341,8 +4350,8 @@ _body32b = asyncio.get_event_loop_policy().new_event_loop().run_until_complete( check("...and with the SAME two readings swapped between the packs it names " "inverter-a instead - so the sentence follows the measurement rather " "than a position in the roster", - "inverter-a" in _body32b - and "inverter-b" not in _body32b.split("WHICH PACK")[-1]) + "The battery of inverter-a is at its peak reserve" in _body32b + and "inverter-b" not in _body32b) # ⚠️ AC 5, THE OTHER HALF: THE SAME METHOD ON A ROSTER OF ONE MUST PRINT WHAT IT @@ -4366,13 +4375,14 @@ async def _notify32_one(): _body32one = asyncio.get_event_loop_policy().new_event_loop().run_until_complete( _notify32_one()) -check("⚠️ AC 5. At a roster of ONE the same notification carries NO per-pack " - "sentence at all - byte for byte the message SAFETY-25 shipped. There is " +check("⚠️ AC 5. At a roster of ONE the same notification names NO pack - " + "byte for byte the two-pack message minus the name (UX-08). There is " "one battery, naming it is noise, and this alarm reaches every existing " "install", - "SAFETY-32" not in _body32one and "WHICH PACK" not in _body32one - and _body32one == _body32.split("\n\nSAFETY-32")[0] - and "peak_soc_floor bounds THE PEAK GUARD ONLY" in _body32one) + "inverter-" not in _body32one + and _body32one == _body32.replace("The battery of inverter-b is", + "The battery is") + and _says_scope(_body32one)) # --- 12i. THE SIBLING ARGUMENT: `pack_floor_soc`, THE OTHER HALF OF THE PAIR -- @@ -5604,8 +5614,7 @@ MUT.append(("rule 8's refusal naming a hardwired inverter", # 21. the notification naming a fixed roster position rather than the pack that # is actually at its floor. MUT.append(("the per-pack notification naming a fixed roster position", - "inverter-a" in _body32b - and "inverter-b" not in _body32b.split("WHICH PACK")[-1], + "inverter-a" in _body32b and "inverter-b" not in _body32b, "part 12h: the same two readings swapped between the packs")) # ---- the two PR #48 SURVIVORS, and why they survived ------------------------- diff --git a/goodwe_controller/test_watchdog.py b/goodwe_controller/test_watchdog.py index 2decd04..77ca082 100644 --- a/goodwe_controller/test_watchdog.py +++ b/goodwe_controller/test_watchdog.py @@ -22,6 +22,7 @@ from datetime import datetime, timedelta, timezone from named_absence import nth, present +from app import messages # noqa: E402 from app.watchdog import ( SignWatchdog, SignWatchdogConfig, loop_is_following, ) @@ -1105,12 +1106,22 @@ check("...under a fixed notification_id of its own, so a second episode " for c in _notes1 + _notes2) and len({c[2]["notification_id"] for c in _notes1 + _notes2}) == 1) _msg = nth(_notes2, 0)[2]["message"] + + +def _says_three(m): + """UX-08: the three things only this alarm can say, in its plain words + (messages.circulating): the meter cannot see it, control is stopped at + 0 W, and if the grid does not move a person at the isolator is next.""" + return ("meter cannot see this" in m and "Control stays stopped" in m + and "Every inverter is set to 0 W" in m and "isolator" in m + and "if the grid power does not change" in m) + + check("...and the message tells the operator the three things only this alarm " "can: that the meter cannot see it, that control has been stopped, and " "that if the grid reading does not move afterwards one inverter is no " "longer listening and a human at the isolator is the last actuator", - "METER CANNOT SEE" in _msg and "CONTROL HAS BEEN STOPPED" in _msg - and "isolator" in _msg) + _says_three(_msg)) check("...and it does not raise the same card on every cycle - a per-PROCESS " "flag, deliberately not persisted, is what makes 'has a human been shown " "this' a different question from 'is this site tripped'", @@ -1262,8 +1273,8 @@ check("PRECONDITION: both runs actually tripped and actually raised the card, " and len(_notes_g) == 1 and len(_notes_s) == 1) # --- AC 4: THE ATTRIBUTION ITSELF ------------------------------------------- -_WHO_G = "Right now garage is discharging while shed charges." -_WHO_S = "Right now shed is discharging while garage charges." +_WHO_G = "garage was discharging while shed was charging" +_WHO_S = "shed was discharging while garage was charging" check("⚠️ THE ALARM NAMES THE TWO PACKS AND SAYS WHICH WAY EACH ONE IS PULLING. " "`circulation.py` calls this the first thing somebody woken at 3 a.m. " "needs and impossible to reconstruct from the watts alone, and until this " @@ -1284,12 +1295,14 @@ check("...and the RESTING pack is not named. `cellar` is on the roster, is read "beside a 6 kW loop is not reported as one of its two participants", "cellar" not in _msg_g and "cellar" not in _msg_s and _cg.inverters[2].batt == _REST_W) -check("...and the sentence sits with the figure, not instead of it: the same " - "card still carries the watts, the window and the three things only this " - "alarm can say", - all("CIRCULATING_POWER" in m and "METER CANNOT SEE" in m - and "CONTROL HAS BEEN STOPPED" in m and "isolator" in m - for m in (_msg_g, _msg_s))) +# UX-08: the watts and the window moved out of the card into the reason the +# log line and the status row carry; the card keeps the three things. +check("...and the sentence sits with the three things only this alarm can say, " + "while the watts and the window stay in the reason behind it", + all(_says_three(m) for m in (_msg_g, _msg_s)) + and all("CIRCULATING_POWER" in c.circ_wd.reason + and "W measured going round" in c.circ_wd.reason + for c in (_cg, _cs))) print() print(" the operator's press is the only way out, and it clears BOTH halves") diff --git a/goodwe_controller/ux08_allowlist.txt b/goodwe_controller/ux08_allowlist.txt new file mode 100644 index 0000000..94ea509 --- /dev/null +++ b/goodwe_controller/ux08_allowlist.txt @@ -0,0 +1,207 @@ +# UX-08 ratchet (test_messages.py part 3). Each line is a user-facing string that +# does not follow STYLE.md yet: "<kind> <sha1-12 of its text> # where :: start". +# These are waiting for phase 2b (row, banner), 2c (refusal, option-name, +# option-desc) and 2d (log). Delete the line when you rewrite the string, because +# a stale line fails the test. Never add a line for a new string: write the new +# string to STYLE.md instead. + +banner c185022e391f # main.py banned: SAFETY-25; option key: peak_soc_floor; capitals: THE PEAK GUARD ONLY :: '{…} - and peak_soc_floor bounds THE PEAK GUARD ONLY (SAFETY-25, see be' +banner 4a246fc26def # main.py over 12 words (14); capitals: CIRCULATING POWER :: 'CIRCULATING POWER — the inverters were pushing against each other. Sit' +banner 750ccd4f2126 # main.py over 12 words (14) :: "FAILSAFE — the site's total command opposed the meter. Every inverter " +banner 637f334f130a # main.py over 12 words (26) :: 'FAILSAFE — the command opposed the meter. Inverter held at 0 W. / FAIL' +banner 0a3d2d9c4232 # main.py capitals: NOT READY :: "NOT READY — {bad[0].get('banner') or bad[0]['text']}" +banner dbcc227a9589 # main.py over 12 words (26); capitals: NOT DELIVERING :: 'NOT DELIVERING — {_nd} is standing at a share it is not producing. The' +log a5e99679fd80 # main.py banned: SAFETY-02, latch :: 'SAFETY-02: the per-inverter store migration did not verify (%s). The l' +log 128b18b32d86 # main.py over 25 words (41); banned: LATCHED, SAFETY-44, latched :: 'SAFETY-44: this store carries a LATCHED sign-disagreement failsafe und' +log f60446541ae5 # main.py over 25 words (83); banned: LATCH, LATCHED, SAFETY-02, latch; capitals: LATCH GUARD :: 'SAFETY-02 LATCH GUARD: this store carries a LATCHED sign-disagreement ' +log 04d06bf223c8 # main.py over 25 words (73); banned: REGISTER, SAFETY-37, SAFETY-57, register; capitals: WHICH IS NOT BY ITSELF :: 'SAFETY-37: %s battery-power reading did not move under a command that ' +log aec01642bd07 # main.py banned: SAFETY-57 :: 'SAFETY-57: %s' +log aebbca17acb3 # main.py over 25 words (52); banned: allocator :: 'write_setpoint() was asked to put %+.0f W on every one of %d inverters' +log b74c3018461e # main.py over 25 words (30); banned: SAFETY-28, allocator :: 'SAFETY-28 REFUSED a write of %+.0f W to %s: %s. Commanding 0 W instead' +log cefffafa8b27 # main.py over 25 words (31) :: 'the write of %+.0f W to %s (%s) did not complete in %.0f s and was aba' +log 1001c6250b85 # main.py over 25 words (29); banned: SAFETY-02 :: 'SAFETY-02 TRIPPED on %s - %s. Commanding 0 W on that inverter and hold' +log 8252ef5eefad # main.py over 25 words (48); banned: SAFETY-30 :: 'SAFETY-30 TRIPPED at the SITE - %s. That is the SUM of every standing ' +log 8a65cf945e00 # main.py over 25 words (32); banned: SAFETY-31 :: 'SAFETY-31 TRIPPED - %s. Commanding 0 W on every inverter and holding i' +log 5d2beed2f1a2 # main.py over 25 words (65); banned: HW-01, SAFETY-42; capitals: NOTHING IS COMMANDED DIFFERENTLY :: 'SAFETY-42 TRIPPED on %s - %s. NOTHING IS COMMANDED DIFFERENTLY: this g' +log d50b775b9cd4 # main.py banned: ARBITER; capitals: ARBITER SCOPE :: 'ARBITER SCOPE: %s' +log 749c2c6fe81d # main.py over 25 words (26); banned: SAFETY-10, heartbeat; capitals: SHADOW MODE IS ON :: 'SAFETY-10 SHADOW MODE IS ON. The full decision path runs and NOTHING i' +log 4d271dfc6f1c # main.py banned: SAFETY-10 :: 'SAFETY-10 shadow mode is OFF. This controller is commanding the batter' +log 730387e0da2b # main.py banned: SAFETY-03 :: 'SAFETY-03 - %s Engagements so far: %d.' +log 3bf899e99297 # main.py over 25 words (56); banned: SAFETY-03, clamp, clamped, integrator; capitals: STILL RUNNING :: 'SAFETY-03 - %s Silently clipping this is how a winding integrator reac' +log 78cb6bd09633 # main.py over 25 words (48); banned: SAFETY-07; capitals: STILL RUNNING :: 'SAFETY-07 - %s. The guard is asking for everything the inverter has an' +log cc735997adc7 # main.py over 25 words (44); banned: SAFETY-24; capitals: STILL RUNNING :: 'SAFETY-24 - %s. The controller is STILL RUNNING and charging is still ' +log ebcb428a70d0 # main.py over 25 words (70); banned: SAFETY-18, arbiter, watchdog; capitals: CHECK THE METER :: 'SAFETY-18 - %s. The grid-following loop is regulating against a number' +log 38018b887495 # main.py over 25 words (43) :: 'tariff refresh degraded (%s); KEEPING the plan resolved at %s, %.0f s ' +log 0eab1ec96fe8 # main.py capitals: CONTROL LOOP DIED :: 'CONTROL LOOP DIED (%s) - commanding 0 W and exiting with status %d' +log db529f2c419d # main.py over 25 words (40); banned: SAFETY-02 :: 'SAFETY-02 was TRIPPED on %s before this restart and stays tripped: %s.' +log c5aadd5c8bf9 # main.py over 25 words (45); banned: SAFETY-42; capitals: NOTHING IS BEING COMMANDED DIFFERENTLY :: 'SAFETY-42 was TRIPPED on %s before this restart and stays tripped: %s.' +log d72bbdb7e595 # main.py over 25 words (39); banned: SAFETY-30 :: 'SAFETY-30 (site) was TRIPPED before this restart and stays tripped: %s' +log 8b880e65a7c3 # main.py over 25 words (38); banned: SAFETY-31 :: 'SAFETY-31 was TRIPPED before this restart and stays tripped: %s. Every' +log 23f58b7f305c # p1.py:1264 over 25 words (30) :: 'meter_poll_s %.1f leaves no room under meter_max_age_s %.1f: one misse' +log 88a7251e842b # p1.py:470 banned: telegram :: 'P1 telegram rejected: %s' +log 0dd83d6dfaf4 # price.py over 25 words (30) :: 'the feed published no price for %d of %d instants (index %s); those in' +log bcfd7062e28e # price.py over 25 words (79); banned: §8 :: 'price_feed_url is set, so %s is requesting %s exactly as given and is ' +log b57bc6de4a6b # price.py over 25 words (47); banned: validate.py :: 'price_taxes_profile cannot be used (%s: %s), so this fetch has NO tax ' +log d5595aaaacc4 # price_history.py banned: §8 :: 'price history at %s is %s - starting from empty. §8.3 carry-forward ha' +log dbed0b8e35ea # static_tariff.py banned: validate.py :: 'static_profile is unusable (%s); no cheap window. This should have bee' +log 8fbe9f5407ea # static_tariff.py over 25 words (28); banned: §1, §6 :: '§11.4: %s, and no static_profile is configured to fall back to. The pl' +log 4ce29e043d89 # static_tariff.py banned: §1 :: '§11.4: %s - falling back to the static profile, plan marked PROVISIONA' +log a3c7c9719ed2 # store.py capitals: LOST STATE :: 'per-inverter store migration LOST STATE and has not been marked done: ' +log 5b537a77052b # validate.py over 25 words (41); banned: arbiter, saturation :: 'integrator_max_w %.0f W is above max_w %.0f W. Not refused - the arbit' +log 12ae40f9d289 # validate.py over 25 words (73); banned: arbiter, clamp, clamps :: 'maintenance_discharge_w %.0f W is above max_w%s %.0f W. Not refused - ' +log c6dc799502cf # validate.py over 25 words (32) :: '%s carries negative levies %s EUR/kWh. That is accepted, but a tax com' +log 1688a7478ceb # validate.py over 25 words (36) :: 'price_formula is filled in but price_provider is %r, so the coefficien' +log f37f9fce4433 # validate.py over 25 words (96) :: '%s has no "card" block, so its coefficients are UNGRADED: nothing reco' +log 396fbdd009c2 # validate.py over 25 words (52); banned: §1 :: "price_provider is %r but static_profile is empty. §11.4's degradation " +log 37bba6ed37e3 # validate.py capitals: REFUSING TO START :: 'REFUSING TO START: the add-on configuration is not usable.' +option-desc b927826d01f0 # en.yaml over 30 words (112); capitals: LEAVING IT OFF DOES NOT TURN THE PRICE FEED OFF :: 'Charge in the cheapest published hour and discharge in the dearest, bu' +option-desc b98c42e34df7 # en.yaml over 30 words (34) :: 'The reserve price trading may not spend. Deliberately not the same key' +option-desc 84e054da385b # en.yaml over 30 words (39) :: 'Off by default. Leave it off until the site has been commissioned: wit' +option-desc 0f55d3b37afa # en.yaml over 30 words (38); banned: 0x0518, register, watchdog :: "The sensor that reports this inverter's own battery power, positive wh" +option-desc 307afdd74f84 # en.yaml over 30 words (98); banned: 0x0560, Register; capitals: GW5000S-BP :: "MEASURED, not chosen: the percent at which the pack's OWN battery mana" +option-desc 4da37ff6250d # en.yaml over 30 words (66); banned: SAFETY-31; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY. DERIVED (SAFETY-31): 75 s is fifteen contr' +option-desc db464169ed66 # en.yaml over 30 words (144); banned: SAFETY-31; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY; with one inverter the quantity is identica' +option-desc df9735452fa1 # en.yaml over 30 words (88); banned: OPT-08; capitals: THIS ONE IS NOT DERIVED FROM :: 'What one full round trip costs per kWh: wear on the pack plus conversi' +option-desc 8147a82a437e # en.yaml over 30 words (51) :: 'A deadline on the gap between cycles, reset by every cycle. On a healt' +option-desc cb66f230ef63 # en.yaml over 30 words (45); banned: register :: 'Errors smaller than this are ignored. ⚠️ The deadband is a one-way rat' +option-desc 4167af90cfc2 # en.yaml over 30 words (288); banned: SAFETY-42, delivery_window.py, saturation; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY; with one inverter this check cannot fire a' +option-desc 3c0898cc1149 # en.yaml over 30 words (63) :: 'What you are paid for feeding a kWh back into the grid, all in. One nu' +option-desc 05560996cb2e # en.yaml capitals: MEASURED ON REAL HARDWARE :: 'How much of the remaining error the loop corrects each cycle. MEASURED' +option-desc f225d7a8f3a5 # en.yaml over 30 words (32); banned: watchdog :: 'How often the setpoint is rewritten even when it has not changed. It m' +option-desc ef70d16a93bd # en.yaml over 30 words (98); banned: clamp, saturation :: 'Caps how much stale error can be waiting to unwind when the sign flips' +option-desc bde7357af38d # en.yaml over 30 words (107); capitals: EMPTY DOES NOT MEAN :: 'Leave this empty unless the site really has more than one inverter. EM' +option-desc 217c5ae9599c # en.yaml over 30 words (66); banned: 0x0560, register :: "The percent at which THIS pack's own battery management system cuts ou" +option-desc 746a0f9ae506 # en.yaml over 30 words (143) :: "THIS pack's usable capacity in kilowatt-hours, from its datasheet or i" +option-desc cb6ad204f59d # en.yaml over 30 words (52) :: 'The supervised ceiling on what may be written to THIS inverter; the si' +option-desc 46142bcc1ab1 # en.yaml over 30 words (36); banned: heartbeat, latch :: 'A short identifier for this inverter, for example inverter-a. It gives' +option-desc d787e9f2454d # en.yaml over 30 words (63); banned: arbiter; capitals: MUST STAY AT OR BELOW :: '⚠️ MUST STAY AT OR BELOW the inverter rating, and the add-on refuses t' +option-desc a90fced63631 # en.yaml over 30 words (52); banned: CLAMPED :: 'How fast the cycle drains the pack; the surplus is exported. Above the' +option-desc ab58c8fae4fb # en.yaml over 30 words (57); capitals: THIS IS NOT THE PEAK GUARD :: 'The depth the monthly recalibration deliberately goes to, once a month' +option-desc 73f51bdd3d6e # en.yaml over 30 words (83); capitals: THIS IS YOUR NUMBER :: 'THIS IS YOUR NUMBER, not a derived one: the hard ceiling on what may e' +option-desc dd9023e6c812 # en.yaml over 30 words (45); capitals: POSITIVE MUST MEAN DRAWING FROM THE GRID :: "The net grid power sensor, used when the meter source is 'off'. POSITI" +option-desc aa5b929f3c22 # en.yaml over 30 words (114); banned: SAFETY-18, latch; capitals: NOT CHOSEN :: 'MEASURED, NOT CHOSEN (SAFETY-18). How long the meter may keep answerin' +option-desc 1b3038c5c9e5 # en.yaml over 30 words (46) :: 'Beyond this the grid figure counts as missing. On its own it does not ' +option-desc bbf26329f056 # en.yaml over 30 words (48); banned: telegram, telegrams :: 'Must match your connection. A telegram whose phase count disagrees is ' +option-desc 92da72e54e77 # en.yaml over 30 words (52) :: "For meter source homewizard_local only. 5 s is the meter's own update " +option-desc 24f329136309 # en.yaml over 30 words (84) :: "'off' keeps the single Home Assistant entity below, which is what an e" +option-desc 47e5fa0dba52 # en.yaml banned: register :: 'The UNSIGNED injection register, the counterpart of the import registe' +option-desc 9b8f5ea6c656 # en.yaml banned: 192.168.2.250 :: "For meter source homewizard_local only: the meter's own address on you" +option-desc d5d3e30ac4d2 # en.yaml over 30 words (37); banned: register :: 'The UNSIGNED consumption register. Do not point this at a signed templ' +option-desc 0b05d89400ba # en.yaml over 30 words (39) :: 'For meter source ha_signed only. ONE signed sensor: positive is drawn ' +option-desc e74a5db257e1 # en.yaml over 30 words (46) :: 'For meter source ha_signed only. Optional, in L1..L3 order, each signe' +option-desc 3f07a88a61fd # en.yaml over 30 words (34); capitals: THIS IS YOUR NUMBER :: 'THIS IS YOUR NUMBER: the quarter-hour average demand the peak guard tr' +option-desc 6ec195081ef9 # en.yaml over 30 words (112); banned: SAFETY-24; capitals: IT BOUNDS THE PEAK GUARD ONLY :: 'DERIVED, not picked (SAFETY-24): the reference pack holds 13.8 kWh usa' +option-desc 228fdc168458 # en.yaml over 30 words (270); capitals: INJECTION IS EXEMPT FROM VAT :: 'Optional, and only if your supplier pays you a price that moves with t' +option-desc 98987808a7f0 # en.yaml over 30 words (98); capitals: WHAT YOU TYPE IS SENT EXACTLY AS WRITTEN :: "Leave empty to use the chosen source's own feed. Only a host that sour" +option-desc 26f17751b2f7 # en.yaml over 30 words (234); capitals: IN THE UNITS THE CARD PRINTS :: "For price source custom_formula only: your own contract's two coeffici" +option-desc 011841a82d7d # en.yaml over 30 words (34) :: "Your supplier's margin. The add-on adds it ONLY when the chosen price " +option-desc d34ef16ba99a # en.yaml over 30 words (63) :: 'The older way of getting a price, kept because retiring it would take ' +option-desc c70929091e71 # en.yaml over 30 words (252); capitals: SWITCHING THIS ON IS WHAT STARTS THE PRICE FETCH :: "Where day-ahead or real-time prices come from. 'off' is what ships, an" +option-desc a62e17ccf445 # en.yaml over 30 words (230); banned: TARIFF-18; capitals: THIS NUMBER IS NOT :: 'Everything on your bill that is not the energy itself - distribution, ' +option-desc 56d56f58c43e # en.yaml over 30 words (206); capitals: THE NUMBERS HERE ARE THE LEVIES ALONE :: 'Leave this empty unless your network tariff really does charge a diffe' +option-desc 313bdd035b0b # en.yaml over 30 words (193); capitals: MEASUREMENT ONLY :: 'Optional, and MEASUREMENT ONLY - it changes no control behaviour whats' +option-desc 4172d9920d65 # en.yaml over 30 words (128); capitals: MEASUREMENT ONLY :: 'Optional, and MEASUREMENT ONLY - it changes no control behaviour whats' +option-desc 09ceba2c6afb # en.yaml over 30 words (70); banned: clamp; capitals: MEASUREMENT ONLY :: 'Optional, MEASUREMENT ONLY. Some sensors - typically a kWh meter or a ' +option-desc 42a7eaac6ff1 # en.yaml banned: saturated :: 'How many consecutive saturated cycles before the loop stops winding up' +option-desc 12b0dffec9dd # en.yaml over 30 words (42) :: 'The gap between what was commanded and what the inverter delivers that' +option-desc 91fd58c08a59 # en.yaml over 30 words (54) :: 'The ESPHome number entity this add-on writes the power setpoint to, no' +option-desc 01e1af709cd5 # en.yaml over 30 words (201); banned: arbiter, clamps, heartbeat, latch :: 'Runs the whole decision path — strategies, arbiter, clamps and guards ' +option-desc 96b077d4e2e9 # en.yaml over 30 words (72); banned: SAFETY-02; capitals: NOT CHOSEN :: 'MEASURED, NOT CHOSEN (SAFETY-02). How long the setpoint and the meter ' +option-desc addf5c495ae8 # en.yaml over 30 words (90); banned: SAFETY-02, watchdog; capitals: NOT CHOSEN :: 'MEASURED, NOT CHOSEN (SAFETY-02). Both the setpoint being emitted and ' +option-desc 0a66ac772b27 # en.yaml over 30 words (117); banned: SAFETY-30; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY. DERIVED FROM 1890 CLOSED-LOOP TEST RUNS (S' +option-desc c0deabb69ab6 # en.yaml over 30 words (60); banned: SAFETY-30; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY. The same 300 W as the single-inverter thre' +option-desc 7d7272743277 # en.yaml over 30 words (123); banned: SAFETY-39; capitals: MEANS FOLLOW THE INVERTER RATING :: 'How far the setpoint may move in one control cycle. ⚠️ 0 MEANS FOLLOW ' +option-desc 436efca21a7d # en.yaml over 30 words (31) :: "The sensor that reports the pack's state of charge in percent. Use the" +option-desc 9ac8a3b21a1e # en.yaml over 30 words (43) :: 'How long the inputs may be missing before the add-on commands 0 W. Wit' +option-desc 86cbfd6a5693 # en.yaml over 30 words (130); capitals: RECOMMENDED EVEN ON :: 'Your fixed or day/night contract, written as a single line of JSON. RE' +option-desc 996dffbf563d # en.yaml over 30 words (74); banned: register :: 'What the meter should sit at when nothing is happening; negative means' +option-desc faf346256008 # en.yaml over 30 words (52); banned: SAFETY-30; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY. DERIVED FROM 1890 CLOSED-LOOP TEST RUNS (S' +option-desc 5323134f3131 # en.yaml over 30 words (95); banned: SAFETY-30, saturation; capitals: TWO OR MORE INVERTERS ONLY :: 'TWO OR MORE INVERTERS ONLY; with one inverter this setting does nothin' +option-name ca3a62bb8260 # en.yaml over 6 words (7) :: 'Circulating-power hold (s) — derived, do not change' +option-name edee163fdc2b # en.yaml over 6 words (7) :: 'Circulating-power threshold (W) — measured, do not change' +option-name 99b3beeab621 # en.yaml over 6 words (7) :: 'Cost of one full charge/discharge cycle (EUR/kWh)' +option-name cccd8a42f51a # en.yaml over 6 words (8) :: 'Not-delivering report after (s) — derived, do not change' +option-name 989891e2ce23 # en.yaml over 6 words (10); banned: Integrator :: 'Integrator bound (W, 0 means the same as the rating)' +option-name 42c6b595320c # en.yaml over 6 words (9) :: 'Inverter list (leave empty if you have one inverter)' +option-name 230e6dc9d872 # en.yaml over 6 words (7) :: 'Hour of day a due cycle starts' +option-name 18e1de907c54 # en.yaml over 6 words (8) :: 'Frozen-meter alarm after (s) — measured, do not change' +option-name 9071c4cfa460 # en.yaml over 6 words (7) :: 'A reading counts as stale after (s)' +option-name e3d06ed93e2e # en.yaml banned: register :: 'Export register entity (W)' +option-name a0f59ea5de36 # en.yaml banned: register :: 'Import register entity (W)' +option-name ed757924f40f # en.yaml over 6 words (7) :: 'Per-phase signed net entities (L1, L2, L3)' +option-name 52d03808da01 # en.yaml over 6 words (8) :: 'Your own INJECTION formula (one line of JSON)' +option-name bf22f2121af4 # en.yaml over 6 words (8) :: 'Your own tariff formula (one line of JSON)' +option-name 5593992fcf5b # en.yaml over 6 words (7) :: 'How far ahead to fetch prices (hours)' +option-name d9fee5514a4b # en.yaml over 6 words (11) :: 'Levies and VAT by time of day (one line of JSON)' +option-name 7d8d691905e0 # en.yaml over 6 words (7) :: 'PV production entities, one per inverter (W)' +option-name eac7ee084aaa # en.yaml banned: Saturated :: 'Saturated cycles before freezing (count)' +option-name 5c6bbc5cab40 # en.yaml banned: Saturation :: 'Saturation threshold (W)' +option-name 99a1ec154d36 # en.yaml over 6 words (7) :: 'Shadow mode — run every decision, command nothing' +option-name 82fcd0faa687 # en.yaml over 6 words (8); banned: watchdog :: 'Sign watchdog hold (s) — measured, do not change' +option-name 8fc34172dc01 # en.yaml over 6 words (8); banned: watchdog :: 'Sign watchdog threshold (W) — measured, do not change' +option-name 8516934704f5 # en.yaml over 6 words (8) :: 'Site-wide sign hold (s) — derived, do not change' +option-name 2b8278ab2b16 # en.yaml over 6 words (8) :: 'Site-wide sign threshold (W) — measured, do not change' +option-name bd52e795ea97 # en.yaml over 6 words (8) :: 'Command 0 W after inputs missing for (s)' +option-name 9e33febf4481 # en.yaml over 6 words (8) :: 'Fixed or day/night tariff (one line of JSON)' +option-name 40e1e3ba3841 # en.yaml over 6 words (8) :: 'Per-inverter sign hold (s) — derived, do not change' +option-name 4ba7087578dc # en.yaml over 6 words (8) :: 'Per-inverter sign threshold (W) — derived, do not change' +refusal 87620efa0704 # p1.py:1176 banned: telegram :: 'p1_phase_net_entities has {len(phase_net)} entities but meter_phases i' +refusal 5d1b8147792b # p1.py:1186 banned: 192.168.2.250 :: "meter_source {SOURCE_HOMEWIZARD} needs p1_host (the meter's own addres" +refusal 701db346696d # validate.py over 30 words (85); banned: SAFETY-30, watchdog :: 'unit_sign_disagree_w is {unit_sign_w} W but max_w{unit_where} is {weak' +refusal 710b4d89a9d7 # validate.py over 30 words (88); banned: ARBITER, arbiter; capitals: THE CEILING WINS :: 'maintenance_charge_w is {charge_w} W but max_w{maint_where} is {maint_' +refusal 16d40434116b # validate.py over 30 words (193); banned: NOTES.md, §5; capitals: THE PLANT WINS :: 'slew_w is {slew_w} W against a site rail of {rail} W, so the loop cros' +refusal 613375fb6b5f # validate.py over 30 words (107); banned: SAFETY-07; capitals: THE BMS WINS :: "peak_soc_floor is {soc_floor} % but the pack's own cut-out (bms_soc_fl" +refusal ba21c5ba8c0d # validate.py over 30 words (224); banned: TARIFF-07, §1; capitals: IT HAS NEVER FETCHED :: 'price_provider is {pid}, which WAS a shipped plugin and has been WITHD' +refusal de8df32186b6 # validate.py over 30 words (46); banned: §1 :: 'price_provider is {pid}, which is not a shipped plugin. The ids that e' +refusal 0ee7c15eafef # validate.py over 30 words (103); banned: arbitrage.py, main.py, static_tariff.py; capitals: THE HOME ASSISTANT ENTITIES WIN :: "price_provider is {pid} AND {' and '.join(ha_price)} {'is' if len(ha_p" +refusal c4149a762c39 # validate.py over 30 words (62); banned: main.py; capitals: THE HOME ASSISTANT ENTITIES WIN :: "static_profile is set AND {' and '.join(ha_price)} {'is' if len(ha_pri" +refusal 6af34466bbc2 # validate.py over 30 words (83); capitals: THE TABLE WINS :: '{TAXES_PROFILE_OPTION} is set AND price_taxes_eur_kwh is {scalar} rath' +refusal 8f69bdbbf3fc # validate.py over 30 words (55) :: '{TAXES_PROFILE_OPTION} carries {steep} EUR/kWh. Belgian levies and dis' +refusal 96a090d2ad97 # validate.py over 30 words (72); banned: DOCS.md, §1 :: "price_provider is 'custom_formula' but price_formula is empty, so the " +refusal db9d0d53c4f1 # validate.py over 30 words (45); banned: §1 :: "cycle_cost_threshold_eur is {opts.get('cycle_cost_threshold_eur')} and" +refusal 58ccb3bbd560 # validate.py over 30 words (63); banned: §1; capitals: NO PRICES AT ALL :: "arbitrage_enabled is on but price_provider is 'off' and static_profile" +refusal 780592c897fb # validate.py over 30 words (85); banned: arbitrage.py, telegram, §9 :: "arbitrage_enabled is on but meter_source is 'off', so there is no P1 t" +refusal 4f80c091ca95 # validate.py over 30 words (69) :: 'arbitrage_soc_floor is {floor} % and arbitrage_soc_ceiling is {ceiling' +refusal 0c089bb2f200 # validate.py over 30 words (57); banned: §1 :: "price_provider is 'manual_csv' but price_csv_path is empty, so the off" +refusal 152dfec79224 # validate.py over 30 words (48); banned: SAFETY-02, heartbeat, latch :: '{where} has no name. Every inverter needs one: the Store namespaces th' +refusal eb14af760f5c # validate.py over 30 words (51); banned: SAFETY-02, heartbeat, latch :: '{where} and {seen[name]} are both called {name}. The Store keys every ' +refusal 36f53c989b4a # validate.py over 30 words (55) :: '{who} has no setpoint_entity, so this add-on cannot command it. It wou' +refusal c98c6ab66e9f # validate.py over 30 words (56) :: "{who} has no usable max_w (got {entry.get('max_w')}). It is the superv" +refusal 5ca16a4d0a1e # validate.py over 30 words (71) :: '{who} has capacity_kwh {raw}, which is not a usable number of kilowatt' +refusal 63a864d2e0a3 # validate.py over 30 words (73) :: "capacity_kwh is stated on {', '.join(stated)} and left empty on {', '." +refusal 8d82500ecb1d # validate.py over 30 words (64) :: 'setpoint_entity is set to {flat_sp} AND an inverters list of {len(entr' +refusal 3d778e0ab5e1 # validate.py over 30 words (36); capitals: THE DEVICE WINS :: '{name}: max_w is {cap} W but {entity} accepts at most {float(dev_max)}' +refusal ecd0883f5649 # validate.py over 30 words (36); capitals: THE DEVICE WINS :: '{name}: max_w is {cap} W, so this controller may command {-cap} W, but' +refusal eff7efac51f8 # validate.py over 30 words (56); banned: heartbeat :: 'setpoint_entity is not set, so this add-on has no actuator: every writ' +refusal b126f1a88b77 # validate.py over 30 words (76); banned: §1 :: '{len(who)} configured writers can reach the one actuator {actuator}: {' +refusal 07a88756c864 # validate.py over 30 words (48); banned: arbiter :: 'max_w is {max_w} W and must be positive - it is a magnitude, not a sig' +refusal c4a1d0371e31 # validate.py over 30 words (42); capitals: THE DEVICE WINS :: "max_w is {max_w} W but {opts.get('setpoint_entity') or 'the setpoint d" +refusal a15624d1aa10 # validate.py over 30 words (33); capitals: THE DEVICE WINS :: 'max_w is {max_w} W, so this controller may command {-max_w} W, but {op' +refusal 26d0602c32d7 # validate.py over 30 words (79); capitals: THE FIRMWARE WINS :: 'meter_max_age_s is {max_age_s} s but the ESP32 firmware vetoes any P1 ' +refusal 2ade09aaa579 # validate.py over 30 words (73); banned: SAFETY-02, arbiter, watchdog :: 'sign_disagree_w is {sign_w} W but max_w{where} is {weakest} W, so the ' +row c24ab8bd9cb3 # main.py over 15 words (18); banned: heartbeat, layer 1; capitals: NO PASS FOR :: 'control loop: NO PASS FOR {_pass_age} s (layer 1 zeroes the inverter a' +row c771d4bc1e0a # main.py over 15 words (17); banned: telegrams :: "P1 meter ({o.get('meter_source')}): {self.p1.net_w} W, {age} s old, {s" +row f6195fee8575 # main.py over 15 words (33); capitals: METER MAY BE FROZEN :: 'METER MAY BE FROZEN - {…}. The loop is STILL FOLLOWING it and is still' +row db05be7cd99c # main.py over 15 words (16); option key: meter_source; capitals: NOT COVERED :: "freeze detector: NOT COVERED on meter_source {o.get('meter_source')} -" +row 9a21960bbbe8 # main.py capitals: NOT COVERED :: 'freeze detector: NOT COVERED - {…}' +row c38b746a6585 # main.py banned: SATURATED; capitals: PEAK GUARD SATURATED :: 'PEAK GUARD SATURATED - {…}' +row dd0629834473 # main.py over 15 words (36); banned: SAFETY-25; option key: peak_soc_floor; capitals: THE PEAK GUARD ONLY :: '{…}. NOTE: peak_soc_floor bounds THE PEAK GUARD ONLY - it is not a pac' +row 4132e246e675 # main.py over 15 words (26); banned: telegrams; option key: meter_source; capitals: NOT COVERED :: "peak guard: NOT COVERED on meter_source {o.get('meter_source')} - the " +row 7b34b16d8bb2 # main.py over 15 words (61) :: '{label}: no usable value this cycle from {entity} - and this row canno' +row 04e0381f16c2 # main.py banned: CLAMP; capitals: OUTPUT CLAMP ENGAGED :: 'OUTPUT CLAMP ENGAGED - {…} Engagements: {self.clamp_wd.engagements}.' +row 9f8b8adcbc6c # main.py banned: INTEGRATOR; capitals: LOOP AT INTEGRATOR BOUND :: 'LOOP AT INTEGRATOR BOUND - {…} Engagements: {self.clamp_wd.engagements' +row f00cc9688eca # main.py over 15 words (20); banned: clamp :: 'output clamp: not engaged now, but it has engaged {self.clamp_wd.engag' +row a44333431331 # main.py over 15 words (31); capitals: SIGN-DISAGREEMENT FAILSAFEX :: 'SIGN-DISAGREEMENT FAILSAFE{tag} - {…}. The inverter is held at 0 W. Fi' +row 3ef4e60f2328 # main.py over 15 words (17) :: 'sign watchdog{tag}: armed{vs} (trips after {inv.sign_wd.cfg.hold_s} s ' +row 9f879b339282 # main.py over 15 words (50); banned: integrator; capitals: SITE SIGN-DISAGREEMENT FAILSAFE :: 'SITE SIGN-DISAGREEMENT FAILSAFE - {…}. EVERY inverter is held at 0 W. ' +row 96e93e34bdbf # main.py over 15 words (24); banned: watchdog :: 'site sign watchdog: armed against the sum of the commands (trips after' +row 9ee8d293fea5 # main.py over 15 words (38); capitals: CIRCULATING POWER :: 'CIRCULATING POWER - {…}. EVERY inverter is held at 0 W. The meter cann' +row 55eb950acd5f # main.py over 15 words (17); banned: watchdog :: 'circulation watchdog: armed (trips after {self.circ_wd.cfg.hold_s} s o' +row 1817192a7f1c # main.py over 15 words (42); capitals: NOT DELIVERINGX :: 'NOT DELIVERING{tag} - {…}. Nothing has been commanded differently and ' +row 685c1416364b # main.py over 15 words (26) :: 'delivery watchdog{tag}: armed (reports after {inv.delivery_wd.cfg.hold' +row d3cd52827dd0 # main.py over 15 words (29); banned: watchdog :: 'delivery watchdog: n/a at one inverter - a unit short of its share is ' +row d6981c8d7b56 # main.py banned: latched :: 'no e-stop fitted: if this host dies the battery stays latched at its l' +row 685c8f02c97a # main.py capitals: NO SITE TOTAL :: 'PV production: NO SITE TOTAL - {…}. Reporting: {…}' +row abef339bf192 # main.py over 15 words (25); option key: pv_entities :: 'PV production: `pv_entities` is set, so `pv_entity` is IGNORED - the {' +row 514511bd0a93 # main.py over 15 words (32); option key: pv_invert_entities :: 'PV production: {ent} reads {watt} W - far below zero, so its sign is p' +row 328abd6171ce # main.py over 15 words (22); option key: pv_invert_entities :: 'PV production: `pv_invert_entities` names {ent}, which is not a PV ent'