Add autopilot light workflow
This commit is contained in:
@@ -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.12"
|
||||
assert config["version"] == "2.0.0-alpha.13"
|
||||
assert config["ingress"] is True
|
||||
assert config["ingress_port"] == 8099
|
||||
assert config["homeassistant_api"] is True
|
||||
|
||||
@@ -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.12"
|
||||
assert health.json()["version"] == "2.0.0-alpha.13"
|
||||
assert backup.status_code == 200
|
||||
assert restore.status_code == 200
|
||||
assert restore.json() == {"status": "restored"}
|
||||
@@ -39,6 +39,13 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
|
||||
entity_id="binary_sensor.storage_door",
|
||||
domain="binary_sensor",
|
||||
state="off",
|
||||
area_name="Storage",
|
||||
),
|
||||
"light.storage_door": EntityState(
|
||||
entity_id="light.storage_door",
|
||||
domain="light",
|
||||
state="off",
|
||||
area_name="Storage",
|
||||
),
|
||||
}
|
||||
)
|
||||
@@ -104,6 +111,11 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
|
||||
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")
|
||||
autopilot = client.post("/v2/autopilot/run")
|
||||
candidates = client.get("/v2/autopilot/candidates")
|
||||
accepted = client.post(
|
||||
f"/v2/autopilot/candidates/{autopilot.json()['candidates'][0]['candidate_id']}/accept"
|
||||
)
|
||||
jobs = client.get("/v2/jobs")
|
||||
dashboard = client.get("/v2/dashboard")
|
||||
|
||||
@@ -111,6 +123,7 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
|
||||
assert [item["entity_id"] for item in entities.json()] == [
|
||||
"binary_sensor.storage_door",
|
||||
"light.storage",
|
||||
"light.storage_door",
|
||||
]
|
||||
assert control.status_code == 200
|
||||
assert control.json()["stage"] == "dry_run"
|
||||
@@ -147,8 +160,12 @@ def test_dashboard_control_and_learning_endpoints(tmp_path, monkeypatch) -> None
|
||||
assert evaluation.json()[0]["verdict"] in {"bereit", "weiter testen"}
|
||||
assert evaluations.status_code == 200
|
||||
assert evaluations.json()
|
||||
assert autopilot.status_code == 200
|
||||
assert autopilot.json()["candidates"]
|
||||
assert candidates.status_code == 200
|
||||
assert accepted.status_code == 200
|
||||
assert jobs.status_code == 200
|
||||
assert jobs.json()
|
||||
assert dashboard.status_code == 200
|
||||
assert dashboard.json()["actuator_count"] == 1
|
||||
assert dashboard.json()["actuator_count"] == 2
|
||||
assert dashboard.json()["automation_proposals"] == 1
|
||||
|
||||
Reference in New Issue
Block a user