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
+7
View File
@@ -1693,3 +1693,10 @@ Energy endpoints:
- `GET /api/history/energy?device_id=...&interval=hourly|daily|weekly|monthly&source=auto|gree_cloud|home_assistant` returns consumption buckets and period summaries in kWh.
Cloud settings and diagnostics are redacted: passwords, REST/MQTT tokens, Authorization values and device cipher keys are not returned.
## Connectivity history — 0.14.2
`GET /api/history/network?hours=24&target_id=all` returns connectivity batches for Local/LAN units and, when enabled, controller-level `cloud:rest` and `cloud:mqtt` endpoints. Each reading contains `latency_ms`, `jitter_ms`, `packet_loss_pct`, `sample_count`, `successful_samples`, `target_kind` and `source`.
Local connectivity sampling is configured through `GET/PUT /api/settings/gree` using `ping_metrics_enabled`, `ping_interval_seconds` and `ping_sample_count`. Direct unit probes are Local/LAN-only. GREE Cloud connectivity sampling is configured through `GET/PUT /api/settings/gree-cloud` using `connectivity_metrics_enabled`, `connectivity_metrics_interval_seconds` and `connectivity_metrics_sample_count`; it is disabled by default and measures REST login response plus MQTT `PINGRESP` round-trip. Connectivity history follows the same SQLite retention/compaction and optional InfluxDB archive policy as other history metrics.
+235 -4
View File
@@ -4147,7 +4147,7 @@
"Settings"
],
"summary": "Get GREE settings",
"description": "Controller identity, polling/discovery and GREE command safety settings.",
"description": "Controller identity, polling/discovery, Local/LAN connectivity worker and GREE command safety settings.",
"operationId": "getGREESettings",
"security": [
{
@@ -4181,7 +4181,7 @@
"Settings"
],
"summary": "Update GREE settings",
"description": "Controller identity, polling/discovery and GREE command safety settings.",
"description": "Controller identity, polling/discovery, Local/LAN connectivity worker and GREE command safety settings.",
"operationId": "updateGREESettings",
"requestBody": {
"required": true,
@@ -4887,7 +4887,7 @@
"GREE Cloud"
],
"summary": "Update GREE Cloud settings",
"description": "Updates central GREE Cloud account/provider settings. Polling is clamped to 303600 seconds; changing account settings drops the existing MQTT session.",
"description": "Updates central GREE Cloud account/provider settings. Polling is clamped to 303600 seconds. Optional REST/MQTT connectivity metrics are disabled by default and can configure a 303600 second interval with 110 samples; changing account settings drops the existing MQTT session.",
"operationId": "updateGreeCloudSettings",
"security": [
{
@@ -5336,6 +5336,112 @@
}
}
}
},
"/api/history/network": {
"get": {
"tags": [
"History"
],
"summary": "Get connectivity and ping history",
"description": "Returns time-bucketed Local/LAN GREE UDP round-trip metrics and optional controller-level GREE Cloud REST/MQTT diagnostics, including latency, jitter and packet loss. Older data follows the same SQLite retention/compaction and optional InfluxDB archive policy as other history metrics.",
"operationId": "networkHistory",
"parameters": [
{
"name": "target_id",
"in": "query",
"required": false,
"description": "Local device id, cloud:rest, cloud:mqtt, or all/omitted for every target.",
"schema": {
"type": "string"
},
"example": "all"
},
{
"name": "hours",
"in": "query",
"required": false,
"description": "Lookback window in hours.",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 87600,
"default": 24
}
},
{
"name": "limit",
"in": "query",
"required": false,
"description": "Maximum number of returned rows.",
"schema": {
"type": "integer",
"minimum": 1,
"maximum": 50000,
"default": 20000
}
}
],
"security": [
{
"BearerToken": []
},
{
"ApiTokenHeader": []
}
],
"responses": {
"200": {
"description": "Connectivity history payload with readings, available targets and storage metadata.",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"readings": {
"type": "array",
"items": {
"$ref": "#/components/schemas/NetworkReading"
}
},
"targets": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"bucket_seconds": {
"type": "integer"
},
"storage": {
"type": "string"
},
"storage_warning": {
"type": [
"string",
"null"
]
}
},
"required": [
"readings",
"targets",
"bucket_seconds",
"storage"
],
"additionalProperties": false
}
}
}
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
}
}
}
},
"components": {
@@ -7981,6 +8087,25 @@
"type": "integer",
"minimum": 30,
"maximum": 1800
},
"ping_metrics_enabled": {
"type": "boolean",
"default": true,
"description": "Enable periodic Local/LAN connectivity measurements."
},
"ping_interval_seconds": {
"type": "integer",
"minimum": 10,
"maximum": 3600,
"default": 60,
"description": "Seconds between Local/LAN measurement batches."
},
"ping_sample_count": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 3,
"description": "Round-trip samples per Local/LAN measurement batch."
}
},
"required": [
@@ -8565,6 +8690,23 @@
],
"minimum": 0,
"description": "Duration in milliseconds of the most recent successful GREE Cloud REST operation."
},
"connectivity_metrics_enabled": {
"type": "boolean",
"default": false,
"description": "Opt-in GREE Cloud REST/MQTT connectivity history. Disabled by default."
},
"connectivity_metrics_interval_seconds": {
"type": "integer",
"minimum": 30,
"maximum": 3600,
"default": 300
},
"connectivity_metrics_sample_count": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 3
}
},
"required": [
@@ -8574,7 +8716,10 @@
"password_configured",
"polling_interval_seconds",
"installation_id",
"account_id"
"account_id",
"connectivity_metrics_enabled",
"connectivity_metrics_interval_seconds",
"connectivity_metrics_sample_count"
],
"additionalProperties": false
},
@@ -8602,6 +8747,23 @@
"type": "integer",
"minimum": 30,
"maximum": 3600
},
"connectivity_metrics_enabled": {
"type": "boolean",
"default": false,
"description": "Opt-in GREE Cloud REST/MQTT connectivity history. Disabled by default."
},
"connectivity_metrics_interval_seconds": {
"type": "integer",
"minimum": 30,
"maximum": 3600,
"default": 300
},
"connectivity_metrics_sample_count": {
"type": "integer",
"minimum": 1,
"maximum": 10,
"default": 3
}
},
"required": [
@@ -8875,6 +9037,75 @@
"runtime"
],
"additionalProperties": false
},
"NetworkReading": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"target_id": {
"type": "string",
"description": "Local device id or cloud:rest/cloud:mqtt."
},
"target_kind": {
"type": "string",
"enum": [
"device",
"cloud_service"
]
},
"timestamp": {
"type": "string",
"format": "date-time"
},
"latency_ms": {
"type": [
"number",
"null"
],
"minimum": 0
},
"jitter_ms": {
"type": [
"number",
"null"
],
"minimum": 0
},
"packet_loss_pct": {
"type": "number",
"minimum": 0,
"maximum": 100
},
"sample_count": {
"type": "integer",
"minimum": 0
},
"successful_samples": {
"type": "integer",
"minimum": 0
},
"source": {
"type": "string",
"enum": [
"local_udp",
"cloud_rest",
"cloud_mqtt"
]
}
},
"required": [
"id",
"target_id",
"target_kind",
"timestamp",
"packet_loss_pct",
"sample_count",
"successful_samples",
"source"
],
"additionalProperties": false
}
},
"responses": {