This commit is contained in:
Mateusz Gruszczyński
2026-08-23 22:05:24 +02:00
parent 1d3dcba1a9
commit 9c9b7b272b
25 changed files with 902 additions and 252 deletions
+13 -2
View File
@@ -33,9 +33,11 @@ These two endpoints always require `Authorization: Bearer <generated-token>` (or
```bash
curl -X POST "$BASE/api/discovery" -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"timeout_ms":3000,"broadcast":"255.255.255.255:7000"}'
-d '{"timeout_ms":6000,"broadcast":"255.255.255.255:7000","protocol_version":0,"passes":3}'
```
`protocol_version` is `0` for auto/both, `1` for AES-ECB only, and `2` for AES-GCM only. `passes` is `1..10`. Auto is recommended when different GREE Wi-Fi module generations share the network.
## Device command
```json
@@ -51,7 +53,7 @@ curl -X POST "$BASE/api/discovery" -H "$AUTH" -H 'Content-Type: application/json
}
```
Supported modes: `auto`, `cool`, `dry`, `fan`, `heat`. Fan speed: `0..5`.
Supported modes: `auto`, `cool`, `dry`, `fan`, `heat`. Fan speed: `0..5`. Physical GREE Celsius setpoints are normalized to whole degrees in the `8..30°C` range.
## Zone
@@ -80,6 +82,15 @@ Supported modes: `auto`, `cool`, `dry`, `fan`, `heat`. Fan speed: `0..5`.
For `combined` and `home_assistant`, set a per-zone `ha_entity_id`. `external_sensor_weight` is `0.0..1.0`. If a combined sensor pair differs by more than `max_sensor_difference`, the controller falls back to GREE. The returned zone object includes `device_temperature`, `external_temperature`, `current_temperature`, and `control_temperature_source`.
### Quick zone control
```bash
curl -X POST "$BASE/api/zones/ZONE_ID/control" -H "$AUTH" -H 'Content-Type: application/json' \
-d '{"setpoint":21.5,"mode":"heat"}'
```
Fields are optional: `setpoint`, `mode` (`heat`/`cool`) and `enabled`. The zone setpoint may use 0.5°C precision for controller hysteresis; when the quick control changes setpoint/mode, the paired GREE unit is updated immediately while its current power state is preserved.
## Schedule
Weekdays use ISO numbers: Monday `1`, Sunday `7`.
+34
View File
@@ -108,3 +108,37 @@ src/queries.rs
```
`src/db.rs` contains connection/transaction logic and maps database rows to Rust domain models, but it does not embed SQL statements.
## Two network interfaces
When the LXC has a management interface and a dedicated GREE network, configure the service environment explicitly. Example for `eth1` on `10.87.65.0/25`:
```env
GREE_CONTROLLER_GREE_INTERFACE=eth1
GREE_CONTROLLER_DISCOVERY_BROADCAST=auto
GREE_CONTROLLER_SIMULATE=false
GREE_CONTROLLER_AUTO_SEED=false
```
Restart the service after editing `/etc/gree-controller.env`:
```bash
systemctl restart gree-controller
journalctl -u gree-controller -n 100 --no-pager
```
During discovery the log should contain a line similar to:
```text
Starting GREE discovery target=10.87.65.127:7000 local=10.87.65.27:<ephemeral> interface=eth1
```
Use `scripts/network-debug.sh` for routing diagnostics.
## Mixed GREE model generations
Version 0.3.5 can discover both AES-ECB and AES-GCM modules. In the Web UI choose **Discover -> Auto (V1 + V2)** and use 3-5 scan passes. If a family is still missing, repeat with V1-only and V2-only to see which protocol its Wi-Fi module answers with.
A single command/status timeout no longer immediately flips a device offline; offline requires three consecutive communication failures.