From 49c889daa785de4cf72e4b281eef1732e8322210 Mon Sep 17 00:00:00 2001 From: JurgenLB <77586573+JurgenLB@users.noreply.github.com> Date: Mon, 11 Nov 2024 18:46:26 +0100 Subject: [PATCH] Update homecoach lastdata --- lnetatmo.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lnetatmo.py b/lnetatmo.py index 6d8642de..52c5a194 100644 --- a/lnetatmo.py +++ b/lnetatmo.py @@ -1011,7 +1011,7 @@ def HomecoachDevice(self, id=""): for device in self.rawData: if id in device['_id']: return device - self.HomecoachDevice = device + return None def Dashboard(self, id=""): #D = self.HomecoachDevice['dashboard_data'] @@ -1023,15 +1023,17 @@ def Dashboard(self, id=""): def lastData(self, hid=None, exclude=0): for device in self.rawData: if id == device['_id']: - #s = self.HomecoachDevice['dashboard_data']['time_utc'] + # LastData in HomeCoach + #s = self.HomecoachDevice['dashboard_data']['time_utc'] # Define oldest acceptable sensor measure event limit = (time.time() - exclude) if exclude else 0 - ds = self.HomecoachDevice['dashboard_data'] - if ds.get('time_utc',limit+10) > limit : - _id = ds[id] - return {'When':ds, '_id':_id} + ds = device['dashboard_data']['time_utc'] + if device.get('time_utc',limit+10) > limit : + return {'When': ds, '_id': id} + else: + return {'When': 0, 'id': hid} else: - return {'When': 0, 'id': id} + pass def checkNotUpdated(self, res, hid, delay=3600): ret = []