Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions custom_components/gree/climate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
/"""
Gree Climate Entity for Home Assistant.

This module defines the climate (HVAC) unit for the Gree integration.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand All @@ -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")
Expand All @@ -545,7 +545,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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down