mirror of
https://github.com/USA-RedDragon/badnest.git
synced 2025-01-18 23:00:43 +00: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:
commit
977c553a8d
@ -136,6 +136,7 @@ class NestThermostatAPI(NestAPI):
|
|||||||
|
|
||||||
self._czfe_url = r.json()["service_urls"]["urls"]["czfe_url"]
|
self._czfe_url = r.json()["service_urls"]["urls"]["czfe_url"]
|
||||||
|
|
||||||
|
temp_mode = None
|
||||||
for bucket in r.json()["updated_buckets"]:
|
for bucket in r.json()["updated_buckets"]:
|
||||||
if bucket["object_key"].startswith(f"shared.{self._device_id}"):
|
if bucket["object_key"].startswith(f"shared.{self._device_id}"):
|
||||||
thermostat_data = bucket["value"]
|
thermostat_data = bucket["value"]
|
||||||
@ -150,8 +151,7 @@ class NestThermostatAPI(NestAPI):
|
|||||||
]
|
]
|
||||||
self._hvac_ac_state = thermostat_data["hvac_ac_state"]
|
self._hvac_ac_state = thermostat_data["hvac_ac_state"]
|
||||||
self._hvac_heater_state = thermostat_data["hvac_heater_state"]
|
self._hvac_heater_state = thermostat_data["hvac_heater_state"]
|
||||||
if self.mode != 'eco':
|
temp_mode = thermostat_data["target_temperature_type"]
|
||||||
self.mode = thermostat_data["target_temperature_type"]
|
|
||||||
self.target_temperature_high = thermostat_data[
|
self.target_temperature_high = thermostat_data[
|
||||||
"target_temperature_high"
|
"target_temperature_high"
|
||||||
]
|
]
|
||||||
@ -167,9 +167,8 @@ class NestThermostatAPI(NestAPI):
|
|||||||
self.fan = thermostat_data["fan_timer_timeout"] > 0
|
self.fan = thermostat_data["fan_timer_timeout"] > 0
|
||||||
self.current_humidity = thermostat_data["current_humidity"]
|
self.current_humidity = thermostat_data["current_humidity"]
|
||||||
if thermostat_data["eco"]["mode"] == 'manual-eco':
|
if thermostat_data["eco"]["mode"] == 'manual-eco':
|
||||||
self.mode = 'eco'
|
temp_mode = 'eco'
|
||||||
else:
|
self.mode = temp_mode
|
||||||
self.mode = 'unknown'
|
|
||||||
|
|
||||||
def set_temp(self, temp, temp_high=None):
|
def set_temp(self, temp, temp_high=None):
|
||||||
if temp_high is None:
|
if temp_high is None:
|
||||||
|
@ -192,9 +192,7 @@ class NestClimate(ClimateDevice):
|
|||||||
@property
|
@property
|
||||||
def hvac_mode(self):
|
def hvac_mode(self):
|
||||||
"""Return hvac target hvac state."""
|
"""Return hvac target hvac state."""
|
||||||
if self.device.mode == 'unknown' \
|
if self.device.mode is None or self.device.mode == NEST_MODE_ECO:
|
||||||
or self.device.mode == NEST_MODE_ECO \
|
|
||||||
or self.device.mode is None:
|
|
||||||
# We assume the first operation in operation list is the main one
|
# We assume the first operation in operation list is the main one
|
||||||
return self._operation_list[0]
|
return self._operation_list[0]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user