cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.629: full source

This commit is contained in:
Setti Solutions S.R.L committed 2026-11-03 23:26:41 +02:00
1 parent d5fbcacaa4
commit 85edd56ec8
46 files changed
+3518 -267

No files matched your search

+21
View File
@@ -132,6 +132,27 @@ def test_tariff_and_fallbacks(tmp_path):
assert b.prices(start, 900, 1, start).note.startswith("no tariff")
def test_feed_in_at_zero_is_said(tmp_path):
"""Finding A1-a: where no export price is known the feed-in is 0 ct, and
the plan's note says so (no tariff, expired, no or a short export series)."""
b = Bundles(str(tmp_path), SITE, default_price_ct=33)
start = 1_800_000_000 // 900 * 900
p = b.prices(start, 900, 4, start)
assert p.export_ct == [0.0] * 4 and "feed-in at 0 ct/kWh" in p.note
t = {"v": 1, "kind": "tariff", "id": "t1", "site": SITE, "issued": start, "start": start, "step_s": 900,
"steps": 4, "expires": start + 7200, "currency": "EUR", "unit": "ct/kWh",
"import": [10, 10, 10, 10], "export": [5, 5, 5, 5]}
(tmp_path / "tariff.json").write_text(json.dumps(t))
assert b.prices(start, 900, 4, start).note == "tariff t1" # all priced: nothing to say
assert "feed-in at 0 ct/kWh" in b.prices(start, 900, 2, start + 7200).note # expired
t["export"] = [5, None, None, None]
(tmp_path / "tariff.json").write_text(json.dumps(t))
assert "feed-in at 0 ct/kWh in 3 of 4 steps" in b.prices(start, 900, 4, start).note
del t["export"]
(tmp_path / "tariff.json").write_text(json.dumps(t))
assert b.prices(start, 900, 4, start).note == "tariff t1; feed-in at 0 ct/kWh"
def test_model_bundle(tmp_path):
b = Bundles(str(tmp_path), SITE)
m = {"v": 1, "kind": "model", "id": "m1", "site": "*", "issued": 1,