1
0
mirror of https://github.com/USA-RedDragon/badnest.git synced 2025-01-19 00:00:43 +00:00

Handle when device name does not come in the wheres

This commit is contained in:
redec 2020-05-09 23:03:27 +00:00
parent 7ab48d968e
commit ba2f6d415b

View File

@ -213,6 +213,9 @@ class NestAPI():
# Thermostats (thermostat and sensors system) # Thermostats (thermostat and sensors system)
if bucket["object_key"].startswith( if bucket["object_key"].startswith(
f"shared.{sn}"): f"shared.{sn}"):
if 'name' in sensor_data:
self.device_data[sn]['name'] = \
sensor_data['name']
self.device_data[sn]['current_temperature'] = \ self.device_data[sn]['current_temperature'] = \
sensor_data["current_temperature"] sensor_data["current_temperature"]
self.device_data[sn]['target_temperature'] = \ self.device_data[sn]['target_temperature'] = \
@ -240,6 +243,7 @@ class NestAPI():
# Thermostats, pt 2 # Thermostats, pt 2
elif bucket["object_key"].startswith( elif bucket["object_key"].startswith(
f"device.{sn}"): f"device.{sn}"):
if 'where_id' in sensor_data:
self.device_data[sn]['name'] = self._wheres[ self.device_data[sn]['name'] = self._wheres[
sensor_data['where_id'] sensor_data['where_id']
] ]