1
0
mirror of https://github.com/USA-RedDragon/badnest.git synced 2024-10-05 21:00:49 +01:00

Merge pull request #18 from USA-RedDragon/visual-bug-auto-mode

Fix a visual bug wherein the mode kept going into the 'unknown' state
This commit is contained in:
Jacob McSwain 2019-10-20 20:08:39 -05:00 committed by GitHub
commit 977c553a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -136,6 +136,7 @@ class NestThermostatAPI(NestAPI):
self._czfe_url = r.json()["service_urls"]["urls"]["czfe_url"]
temp_mode = None
for bucket in r.json()["updated_buckets"]:
if bucket["object_key"].startswith(f"shared.{self._device_id}"):
thermostat_data = bucket["value"]
@ -150,8 +151,7 @@ class NestThermostatAPI(NestAPI):
]
self._hvac_ac_state = thermostat_data["hvac_ac_state"]
self._hvac_heater_state = thermostat_data["hvac_heater_state"]
if self.mode != 'eco':
self.mode = thermostat_data["target_temperature_type"]
temp_mode = thermostat_data["target_temperature_type"]
self.target_temperature_high = thermostat_data[
"target_temperature_high"
]
@ -167,9 +167,8 @@ class NestThermostatAPI(NestAPI):
self.fan = thermostat_data["fan_timer_timeout"] > 0
self.current_humidity = thermostat_data["current_humidity"]
if thermostat_data["eco"]["mode"] == 'manual-eco':
self.mode = 'eco'
else:
self.mode = 'unknown'
temp_mode = 'eco'
self.mode = temp_mode
def set_temp(self, temp, temp_high=None):
if temp_high is None:

View File

@ -192,9 +192,7 @@ class NestClimate(ClimateDevice):
@property
def hvac_mode(self):
"""Return hvac target hvac state."""
if self.device.mode == 'unknown' \
or self.device.mode == NEST_MODE_ECO \
or self.device.mode is None:
if self.device.mode is None or self.device.mode == NEST_MODE_ECO:
# We assume the first operation in operation list is the main one
return self._operation_list[0]