Files
gree-controller/home-assistant/README.md
T
2026-08-25 18:10:51 +02:00

7.5 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:

  • sensor for the whole-house plan (house mode, upcoming events and active rules),
  • one sensor per thermostat zone with current demand, active preset/schedule and upcoming transitions,
  • one writable number per zone for the controller target temperature (8-30°C, 0.5°C step),
  • one switch per 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 More -> Home Assistant / Sensors -> 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:

  1. Configure and test the standalone Rust controller first.
  2. Confirm the AC can be controlled from the GREE Controller web UI.
  3. Generate and copy gree_controller_entities.json.
  4. Disable or remove the old/default GREE integration entry in Home Assistant.
  5. If its old entity registry record remains, remove that stale entity from HA after the old integration is unloaded.
  6. Install/restart the gree_controller custom integration.
  7. Verify that climate.klima_salon exists and controls the AC through the Rust service.
  8. Check existing dashboards, scripts and automations. Because the entity ID is unchanged, references to climate.klima_salon do 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.

Zone climate and optional unit features (0.5.4)

Each controller zone is exposed as a full Home Assistant climate entity with current/target temperature and HVAC modes: Off, Auto (follow the controller house mode), Cool and Heat. For a zone thermostat, Auto does not mean the GREE unit's native automatic heat/cool algorithm: it means inherit the whole-house Heating/Cooling selection from GREE Controller. Direct physical-device climate entities still use the native GREE Auto mode. The target temperature remains published while a zone is Off, so Home Assistant can display the configured setpoint instead of unknown. The existing zone target number and enabled switch remain available for compatibility.

From version 0.6.4, zone climate entities use climate.<zone_name>_thermostat, for example climate.igor_thermostat. On integration reload, existing zone climate registry entries are migrated to this scheme using the zone's current name. If the target entity ID is already occupied, the old ID is retained and Home Assistant logs a warning.

When the controller detects optional GREE properties, the integration also creates switches for supported features such as panel light, Quiet, Turbo, X-FAN, Air, Health and native Sleep. Reload the integration (or restart Home Assistant) after upgrading so newly added entity types are created.

Whole-house controls

The integration also exposes three controller-level entities on the GREE Controller device:

  • Thermostat mode (select) — Cooling, Heating or Do not control. Do not control pauses house-level thermostat commands but leaves direct device control and explicit per-zone Heat/Cool overrides untouched.
  • Work profile (select) — Auto schedule, Comfort, Sleep or Away. If zones have mixed manual profiles, the select has no single current option until a whole-house profile is chosen again.
  • Choosing Cooling/Heating in the thermostat-mode select or any whole-house Work profile is treated as explicit whole-house activation: it switches All air conditioners back on. Do not control does not change master power.
  • All air conditioners (switch) — separate master power. Turning it off powers every enabled unit down and prevents zones/controller automations from restarting them. Turning it on powers all enabled units on again without changing the selected thermostat mode or profile.

These controls use the Home Assistant integration token and the dedicated /api/integrations/home-assistant/house/* endpoints.