Skip to content

Commit

Permalink
add Dashboard Data.py (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
JurgenLB authored Aug 11, 2024
1 parent 6d8a215 commit 41b9bb4
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions lnetatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,30 +957,33 @@ def __init__(self, authData, home=None):
if not self.rawData : raise NoDevice("No HomeCoach available")

for i in range(len(self.rawData)):
#
self.HomecoachDevice = self.rawData[i]
#
self.HomecoachDevice = self.rawData[i]
# print ('Homecoach = ', self.HomecoachDevice)
# print (' ')
# print ('Homecoach_data = ', self.rawData[i]['dashboard_data'])
# print (' ')

def lastData(self, _id=None, exclude=0):
s = self.HomecoachDevice['dashboard_data']['time_utc']
_id = self.HomecoachDevice['_id']
return {'When':s}, {'_id':_id}

def checkNotUpdated(self, delay=3600):
res = self.lastData()
_id = res['_id']

def Dashboard(self):
D = self.HomecoachDevice['dashboard_data']
return D

def lastData(self, id=None, exclude=0):
if id is not None:
s = self.HomecoachDevice['dashboard_data']['time_utc']
_id = self.HomecoachDevice['_id']
return {'When':s}, {'_id':_id}
else:
return {'When': 0 }, {'_id': id}

def checkNotUpdated(self, res, _id, delay=3600):
ret = []
if time.time()-res['When'] > delay : ret.append({_id['_id']: 'Device Not Updated'})
if time.time()-res['When'] > delay : ret.append({_id: 'Device Not Updated'})
return ret if ret else None

def checkUpdated(self, delay=3600):
res = self.lastData()
_id = res['_id']
def checkUpdated(self, res, _id, delay=3600):
ret = []
if time.time()-res['When'] < delay : ret.append({_id['_id']: 'Device up-to-date'})
if time.time()-res['When'] < delay : ret.append({_id: 'Device up-to-date'})
return ret if ret else None


Expand Down

0 comments on commit 41b9bb4

Please sign in to comment.