Skip to content

Commit c779a20

Browse files
chalfontchubbyclaude
authored andcommitted
test: move FoxESS/FoxCloud support_discharge_freeze check into test_inverter.py
Wasn't Teslemetry-specific - springfall2008 flagged it on PR review. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent 5d803ed commit c779a20

2 files changed

Lines changed: 21 additions & 16 deletions

File tree

‎apps/predbat/tests/test_inverter.py‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@
1818
from predbat import PredBat
1919
from const import MINUTE_WATT, INVERTER_MAX_RETRY_REST
2020
from inverter import Inverter, DISCHARGE_TARGET_UNSUPPORTED_MODELS
21+
from config import INVERTER_DEF
22+
23+
24+
def test_foxess_support_discharge_freeze_matches_foxcloud():
25+
"""
26+
FoxESS (modbus) and FoxCloud are the same hardware via two different connection methods - "feed-in
27+
first"/freeze export does not hold SoC flat on either, PV above the export limit still charges the
28+
battery instead of being clipped (#4207). FoxCloud's entry was already correctly False; FoxESS's was
29+
left True, so execute.py's fetch_inverter_data() never disabled set_export_freeze/set_export_freeze_only
30+
for modbus users, letting the planner offer a freeze option that couldn't actually do anything on the
31+
real inverter.
32+
"""
33+
failed = False
34+
if INVERTER_DEF["FoxESS"]["support_discharge_freeze"] is not False:
35+
print("ERROR: FoxESS support_discharge_freeze should be False, got {}".format(INVERTER_DEF["FoxESS"]["support_discharge_freeze"]))
36+
failed = True
37+
if INVERTER_DEF["FoxESS"]["support_discharge_freeze"] != INVERTER_DEF["FoxCloud"]["support_discharge_freeze"]:
38+
print("ERROR: FoxESS support_discharge_freeze ({}) should match FoxCloud ({}) - same hardware, different connection method".format(INVERTER_DEF["FoxESS"]["support_discharge_freeze"], INVERTER_DEF["FoxCloud"]["support_discharge_freeze"]))
39+
failed = True
40+
return failed
2141

2242

2343
def dummy_sleep(seconds):
@@ -2539,6 +2559,7 @@ def run_inverter_tests(my_predbat_dummy):
25392559

25402560
failed = False
25412561
print("**** Running Inverter tests ****")
2562+
failed |= test_foxess_support_discharge_freeze_matches_foxcloud()
25422563
ha = my_predbat.ha_interface
25432564

25442565
time_now = my_predbat.now_utc.strftime("%Y-%m-%dT%H:%M:%S%z")

‎apps/predbat/tests/test_teslemetry.py‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,21 +1082,6 @@ def test_teslemetry_inverter_def_tesla():
10821082
assert key in tesla, "TESLA INVERTER_DEF missing key {}".format(key)
10831083

10841084

1085-
def test_foxess_support_discharge_freeze_matches_foxcloud():
1086-
"""
1087-
FoxESS (modbus) and FoxCloud are the same hardware via two different connection methods - "feed-in
1088-
first"/freeze export does not hold SoC flat on either, PV above the export limit still charges the
1089-
battery instead of being clipped (#4207). FoxCloud's entry was already correctly False; FoxESS's was
1090-
left True, so execute.py's fetch_inverter_data() never disabled set_export_freeze/set_export_freeze_only
1091-
for modbus users, letting the planner offer a freeze option that couldn't actually do anything on the
1092-
real inverter.
1093-
"""
1094-
from config import INVERTER_DEF
1095-
1096-
assert INVERTER_DEF["FoxESS"]["support_discharge_freeze"] is False
1097-
assert INVERTER_DEF["FoxESS"]["support_discharge_freeze"] == INVERTER_DEF["FoxCloud"]["support_discharge_freeze"]
1098-
1099-
11001085
def test_teslemetry_component_registry_config():
11011086
"""Component registry exposes the automatic arg, can_restart, and the schema accepts teslemetry_automatic."""
11021087
from components import COMPONENT_LIST
@@ -1961,7 +1946,6 @@ def test_teslemetry(my_predbat=None):
19611946
test_teslemetry_backup_reserve_drift_correction_refreshes_cache_and_reasserts()
19621947
test_teslemetry_backup_reserve_drift_correction_no_spurious_resend_when_matching()
19631948
test_teslemetry_inverter_def_tesla()
1964-
test_foxess_support_discharge_freeze_matches_foxcloud()
19651949
test_teslemetry_component_registry_config()
19661950
test_teslemetry_site_info_publishes_rate_and_limit()
19671951
test_teslemetry_site_info_limit_kw_normalised()

0 commit comments

Comments
 (0)