v0.14.2-connectivity

This commit is contained in:
Mateusz Gruszczyński
2026-09-15 10:02:49 +02:00
parent 2fd7e47eb9
commit c3f6e773f8
41 changed files with 1295 additions and 108 deletions
+11 -2
View File
@@ -36,6 +36,9 @@ SETTINGS_PATHS: dict[str, set[str]] = {
"zone_interval_seconds",
"discovery_timeout_ms",
"discovery_broadcast",
"ping_metrics_enabled",
"ping_interval_seconds",
"ping_sample_count",
"suppress_device_beep",
"compressor_protection_enabled",
"compressor_protection_seconds",
@@ -46,9 +49,13 @@ SETTINGS_PATHS: dict[str, set[str]] = {
"username",
"password_configured",
"polling_interval_seconds",
"connectivity_metrics_enabled",
"connectivity_metrics_interval_seconds",
"connectivity_metrics_sample_count",
"installation_id",
"account_id",
"last_successful_contact",
"last_rest_response_time_ms",
},
"/api/settings/history": {"retention_days", "compaction_enabled", "event_retention_days"},
"/api/settings/influxdb": {
@@ -111,6 +118,7 @@ SAFE_GET_PATHS = [
"/api/flows",
"/api/readings",
"/api/history",
"/api/history/network",
"/api/control-plan",
"/api/events",
"/api/access-tokens",
@@ -135,8 +143,8 @@ DETAIL_COLLECTIONS = [
("/api/flows", "/api/flows/{id}"),
]
# The beta cloud endpoints are not yet regenerated into the static OpenAPI file.
EXPECTED_OPENAPI_PATHS = (set(SETTINGS_PATHS) - {"/api/settings/gree-cloud"}) | {
EXPECTED_OPENAPI_PATHS = set(SETTINGS_PATHS) | {
"/api/history/network",
"/api/configuration/export",
"/api/configuration/import",
"/api/integrations/home-assistant/snapshot",
@@ -319,6 +327,7 @@ def convert_settings_view_to_update(path: str, view: dict[str, Any]) -> dict[str
payload.pop("installation_id", None)
payload.pop("account_id", None)
payload.pop("last_successful_contact", None)
payload.pop("last_rest_response_time_ms", None)
elif path == "/api/settings/notifications":
payload.pop("pushover_configured", None)
payload.pop("slack_configured", None)
+12
View File
@@ -58,6 +58,7 @@ assert isinstance(settings, dict), "bootstrap.settings missing"
paths = {
"application": "/api/settings/application",
"gree": "/api/settings/gree",
"gree_cloud": "/api/settings/gree-cloud",
"history": "/api/settings/history",
"influxdb": "/api/settings/influxdb",
"notifications": "/api/settings/notifications",
@@ -73,6 +74,7 @@ for section, path in paths.items():
assert "password" not in settings["influxdb"]
assert "token" not in settings["influxdb"]
assert "password" not in settings["gree_cloud"]
assert "token" not in settings["home_assistant"]
for secret in ("pushover_app_token", "pushover_user_key", "slack_webhook_url", "discord_webhook_url"):
assert secret not in settings["notifications"], f"secret field leaked: {secret}"
@@ -88,6 +90,16 @@ curl -fsS -X POST \
grep -q '"ok":true' "$TMP/probe.json"
grep -q '"response_time_ms":0' "$TMP/probe.json"
curl -fsS "http://127.0.0.1:$PORT/api/history/network?hours=24&limit=100" >"$TMP/network-history.json"
python3 - "$TMP/network-history.json" <<'PYNETWORK'
import json, sys
data = json.load(open(sys.argv[1], encoding="utf-8"))
assert isinstance(data.get("readings"), list)
assert isinstance(data.get("targets"), list)
assert isinstance(data.get("bucket_seconds"), int) and data["bucket_seconds"] > 0
assert isinstance(data.get("storage"), str) and data["storage"]
PYNETWORK
curl -fsS -X POST -H 'Content-Type: application/json' \
-d '{"name":"Test","device_id":"sim-salon","enabled":true,"mode":"cool","setpoint":23,"hysteresis":0.6,"min_on_seconds":0,"min_off_seconds":0,"sensor_source":"device"}' \
"http://127.0.0.1:$PORT/api/zones" >"$TMP/zone.json"