first commit
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
# Changelog
|
||||
|
||||
Release version is maintained only in the project root `Cargo.toml`. Home Assistant metadata is generated by `ha-addon/build.sh` / `ha-addon/render-repository.sh`.
|
||||
|
||||
## Current
|
||||
|
||||
- Home Assistant add-on packaging.
|
||||
- amd64 and aarch64 in one OCI multi-arch manifest.
|
||||
- Host-network operation for GREE UDP discovery and multi-interface hosts.
|
||||
- Home Assistant ingress support.
|
||||
- Polish and English topology diagrams and networking documentation.
|
||||
- Debian Trixie or latest Alpine build/runtime target.
|
||||
@@ -0,0 +1,64 @@
|
||||
# GREE Controller - Home Assistant add-on
|
||||
|
||||
## Installation
|
||||
|
||||
Publish the `ha-addon/repository` directory as a Git repository. In Home Assistant open the app/add-on store, add that Git repository URL as a custom repository, refresh the store and install **GREE Controller**.
|
||||
|
||||
The repository metadata points to a pre-built multi-architecture OCI image. The image tag must be identical to `version` in `config.yaml`.
|
||||
|
||||
## Topology diagrams
|
||||
|
||||
### English
|
||||
|
||||

|
||||
|
||||
### Polish
|
||||
|
||||

|
||||
|
||||
## Network model
|
||||
|
||||
The add-on deliberately uses `host_network: true`. Do not attach Docker `macvlan` networks to the add-on. With host networking, the controller shares the Home Assistant host network namespace and sees host ethernet/VLAN interfaces directly.
|
||||
|
||||
Configure physical NICs and VLANs on Home Assistant OS first. Check the current host interfaces with:
|
||||
|
||||
```bash
|
||||
ha network info
|
||||
```
|
||||
|
||||
Example VLAN 50 on `eth0`, without adding another default gateway:
|
||||
|
||||
```bash
|
||||
ha network vlan eth0 50 \
|
||||
--ipv4-method static \
|
||||
--ipv4-address 192.168.50.2/24 \
|
||||
--ipv6-method disabled
|
||||
```
|
||||
|
||||
Then use one of these add-on configurations:
|
||||
|
||||
### One dedicated GREE interface
|
||||
|
||||
Set `gree_interface` to the host interface name, for example `eth0.50`, or to its local IPv4 address, for example `192.168.50.2`. Set `discovery_broadcast` to the subnet broadcast, for example `192.168.50.255:7000`.
|
||||
|
||||
### Several host interfaces / several directly attached subnets
|
||||
|
||||
Leave `gree_interface` empty. For already known devices the controller chooses the local IPv4 interface whose subnet best matches the device IP. This allows normal polling and commands to devices on different directly attached networks.
|
||||
|
||||
Discovery itself sends one broadcast target per scan. To discover devices on several VLANs, scan each subnet separately by supplying its broadcast address (for example `192.168.50.255:7000`, then `192.168.60.255:7000`) or add known devices manually. After discovery, normal traffic can use automatic per-target interface selection.
|
||||
|
||||
Do not use `discovery_broadcast=auto` when `gree_interface` is empty; automatic broadcast calculation needs an explicitly selected interface.
|
||||
|
||||
## Routed VLANs
|
||||
|
||||
Unicast UDP commands can traverse routing/firewall rules if permitted. Discovery is broadcast-based and normally does not cross a router. Either give the Home Assistant host an interface in the GREE VLAN, use a suitable UDP broadcast relay, or discover/add devices from each local subnet explicitly.
|
||||
|
||||
## Docker limitations
|
||||
|
||||
Home Assistant add-on configuration supports host networking, but not arbitrary user-defined Docker networks/macvlan attachments. Giving an add-on Docker API/full host access just to create extra container interfaces is unnecessary here and would substantially weaken isolation. Configure the VLANs/NICs on the HA OS host and let this add-on share them through host networking.
|
||||
|
||||
## Direct access and ingress
|
||||
|
||||
The service listens on TCP 8787 because the same host network is needed for GREE UDP. Home Assistant ingress proxies the Web UI to that port. If TCP 8787 is reachable from untrusted networks, configure `app_token` or block that port at the network/firewall boundary.
|
||||
|
||||
The standalone Home Assistant custom integration can still use the controller API exactly as before; point it at an address that Home Assistant Core can reach and use an integration token generated by GREE Controller.
|
||||
@@ -0,0 +1,64 @@
|
||||
# GREE Controller - dodatek Home Assistant
|
||||
|
||||
## Instalacja
|
||||
|
||||
Opublikuj katalog `ha-addon/repository` jako repozytorium Git. W Home Assistant otwórz sklep dodatków/aplikacji, dodaj URL tego repozytorium jako repozytorium niestandardowe, odśwież listę i zainstaluj **GREE Controller**.
|
||||
|
||||
Metadane repozytorium wskazują na gotowy wieloarchitekturny obraz OCI. Tag obrazu musi być taki sam jak `version` w `config.yaml`.
|
||||
|
||||
## Diagramy topologii
|
||||
|
||||
### Polski
|
||||
|
||||

