From 096fd0229390a5698520b165ddea15662c20e7cc Mon Sep 17 00:00:00 2001 From: fstancu <73197731+fstancu@users.noreply.github.com> Date: Sun, 26 Apr 2026 17:04:47 +0300 Subject: [PATCH 1/3] Check for None instead of truthy value for light sensor Fix light sensor detection on models which return LigSen = 0. --- custom_components/gree/climate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_components/gree/climate.py b/custom_components/gree/climate.py index 539373ef..fa0e3976 100644 --- a/custom_components/gree/climate.py +++ b/custom_components/gree/climate.py @@ -511,7 +511,7 @@ async def SyncState(self, acOptions={}): except Exception: _LOGGER.debug("Could not determine whether device has a built-in light sensor. Retrying at next update()") else: - if light_sensor: + if light_sensor is not None: self._has_light_sensor = True self._acOptions.update({"LigSen": None}) self._optionsToFetch.append("LigSen") From 1193fdfbe7bc129639b6f28ed1a2e554ab771aef Mon Sep 17 00:00:00 2001 From: fstancu <73197731+fstancu@users.noreply.github.com> Date: Mon, 21 Sep 2026 08:13:42 +0300 Subject: [PATCH 2/3] GreeGetValues returns None instead of empty list --- custom_components/gree/climate.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/gree/climate.py b/custom_components/gree/climate.py index 70fb432d..e06b4bad 100644 --- a/custom_components/gree/climate.py +++ b/custom_components/gree/climate.py @@ -273,8 +273,8 @@ async def GreeGetValues(self, propertyNames): jsonPayloadToSend = '{"cid":"app","i":0,"pack":"' + pack + '","t":"pack","tcid":"' + str(self._mac_addr) + '","uid":{}'.format(self._uid) + ',"tag" : "' + tag + '"}' cipher = GetGCMCipher(self._encryption_key) result = await FetchResult(cipher, self._ip_addr, self._port, jsonPayloadToSend, encryption_version=self.encryption_version) - return result["dat"][0] if len(result["dat"]) == 1 else result["dat"] - + return None if len(result["dat"]) == 0 else result["dat"][0] if len(result["dat"]) == 1 else result["dat"] + def SetAcOptions(self, acOptions, newOptionsToOverride, optionValuesToOverride=None): if optionValuesToOverride is not None: # Build a list of key-value pairs for a single log line From 0ef5972ce3343cd404f05c469834dd9c33c62083 Mon Sep 17 00:00:00 2001 From: fstancu <73197731+fstancu@users.noreply.github.com> Date: Mon, 21 Sep 2026 08:32:11 +0300 Subject: [PATCH 3/3] Check for None instead of truthy values for sensors --- custom_components/gree/climate.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/custom_components/gree/climate.py b/custom_components/gree/climate.py index e06b4bad..9c7a4d5c 100644 --- a/custom_components/gree/climate.py +++ b/custom_components/gree/climate.py @@ -1,4 +1,4 @@ -""" +/""" Gree Climate Entity for Home Assistant. This module defines the climate (HVAC) unit for the Gree integration. @@ -511,7 +511,7 @@ async def SyncState(self, acOptions={}): except Exception: _LOGGER.debug("Could not determine whether device has an built-in temperature sensor. Retrying at next update()") else: - if temp_sensor: + if temp_sensor is not None: self._has_temp_sensor = True self._acOptions.update({"TemSen": None}) self._optionsToFetch.append("TemSen") @@ -528,7 +528,7 @@ async def SyncState(self, acOptions={}): except Exception: _LOGGER.debug("Could not determine whether device has an anti direct blow feature. Retrying at next update()") else: - if anti_direct_blow: + if anti_direct_blow is not None: self._has_anti_direct_blow = True self._acOptions.update({"AntiDirectBlow": None}) self._optionsToFetch.append("AntiDirectBlow") @@ -562,7 +562,7 @@ async def SyncState(self, acOptions={}): except Exception: _LOGGER.debug("Could not determine whether device has an outside temperature sensor. Retrying at next update()") else: - if outside_temp_sensor: + if outside_temp_sensor is not None: self._has_outside_temp_sensor = True self._acOptions.update({"OutEnvTem": None}) self._optionsToFetch.append("OutEnvTem") @@ -579,7 +579,7 @@ async def SyncState(self, acOptions={}): except Exception: _LOGGER.debug("Could not determine whether device has a room humidity sensor. Retrying at next update()") else: - if humidity_sensor: + if humidity_sensor is not None: self._has_room_humidity_sensor = True self._acOptions.update({"DwatSen": None}) self._optionsToFetch.append("DwatSen")