5.0 KiB
Home Assistant integration
The project includes a custom Home Assistant integration under:
home-assistant/custom_components/gree_controller/
It creates HA climate entities but sends every command to the standalone Rust controller. Home Assistant therefore becomes a client, while UDP/AES GREE communication remains outside HA.
The climate proxy supports power/turn on/off, HVAC modes, target temperature, fan mode, vertical swing and horizontal swing.
Version 0.5.0 additionally exposes the controller's automation plan:
sensorfor the whole-house plan (house mode, upcoming events and active rules),- one
sensorper thermostat zone with current demand, active preset/schedule and upcoming transitions, - one writable
numberper zone for the controller target temperature (8-30°C, 0.5°C step), - one
switchper zone for enabling/disabling the thermostat directly from Home Assistant.
The plan entities can be placed on a normal Home Assistant dashboard; their next_events attributes contain the same schedule timeline shown as graphical blocks in the controller Web UI. Changing a zone target number calls the restricted controller zone API and creates the same temporary override as the Web UI. The zone switch uses the same API to enable or disable that thermostat.
Install the custom integration
Copy the directory into your HA configuration:
/config/custom_components/gree_controller/
Before adding the integration, open the standalone controller Web UI and go to Settings -> Home Assistant integration access -> Create new token. Copy the generated secret; it is shown only once.
Restart Home Assistant, then open Settings -> Devices & services -> Add integration -> GREE Controller and enter only:
- controller URL, for example
http://192.168.1.20:8787, - the generated controller access token.
The integration token is required even when the controller Web UI itself is left open on a trusted LAN. It is restricted to reading controller devices/control plans and sending climate, zone target or zone enable/disable commands.
Preserve an existing entity ID
If existing automations and dashboards use an entity such as:
climate.klima_salon
use the migration generator before switching integrations:
./scripts/generate_ha_migration.py \
--entity climate.klima_salon \
--device gree-aabbccddeeff
Copy the generated JSON file to:
/config/gree_controller_entities.json
The custom integration reads this file and requests the exact same climate.* entity ID.
Home Assistant cannot have two active entities with the same entity_id. Therefore the old/default GREE entity must release climate.klima_salon before the new integration is loaded. Do not run both integrations against the same entity ID.
Safe order:
- Configure and test the standalone Rust controller first.
- Confirm the AC can be controlled from the GREE Controller web UI.
- Generate and copy
gree_controller_entities.json. - Disable or remove the old/default GREE integration entry in Home Assistant.
- If its old entity registry record remains, remove that stale entity from HA after the old integration is unloaded.
- Install/restart the
gree_controllercustom integration. - Verify that
climate.klima_salonexists and controls the AC through the Rust service. - Check existing dashboards, scripts and automations. Because the entity ID is unchanged, references to
climate.klima_salondo not need to be rewritten.
The integration deliberately fails setup on an entity-ID conflict instead of silently creating climate.klima_salon_2.
Multiple devices
Use repeated mappings:
./scripts/generate_ha_migration.py \
--map climate.klima_salon=gree-aabbccddeeff \
--map climate.klima_sypialnia=gree-112233445566
Optional validation
Validate the target controller device:
./scripts/generate_ha_migration.py \
--entity climate.klima_salon \
--controller-url http://192.168.1.20:8787 \
--controller-token CONTROLLER_TOKEN
Validate that the source HA entity currently exists as well:
./scripts/generate_ha_migration.py \
--entity climate.klima_salon \
--device gree-aabbccddeeff \
--ha-url http://homeassistant.local:8123 \
--ha-token HOME_ASSISTANT_LONG_LIVED_TOKEN
Tokens are used only during validation and are not written to the mapping file.
HA as an external temperature source
This is independent from the custom climate integration. Each Rust controller zone can assign its own HA room-temperature entity, for example:
Living room -> GREE Living Room + sensor.living_room_temperature
Bedroom -> GREE Bedroom + sensor.bedroom_temperature
The recommended combined strategy keeps the GREE sensor as the primary input and uses the room sensor as a configurable supporting measurement (40% weight by default). A zone may also select the room sensor as its preferred source. If HA or that entity becomes unavailable, the controller falls back to the corresponding GREE unit, so local control and schedules continue to run.