diff --git a/app.py b/app.py index 415ace7..c1e7995 100644 --- a/app.py +++ b/app.py @@ -3,6 +3,7 @@ import json from flask import Flask, Response from flask import render_template, render_template_string, escape from flask import request, send_file +from flask import jsonify from flask_socketio import SocketIO, join_room from random import randint @@ -81,6 +82,10 @@ def dist(filename): print('Missing', filename) return '' +@app.route('/sensors.json') +def get_sensors(): + return jsonify(sensors.get_history()) + @app.route('/recipe') def recipe(): return render_template('recipe.html', recipe=phasectrl.recipe) diff --git a/sensors.py b/sensors.py index 629f271..d476d6c 100644 --- a/sensors.py +++ b/sensors.py @@ -212,7 +212,7 @@ class Sensors(): def get_history(self, n=None): l = len(self.history) - return tuple(islice(self.history, max(0, l - n), l)) + return tuple(islice(self.history, max(0, l - (n or l)), l)) sensors = Sensors() diff --git a/templates/index.html b/templates/index.html index 48089d5..5268568 100644 --- a/templates/index.html +++ b/templates/index.html @@ -47,6 +47,9 @@ Update #of points + + Download +