1
0
mirror of https://github.com/USA-RedDragon/badnest.git synced 2025-01-18 19:20:44 +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,9 +243,10 @@ class NestAPI():
# Thermostats, pt 2 # Thermostats, pt 2
elif bucket["object_key"].startswith( elif bucket["object_key"].startswith(
f"device.{sn}"): f"device.{sn}"):
self.device_data[sn]['name'] = self._wheres[ if 'where_id' in sensor_data:
sensor_data['where_id'] self.device_data[sn]['name'] = self._wheres[
] sensor_data['where_id']
]
# When acts as a sensor # When acts as a sensor
if 'backplate_temperature' in sensor_data: if 'backplate_temperature' in sensor_data:
self.device_data[sn]['temperature'] = \ self.device_data[sn]['temperature'] = \