From 7edf8484d110cdeb23f15f91856e8d9b1da92930 Mon Sep 17 00:00:00 2001 From: glenn schrooyen Date: Fri, 13 Nov 2026 03:57:31 +0100 Subject: [PATCH] MAINT-28: test_maint28 reads the replay clock directly (main_files.live parsed every app file per cycle): 269 s -> 28 s, same numbers Co-Authored-By: Claude --- goodwe_controller/test_maint28.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/goodwe_controller/test_maint28.py b/goodwe_controller/test_maint28.py index 8a72c97..fc29cf1 100644 --- a/goodwe_controller/test_maint28.py +++ b/goodwe_controller/test_maint28.py @@ -33,10 +33,9 @@ sys.path.insert(0, HERE) sys.path.insert(0, os.path.join(HERE, "tools")) logging.disable(logging.WARNING) -import main_files # noqa: E402 import opt11p3_replay as rp # noqa: E402 import opt20_scen as sc # noqa: E402 -from app import peakguard, tariff # noqa: E402 +from app import ctl_cycle, peakguard, tariff # noqa: E402 from app.maintenance import DRAIN, IDLE, MaintResult # noqa: E402 fails = [] @@ -100,7 +99,9 @@ def scen(*, a=None, tick=None, soc=(49.0, 30.0), house=None, house_w=3000.0, if fc == "grid": c.peak_fc = g else: - now = main_files.live.datetime.now() + # the replay's clock; not main_files.live (it parses + # every app file per access: ~0.1 s a cycle). + now = ctl_cycle.datetime.now() qi = int(now.timestamp() // 900) if q["q"] != qi: q.update(q=qi, s=0.0, last=now, start=now)