|
||||
|
||||
### English
|
||||
|
||||

|
||||
|
||||
## Model sieciowy
|
||||
|
||||
Dodatek celowo używa `host_network: true`. Nie podpinaj do dodatku sieci Docker `macvlan`. Przy host networking kontroler współdzieli przestrzeń sieciową hosta Home Assistanta i widzi bezpośrednio interfejsy ethernet/VLAN hosta.
|
||||
|
||||
Najpierw skonfiguruj fizyczne NIC-i i VLAN-y w Home Assistant OS. Aktualne interfejsy hosta sprawdzisz poleceniem:
|
||||
|
||||
```bash
|
||||
ha network info
|
||||
```
|
||||
|
||||
Przykład VLAN 50 na `eth0`, bez dodawania kolejnej domyślnej bramy:
|
||||
|
||||
```bash
|
||||
ha network vlan eth0 50 \
|
||||
--ipv4-method static \
|
||||
--ipv4-address 192.168.50.2/24 \
|
||||
--ipv6-method disabled
|
||||
```
|
||||
|
||||
Następnie użyj jednej z tych konfiguracji dodatku:
|
||||
|
||||
### Jeden dedykowany interfejs GREE
|
||||
|
||||
Ustaw `gree_interface` na nazwę interfejsu hosta, np. `eth0.50`, albo na jego lokalny adres IPv4, np. `192.168.50.2`. Ustaw `discovery_broadcast` na broadcast tej podsieci, np. `192.168.50.255:7000`.
|
||||
|
||||
### Kilka interfejsów hosta / kilka bezpośrednio podłączonych podsieci
|
||||
|
||||
Pozostaw `gree_interface` puste. Dla znanych urządzeń kontroler wybiera lokalny interfejs IPv4, którego podsieć najlepiej pasuje do adresu IP urządzenia. Dzięki temu normalne odpytywanie i sterowanie działa dla urządzeń w różnych bezpośrednio podłączonych sieciach.
|
||||
|
||||
Samo discovery wysyła jeden broadcast na skan. Aby wykrywać urządzenia w kilku VLAN-ach, skanuj każdą podsieć osobno, podając jej adres broadcast (np. `192.168.50.255:7000`, potem `192.168.60.255:7000`) albo dodaj znane urządzenia ręcznie. Po discovery zwykły ruch może działać z automatycznym doborem interfejsu dla celu.
|
||||
|
||||
Nie używaj `discovery_broadcast=auto`, gdy `gree_interface` jest puste; automatyczne wyliczenie broadcastu wymaga jawnie wybranego interfejsu.
|
||||
|
||||
## VLAN-y routowane
|
||||
|
||||
Polecenia unicast UDP mogą przechodzić przez routing/reguły firewalla, jeśli jest to dozwolone. Discovery jest oparte na broadcast i zwykle nie przechodzi przez router. Albo daj hostowi Home Assistant interfejs w VLAN-ie GREE, albo użyj odpowiedniego relaya UDP broadcast, albo wykrywaj/dodawaj urządzenia osobno z każdej lokalnej podsieci.
|
||||
|
||||
## Ograniczenia Dockera
|
||||
|
||||
Konfiguracja dodatków Home Assistant wspiera host networking, ale nie dowolne, własne sieci Docker/macvlan przypinane do dodatku. Nadawanie dodatkowi pełnego dostępu do hosta lub API Dockera tylko po to, aby tworzyć dodatkowe interfejsy kontenera, nie jest tu potrzebne i znacząco osłabia izolację. Skonfiguruj VLAN-y/NIC-e na hoście HA OS i pozwól temu dodatkowi współdzielić je przez host networking.
|
||||
|
||||
## Bezpośredni dostęp i ingress
|
||||
|
||||
Usługa nasłuchuje na TCP 8787, ponieważ ten sam host network jest potrzebny dla GREE UDP. Home Assistant ingress proxy przekazuje Web UI na ten port. Jeżeli TCP 8787 jest osiągalny z niezaufanych sieci, skonfiguruj `app_token` albo zablokuj ten port na granicy sieci/firewalla.
|
||||
|
||||
Samodzielna integracja Home Assistant może nadal używać API kontrolera jak wcześniej; wskaż adres osiągalny z Home Assistant Core i użyj tokenu integracji wygenerowanego przez GREE Controller.
|
||||
@@ -0,0 +1,35 @@
|
||||
# GREE Controller
|
||||
|
||||
Local GREE HVAC controller packaged as a Home Assistant add-on. It uses `host_network: true` so UDP discovery and the host VLAN/ethernet interfaces are directly available to the controller. Persistent data is stored in `/data/gree-controller.db` and is included in Home Assistant backups.
|
||||
|
||||
## PL - topologia HA / VLAN / GREE
|
||||
|
||||

