This commit is contained in:
Mateusz Gruszczyński
2026-09-18 11:21:48 +02:00
parent 3ffb02595e
commit 8d96ad2d38
29 changed files with 758 additions and 256 deletions
+195 -39
View File
@@ -2,7 +2,7 @@
"openapi": "3.1.0",
"info": {
"title": "GREE Controller API",
"version": "0.15.4",
"version": "0.15.6",
"summary": "Local HTTP/WebSocket API for GREE Controller",
"description": "Local API used by the GREE Controller Web UI and Home Assistant integration.",
"license": {
@@ -198,14 +198,14 @@
}
}
},
"/api/discovery": {
"/api/discovery/scan": {
"post": {
"tags": [
"Devices"
],
"summary": "Discover GREE devices",
"description": "Broadcasts GREE discovery, merges known devices, attempts binding for devices without a key, persists results and reports newly discovered controller IDs.",
"operationId": "discoverDevices",
"summary": "Scan for local GREE devices",
"description": "Broadcasts GREE discovery and returns local device candidates without persisting or binding them. protocol_version=1 or 2 strictly accepts only that protocol; protocol_version=0 accepts both.",
"operationId": "scanDiscoveredDevices",
"requestBody": {
"required": true,
"content": {
@@ -232,11 +232,77 @@
],
"responses": {
"200": {
"description": "Discovery result",
"description": "Discovery candidates; no devices are added automatically",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DiscoveryResponse"
"$ref": "#/components/schemas/DiscoveryScanResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorized"
},
"502": {
"$ref": "#/components/responses/BadGateway"
},
"500": {
"$ref": "#/components/responses/InternalError"
}
}
}
},
"/api/discovery/add": {
"post": {
"tags": [
"Devices"
],
"summary": "Add selected discovered devices",
"description": "Persists and binds only the local discovery candidates selected by the caller. Each selected unit is bound strictly with the protocol version detected during the scan.",
"operationId": "addDiscoveredDevices",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AddDiscoveredDevicesRequest"
},
"example": {
"devices": [
{
"name": "Living room",
"mac": "AABBCCDDEEFF",
"ip": "192.168.50.30",
"port": 7000,
"protocol_version": 1,
"model": "GREE",
"firmware": "",
"already_added": false
}
]
}
}
}
},
"security": [
{
"BearerToken": []
},
{
"ApiTokenHeader": []
}
],
"responses": {
"200": {
"description": "Selected devices added",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AddDiscoveredDevicesResponse"
}
}
}
@@ -5900,7 +5966,7 @@
},
"version": {
"type": "string",
"example": "0.15.4"
"example": "0.15.6"
},
"uptime_seconds": {
"type": "integer",
@@ -6633,37 +6699,6 @@
}
}
},
"DiscoveryResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"minimum": 0,
"example": 1
},
"devices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Device"
}
},
"new_device_ids": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"gree-aabbccddeeff"
]
}
},
"required": [
"count",
"devices",
"new_device_ids"
],
"additionalProperties": false
},
"TemporaryQuickThermostatRequest": {
"type": "object",
"description": "Persisted temporary thermostat session with delayed/absolute start and several finish rules.",
@@ -9602,6 +9637,127 @@
"source"
],
"additionalProperties": false
},
"LocalDiscoveryCandidate": {
"type": "object",
"description": "Local GREE unit returned by discovery. No device is persisted until it is submitted to /api/discovery/add.",
"properties": {
"name": {
"type": "string",
"example": "Living room"
},
"mac": {
"type": "string",
"example": "AABBCCDDEEFF"
},
"ip": {
"type": "string",
"example": "192.168.50.30"
},
"port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"default": 7000
},
"protocol_version": {
"type": "integer",
"enum": [
1,
2
],
"description": "Detected protocol generation"
},
"model": {
"type": "string",
"example": "GREE"
},
"firmware": {
"type": "string",
"example": "1.0"
},
"already_added": {
"type": "boolean",
"description": "True when this MAC already exists in the controller"
}
},
"required": [
"name",
"mac",
"ip",
"port",
"protocol_version",
"model",
"firmware",
"already_added"
],
"additionalProperties": false
},
"AddDiscoveredDevicesRequest": {
"type": "object",
"properties": {
"devices": {
"type": "array",
"minItems": 1,
"maxItems": 64,
"items": {
"$ref": "#/components/schemas/LocalDiscoveryCandidate"
}
}
},
"required": [
"devices"
],
"additionalProperties": false
},
"AddDiscoveredDevicesResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"minimum": 0
},
"devices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/Device"
}
},
"skipped_macs": {
"type": "array",
"items": {
"type": "string"
},
"description": "MAC addresses skipped because they were already registered"
}
},
"required": [
"count",
"devices",
"skipped_macs"
],
"additionalProperties": false
},
"DiscoveryScanResponse": {
"type": "object",
"properties": {
"count": {
"type": "integer",
"minimum": 0,
"example": 1
},
"devices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LocalDiscoveryCandidate"
}
}
},
"required": [
"count",
"devices"
],
"additionalProperties": false
}
},
"responses": {