def dataPointView(deviceID,stream_id): #dataPointList = datamanager.getAllDatapointsByID(deviceID,stream_id) dataPointList = datamanager.getAllDatapointsByIDRaw(str(deviceID),stream_id) count=0 list =[] for st in dataPointList: #st.timestamp = str(time.strftime('%B %d, %Y %H:%M:%S', time.localtime(float(st[0])/1000))) #list.append([str(time.strftime('%B %d, %Y %H:%M:%S', time.localtime(float(st[0])/1000))),st[1]]) list.append([st[0],st[1]]) count+=1 max =750 decimateInterval = int(math.ceil(count//max)) #dataPointList = dataPointList[1::decimateInterval] list = list[1::decimateInterval] streamList = datamanager.getStreamListByDeviceID(deviceID) return render_template('dataPointList.html', #dataPoint user= g.user.get_username(), dataPointList=list, streamList=streamList, dev_id = deviceID, stID = stream_id, eventData=datamanager.getAllEventOccurances(), datatable=1)
def controller(deviceID): #get config list from database #get all data from db with deviceID streamList = datamanager.getStreamListByDeviceID(deviceID) return render_template('device.html', user= g.user.get_username(), streamList=streamList, dev_id = deviceID, eventData=datamanager.getAllEventOccurances(dev_id=deviceID), datatable=1, )
def index_page(): session.permanent = True if etherios.updateDeviceList() is None: flash("Bad Credentials",'message') redirect('/logout') ed = datamanager.getAllEventOccurances() #for e in ed: #print e.dev_id,e.stream_id,e.datapoint,e.timestamp return render_template('index.html',user= g.user.get_username(), devList=etherios.deviceListInfo, eventData=ed, local=localFrontEnd, datatable=1)
def controllers(): return render_template('controllers.html',user= g.user.get_username(), devList=etherios.deviceListInfo, eventData=datamanager.getAllEventOccurances(), datatable=1)