From a24a3f5bd0d964172d5b5a66af7ec1b0dc63a968 Mon Sep 17 00:00:00 2001 From: ItayGo Date: Fri, 22 May 2026 22:15:31 +0300 Subject: [PATCH] fix: multi-unit devices cannot be assigned to separate HA rooms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In a multi-split setup (subMAC@gatewayMAC), all indoor units share the same device_info identifier (the gateway MAC). HA treats them as entities of one single device, so assigning the device to an area moves all units together — it is impossible to put each unit in its own room. The same bug affects unique_id in GreeEntity, which also used the gateway MAC, causing entity conflicts across units. Fix: use _sub_mac_addr (the indoor unit MAC) as the device identifier and unique_id base in both climate.py and entity.py. Each indoor unit now registers as its own independent HA device and can be assigned to a different area individually. Note: after deploying this fix, delete the old shared ghost device that HA will leave behind in Settings > Devices. --- custom_components/gree/climate.py | 2 +- custom_components/gree/entity.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/custom_components/gree/climate.py b/custom_components/gree/climate.py index 539373e..f3a00a3 100644 --- a/custom_components/gree/climate.py +++ b/custom_components/gree/climate.py @@ -759,7 +759,7 @@ def unique_id(self): def device_info(self) -> DeviceInfo: """Return device information.""" return DeviceInfo( - identifiers={(DOMAIN, self._mac_addr)}, + identifiers={(DOMAIN, self._sub_mac_addr)}, name=self._name, manufacturer="Gree", ) diff --git a/custom_components/gree/entity.py b/custom_components/gree/entity.py index e0f6968..3288f57 100644 --- a/custom_components/gree/entity.py +++ b/custom_components/gree/entity.py @@ -59,16 +59,16 @@ def _set_id(self) -> None: elif self.entity_description.icon is not None: self._attr_icon = self.entity_description.icon - self._attr_unique_id = f"{self._device._mac_addr}_{self.entity_description.key}" + self._attr_unique_id = f"{self._device._sub_mac_addr}_{self.entity_description.key}" @property def device_info(self) -> DeviceInfo: """Return device information.""" return DeviceInfo( - identifiers={(DOMAIN, self._device._mac_addr)}, + identifiers={(DOMAIN, self._device._sub_mac_addr)}, name=self._device._name, manufacturer="Gree", - connections={(CONNECTION_NETWORK_MAC, self._device._mac_addr)}, + connections={(CONNECTION_NETWORK_MAC, self._device._sub_mac_addr)}, ) @property