Add HA history and model evaluation

This commit is contained in:
2026-06-18 17:08:23 +02:00
parent 07e3e96c30
commit 6e6031cfda
8 changed files with 170 additions and 11 deletions

View File

@@ -9,7 +9,7 @@ def test_addon_config_declares_future_addon() -> None:
config = yaml.safe_load(Path("addon/config.yaml").read_text(encoding="utf-8"))
assert config["slug"] == "sillyhome_future"
assert config["version"] == "2.0.0-alpha.11"
assert config["version"] == "2.0.0-alpha.12"
assert config["ingress"] is True
assert config["ingress_port"] == 8099
assert config["homeassistant_api"] is True

View File

@@ -19,7 +19,7 @@ def test_health_and_backup_roundtrip(tmp_path, monkeypatch) -> None: # type: ig
restore = client.post("/v2/backup/restore", json=backup.json())
assert health.status_code == 200
assert health.json()["version"] == "2.0.0-alpha.11"
assert health.json()["version"] == "2.0.0-alpha.12"
assert backup.status_code == 200
assert restore.status_code == 200
assert restore.json() == {"status": "restored"}
@@ -102,6 +102,8 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
json={"entity_ids": ["binary_sensor.storage_door"]},
)
models = client.post("/v2/models/train", json={"actuator_entity_id": "light.storage"})
evaluation = client.post("/v2/models/evaluate", json={"actuator_entity_id": "light.storage"})
evaluations = client.get("/v2/models/evaluations")
jobs = client.get("/v2/jobs")
dashboard = client.get("/v2/dashboard")
@@ -141,6 +143,10 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
assert history.json()[0]["entity_id"] == "binary_sensor.storage_door"
assert models.status_code == 200
assert models.json()[0]["actuator_entity_id"] == "light.storage"
assert evaluation.status_code == 200
assert evaluation.json()[0]["verdict"] in {"bereit", "weiter testen"}
assert evaluations.status_code == 200
assert evaluations.json()
assert jobs.status_code == 200
assert jobs.json()
assert dashboard.status_code == 200