Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add Dashboard Data Homecoach.py #76

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions lnetatmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,30 +948,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
Loading