@@ -957,30 +957,33 @@ def __init__(self, authData, home=None):
957
957
if not self .rawData : raise NoDevice ("No HomeCoach available" )
958
958
959
959
for i in range (len (self .rawData )):
960
- #
961
- self .HomecoachDevice = self .rawData [i ]
960
+ #
961
+ self .HomecoachDevice = self .rawData [i ]
962
962
# print ('Homecoach = ', self.HomecoachDevice)
963
963
# print (' ')
964
964
# print ('Homecoach_data = ', self.rawData[i]['dashboard_data'])
965
965
# print (' ')
966
-
967
- def lastData (self , _id = None , exclude = 0 ):
968
- s = self .HomecoachDevice ['dashboard_data' ]['time_utc' ]
969
- _id = self .HomecoachDevice ['_id' ]
970
- return {'When' :s }, {'_id' :_id }
971
-
972
- def checkNotUpdated (self , delay = 3600 ):
973
- res = self .lastData ()
974
- _id = res ['_id' ]
966
+
967
+ def Dashboard (self ):
968
+ D = self .HomecoachDevice ['dashboard_data' ]
969
+ return D
970
+
971
+ def lastData (self , id = None , exclude = 0 ):
972
+ if id is not None :
973
+ s = self .HomecoachDevice ['dashboard_data' ]['time_utc' ]
974
+ _id = self .HomecoachDevice ['_id' ]
975
+ return {'When' :s }, {'_id' :_id }
976
+ else :
977
+ return {'When' : 0 }, {'_id' : id }
978
+
979
+ def checkNotUpdated (self , res , _id , delay = 3600 ):
975
980
ret = []
976
- if time .time ()- res ['When' ] > delay : ret .append ({_id [ '_id' ] : 'Device Not Updated' })
981
+ if time .time ()- res ['When' ] > delay : ret .append ({_id : 'Device Not Updated' })
977
982
return ret if ret else None
978
983
979
- def checkUpdated (self , delay = 3600 ):
980
- res = self .lastData ()
981
- _id = res ['_id' ]
984
+ def checkUpdated (self , res , _id , delay = 3600 ):
982
985
ret = []
983
- if time .time ()- res ['When' ] < delay : ret .append ({_id [ '_id' ] : 'Device up-to-date' })
986
+ if time .time ()- res ['When' ] < delay : ret .append ({_id : 'Device up-to-date' })
984
987
return ret if ret else None
985
988
986
989
0 commit comments