This commit is contained in:
Mateusz Gruszczyński
2026-09-18 23:57:28 +02:00
parent 00cbe975bb
commit be3708f14d
17 changed files with 424 additions and 83 deletions
+5 -5
View File
@@ -1,6 +1,6 @@
# GREE Controller API reference
HTTP and WebSocket API for GREE Controller **0.15.7**.
HTTP and WebSocket API for GREE Controller **0.15.8**.
[← Main documentation](../README.md)
@@ -241,7 +241,7 @@ Response:
{
"status": "ok",
"name": "gree-controller",
"version": "0.15.7",
"version": "0.15.8",
"uptime_seconds": 1234,
"control_ready": true,
"time": "2026-08-30T06:54:00Z"
@@ -304,7 +304,7 @@ Returns the initial Web UI snapshot:
"control_plan": {"generated_at": "2026-09-04T08:00:00Z", "zones": [], "rules": []},
"control_plan_revision": 42,
"system": {
"version": "0.15.7",
"version": "0.15.8",
"uptime_seconds": 1234,
"auth_required": false,
"control_ready": true,
@@ -1711,9 +1711,9 @@ Cancellation suppresses the same pending intent until a new explicit thermostat/
### Flow portability and diagnostics
`GET /api/flows/:id/export` returns a versioned `gree-controller-flow` JSON document containing only the source graph. Generated schedules/automations are not exported.
`GET /api/flows/:id/export` returns a versioned `gree-controller-flow` JSON document containing the source graph plus definitions of every referenced Shared Input. Generated schedules/automations are not exported. The existing envelope may include an optional top-level `shared_inputs` array while leaving the `flow` object unchanged.
`POST /api/flows/import` accepts either that envelope or a direct Flow source payload, creates a new Flow ID/revision, and preserves draft state. Executable imports are validated and recompiled; draft imports remain disabled with no generated outputs.
`POST /api/flows/import` accepts either that envelope or a direct Flow source payload, creates a new Flow ID/revision, and preserves draft state. Executable imports are validated and recompiled; draft imports remain disabled with no generated outputs. When the envelope contains `shared_inputs`, the importer creates missing Shared Inputs automatically. If an imported Shared Input ID collides with a different local definition, an equivalent local source is reused when available; otherwise a new `shared-<uuid>` ID is created and the imported Flow node is remapped. The Flow and newly created Shared Inputs are saved in one database transaction.
`POST /api/flows/simulate` accepts `{ flow, flow_id?, at?, overrides?, log? }`. `at` is RFC3339. `overrides` maps Flow node IDs to simulated values. The endpoint validates and compiles the graph, evaluates every action and returns per-node traces plus `matched`, `would_execute` and `blocked_reason` (for example disabled zone/device, manual/local/temporary thermostat ownership, thermostat-output conflict or disabled Flow). It never mutates thermostat/device/group/schedule/automation state. Home Assistant read/attribute/parse failures evaluate safely as false and are visible in the trace instead of accidentally satisfying `NOT`/`neq` logic.
+2 -2
View File
@@ -54,7 +54,7 @@ The Flow editor exposes:
- per-node trace,
- `would_execute` and ownership/block reason,
- Flow-scoped execution/dry-run logs,
- import/export of versioned `.flow.json` source graphs.
- import/export of versioned `.flow.json` source graphs. Flow exports include the definitions of referenced Shared Inputs; import creates missing inputs automatically and remaps ID collisions without overwriting a different local input.
Dry-run never mutates thermostats, devices, groups, schedules or automations. For an existing Flow it clones persisted stateful runtime data, so timers, last-observed values, rate-limit history and rolling/oscillation windows are evaluated against the same saved state without writing it back.
@@ -68,7 +68,7 @@ Actions include thermostat zone, full GREE device command, single GREE function,
The editor ships 37 editable presets grouped into seven categories: Comfort, Energy & cost, Protection & safety, Night, Reliability, Home Assistant / heat sources and Advanced. The library UI also provides search, Favorites, Recent, a mini graph preview and requirement checks before applying a preset. The library includes workday/weekend comfort, weather-aware demand, morning boost, presence and energy-price eco modes, peak-power limiting, open-window/humidity/overheat/frost guards, night profiles, sensor/device resilience, dual heating/cooling thresholds, multi-room group control, nested AND/OR/NOT Home Assistant scenarios, and gas-boiler/external-heat-source coordination including off, reduced-target, boost and fallback heating patterns.
Shared Flow inputs show the Flows that reference them and link directly to those editors. Home Assistant-backed shared inputs can be tested live in the input modal. Shared inputs report the current raw value/attribute. Each Flow reference defines its own comparison without changing the shared source. Home Assistant temperature entities remain normal HA entities: room-temperature sensors are configured per zone, while outdoor temperature has one global `outdoor_entity_id` plus an optional per-zone `ha_outdoor_entity_id` override. Their aliases are shared with the rest of the UI, outdoor overrides are recorded in sensor metrics/history, and all configured entities are offered as suggestions in Home Assistant Flow blocks; selecting a zone sensor does not create a separate shared input.
Shared Flow inputs show the Flows that reference them and link directly to those editors. The Flow editor keeps the natural-language Interpretation / Flow cycle panel collapsed by default on every viewport and exposes it through a disclosure button. Home Assistant-backed shared inputs can be tested live in the input modal. Shared inputs report the current raw value/attribute. Each Flow reference defines its own comparison without changing the shared source. Home Assistant temperature entities remain normal HA entities: room-temperature sensors are configured per zone, while outdoor temperature has one global `outdoor_entity_id` plus an optional per-zone `ha_outdoor_entity_id` override. Their aliases are shared with the rest of the UI, outdoor overrides are recorded in sensor metrics/history, and all configured entities are offered as suggestions in Home Assistant Flow blocks; selecting a zone sensor does not create a separate shared input.
Presets are data files, not JavaScript definitions. Every preset lives in `presets/<id>.json` and contains `id`, `category`, localized `name`, localized `description`, and the complete `flow` graph (`nodes` + `edges`). `build.rs` validates and embeds the directory, exposes `/presets/index.json` plus `/presets/<file>.json`, and the Flow editor loads that library dynamically. Device/zone/group placeholders such as `$zone1`, `$zone2`, `$device1` and `$group1` are resolved when a preset is applied. Adding a preset therefore does not require adding graph-building code to `web/js-dynamic/flows.js`.
+39 -4
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "GREE Controller API",
"version": "0.15.7",
"version": "0.15.8",
"summary": "Local HTTP/WebSocket API for GREE Controller",
"description": "Local API used by the GREE Controller Web UI and Home Assistant integration.",
"license": {
@@ -2635,7 +2635,7 @@
"Flows"
],
"summary": "Export Flow source",
"description": "Exports a versioned `gree-controller-flow` document containing only the source graph, never generated schedules/automations.",
"description": "Exports a versioned `gree-controller-flow` document containing the source graph plus definitions of referenced Shared Inputs, never generated schedules/automations.",
"operationId": "exportFlow",
"parameters": [
{
@@ -2686,7 +2686,7 @@
"Flows"
],
"summary": "Import Flow source",
"description": "Imports either a `gree-controller-flow` envelope or a direct Flow source payload. A new Flow ID/revision is created; executable imports are validated and recompiled, drafts remain disabled.",
"description": "Imports either a `gree-controller-flow` envelope or a direct Flow source payload. Flow envelopes may include Shared Input definitions; missing inputs are created automatically and conflicting IDs are safely remapped. A new Flow ID/revision is created; executable imports are validated and recompiled, drafts remain disabled.",
"operationId": "importFlow",
"requestBody": {
"required": true,
@@ -5967,7 +5967,7 @@
},
"version": {
"type": "string",
"example": "0.15.7"
"example": "0.15.8"
},
"uptime_seconds": {
"type": "integer",
@@ -8026,6 +8026,41 @@
"type": "string",
"format": "date-time"
},
"shared_inputs": {
"type": "array",
"description": "Portable definitions for Shared Inputs referenced by the Flow. Import creates missing inputs and safely remaps ID collisions.",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string",
"example": "shared-7bdc11d1-2d98-48c2-ba9f-ed2f13cd867b"
},
"name": {
"type": "string",
"example": "Room humidity"
},
"kind": {
"type": "string",
"example": "ha_numeric"
},
"config": {
"type": "object",
"additionalProperties": true,
"example": {
"entity_id": "sensor.room_humidity"
}
}
},
"required": [
"id",
"name",
"kind",
"config"
],
"additionalProperties": false
}
},
"flow": {
"$ref": "#/components/schemas/FlowInput"
}