|
||||
|
||||
Najważniejsze:
|
||||
|
||||
- VLAN-y konfigurujesz na hoście Home Assistant OS,
|
||||
- dodatek współdzieli interfejsy hosta przez `host_network`,
|
||||
- nie trzeba tworzyć Docker `macvlan`,
|
||||
- przy wielu bezpośrednio podłączonych podsieciach `gree_interface` może pozostać puste,
|
||||
- discovery UDP broadcast wykonuj osobno dla każdego VLAN-u/podsieci.
|
||||
|
||||
Pełna dokumentacja: [DOCS.pl.md](./DOCS.pl.md).
|
||||
|
||||
## EN - HA / VLAN / GREE topology
|
||||
|
||||

|
||||
|
||||
Key points:
|
||||
|
||||
- configure VLANs on the Home Assistant OS host,
|
||||
- the add-on shares host interfaces via `host_network`,
|
||||
- Docker `macvlan` is not required,
|
||||
- with multiple directly attached subnets `gree_interface` may be left empty,
|
||||
- run UDP broadcast discovery separately for each VLAN/subnet.
|
||||
|
||||
Full documentation: [DOCS.md](./DOCS.md).
|
||||
|
||||
## Versioning
|
||||
|
||||
The project version is maintained only in the root `Cargo.toml`. The build script copies it into the Home Assistant `config.yaml` and publishes one `amd64 + aarch64` OCI manifest under that version. No separate architecture release tags are used.
|
||||
@@ -0,0 +1,40 @@
|
||||
name: "GREE Controller"
|
||||
version: "0.13.9"
|
||||
slug: "gree_controller"
|
||||
description: "Local GREE HVAC controller with Web UI and Home Assistant integration"
|
||||
arch:
|
||||
- amd64
|
||||
- aarch64
|
||||
image: "zot.linuxiarz.pl/gree-controller"
|
||||
startup: application
|
||||
boot: auto
|
||||
init: false
|
||||
host_network: true
|
||||
ingress: true
|
||||
ingress_port: 8787
|
||||
ingress_stream: true
|
||||
panel_icon: mdi:air-conditioner
|
||||
panel_title: GREE Controller
|
||||
panel_admin: true
|
||||
watchdog: "http://[HOST]:8787/api/health"
|
||||
backup: cold
|
||||
options:
|
||||
gree_interface: ""
|
||||
discovery_broadcast: "255.255.255.255:7000"
|
||||
simulate: false
|
||||
auto_seed: false
|
||||
poll_interval_seconds: 15
|
||||
zone_interval_seconds: 5
|
||||
discovery_timeout_ms: 3000
|
||||
app_token: ""
|
||||
log_level: info
|
||||
schema:
|
||||
gree_interface: str
|
||||
discovery_broadcast: str
|
||||
simulate: bool
|
||||
auto_seed: bool
|
||||
poll_interval_seconds: "int(2,3600)"
|
||||
zone_interval_seconds: "int(2,3600)"
|
||||
discovery_timeout_ms: "int(500,30000)"
|
||||
app_token: password
|
||||
log_level: "list(error|warn|info|debug|trace)"
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
@@ -0,0 +1,28 @@
|
||||
configuration:
|
||||
gree_interface:
|
||||
name: GREE network interface
|
||||
description: Interface name or local IPv4 address. Leave empty for automatic routing.
|
||||
discovery_broadcast:
|
||||
name: Discovery broadcast
|
||||
description: Broadcast target, for example 192.168.50.255:7000. Use an explicit subnet broadcast for VLANs.
|
||||
simulate:
|
||||
name: Simulation mode
|
||||
description: Run without physical GREE units.
|
||||
auto_seed:
|
||||
name: Seed simulator
|
||||
description: Create a sample simulated unit when the database is empty.
|
||||
poll_interval_seconds:
|
||||
name: Poll interval
|
||||
description: Device polling interval in seconds.
|
||||
zone_interval_seconds:
|
||||
name: Zone interval
|
||||
description: Thermostat control interval in seconds.
|
||||
discovery_timeout_ms:
|
||||
name: Discovery timeout
|
||||
description: UDP discovery timeout in milliseconds.
|
||||
app_token:
|
||||
name: Application token
|
||||
description: Optional token protecting direct Web UI/API access outside Home Assistant ingress.
|
||||
log_level:
|
||||
name: Log level
|
||||
description: Controller log verbosity.
|
||||
@@ -0,0 +1,28 @@
|
||||
configuration:
|
||||
gree_interface:
|
||||
name: Interfejs sieci GREE
|
||||
description: Nazwa interfejsu lub lokalny adres IPv4. Puste pole oznacza automatyczny wybór trasy.
|
||||
discovery_broadcast:
|
||||
name: Broadcast discovery
|
||||
description: Adres broadcast, np. 192.168.50.255:7000. Dla VLAN użyj broadcastu konkretnej podsieci.
|
||||
simulate:
|
||||
name: Tryb symulacji
|
||||
description: Uruchomienie bez fizycznych urządzeń GREE.
|
||||
auto_seed:
|
||||
name: Dane testowe symulatora
|
||||
description: Dodaj przykładowe urządzenie, gdy baza jest pusta.
|
||||
poll_interval_seconds:
|
||||
name: Interwał odpytywania
|
||||
description: Odpytywanie urządzeń w sekundach.
|
||||
zone_interval_seconds:
|
||||
name: Interwał stref
|
||||
description: Interwał sterowania termostatem w sekundach.
|
||||
discovery_timeout_ms:
|
||||
name: Timeout discovery
|
||||
description: Timeout wykrywania UDP w milisekundach.
|
||||
app_token:
|
||||
name: Token aplikacji
|
||||
description: Opcjonalna ochrona bezpośredniego dostępu do Web UI/API poza ingressem Home Assistanta.
|
||||
log_level:
|
||||
name: Poziom logowania
|
||||
description: Szczegółowość logów kontrolera.
|
||||
@@ -0,0 +1,2 @@
|
||||
name: GREE Controller
|
||||
maintainer: MateuszG
|
||||
Reference in New Issue
Block a user