diff --git a/goodwe_controller/CHANGELOG.md b/goodwe_controller/CHANGELOG.md index 3cd067c..9bc8f5f 100644 --- a/goodwe_controller/CHANGELOG.md +++ b/goodwe_controller/CHANGELOG.md @@ -2,6 +2,7 @@ ### Not in a release yet +- **The add-on log now says when the add-on sets a new car current or the car mode changes.** One line each, for example "Car: set from 10 A to 6 A on 1 phase (Manual)." and "Car mode is now Manual." It names the reason: Manual, Solar, peak cut, start-up or shutdown. A refused write adds no such line, and nothing is written or timed differently ([[EV-52]]). - **Solar now lowers the car first for the peak limit.** When the 15-minute period heads over the limit, Solar lowers the car before the batteries give more, and brings it back when the period allows. One grey note says "Solar lowered the car for the peak." A Solar car the add-on cannot lower (another writer, shadow mode, a stop) no longer hides a peak alarm. Manual and Off do not change. See "Car charger" in DOCS ([[EV-21]]). ## 0.25.0 diff --git a/goodwe_controller/app/ctl_car.py b/goodwe_controller/app/ctl_car.py index 46cd45c..caa9ba2 100644 --- a/goodwe_controller/app/ctl_car.py +++ b/goodwe_controller/app/ctl_car.py @@ -88,7 +88,8 @@ class CarMixin: ok = carmode.allowed_phases(opts) self.car_n = n if n in ok else ok[0] self.car_rev = 0 - if self.charger.configured(): # EV-52: the mode at the start + ch = getattr(self, "charger", None) + if ch is not None and ch.configured(): # EV-52: the mode at the start _LOG.info("Car mode is now %s.", carmode.MODE_LABELS[self.car_mode]) self.car_writer = carmode.ManualWriter() diff --git a/goodwe_controller/test_ev28.py b/goodwe_controller/test_ev28.py index 710537e..eae959f 100644 --- a/goodwe_controller/test_ev28.py +++ b/goodwe_controller/test_ev28.py @@ -57,8 +57,12 @@ class _Cap(logging.Handler): self.rec.append((r.levelno, r.getMessage())) def loud(self, since=0): - """INFO and above from `since` on.""" - return [m for lv, m in self.rec[since:] if lv >= logging.INFO] + """INFO and above from `since` on, but for EV-52's two plain lines + ("Car: set ..." for a taken write, "Car mode is now ..."): they are + asserted in test_ev52.py (T11, T13); this file's rows are about every + OTHER line a phase change may log.""" + return [m for lv, m in self.rec[since:] if lv >= logging.INFO + and not m.startswith(("Car: set", "Car mode is now"))] CAP = _Cap() diff --git a/goodwe_controller/test_ev51.py b/goodwe_controller/test_ev51.py index aabfc13..07e4500 100644 --- a/goodwe_controller/test_ev51.py +++ b/goodwe_controller/test_ev51.py @@ -624,7 +624,11 @@ GOOGLE.setLevel(logging.INFO) try: n = LOG.mark() r, st = run_log(go, dur=760, cyc=5, phase=0, race=True) - info = [(lv, m) for lv, m, _x in LOG.rec[n:]] + # EV-52 adds two plain INFO lines ("Car: set ...", "Car mode is now ..."); + # test_ev52.py asserts them. This row is about EV-51's own line, so they + # are set aside here and every other record must still be base's. + info = [(lv, m) for lv, m, _x in LOG.rec[n:] + if not m.startswith(("Car: set", "Car mode is now"))] finally: GOOGLE.setLevel(logging.DEBUG) # Measured on 5bff894 (same run, INFO), pinned: