diff options
Diffstat (limited to 'ebus/web/static/index.html')
-rw-r--r-- | ebus/web/static/index.html | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/ebus/web/static/index.html b/ebus/web/static/index.html new file mode 100644 index 0000000..3c8445a --- /dev/null +++ b/ebus/web/static/index.html @@ -0,0 +1,93 @@ +<!doctype html> +<html> + <head> + <title>EBUS Daten</title> + <script src="/static/jquery.js"></script> + <script src="/static/jquery-flot.js"></script> + </head> + <body> + <div id="placeholder">Aktivieren Sie JavaScript</div> + <script> + var placeholder = jQuery("div#placeholder"); + placeholder.css({fontSize:"2em", paddingLeft:"30%"}).text("Hole Daten"); + var options = { + lines: { show: true }, + points: { show: true }, + xaxis: { mode:'time' }, + grid: { markings: [] } + }; + function onDataReceived(recData) { + data = new Array(); + for (var key in recData) { + if (! key.match(/\.reduced/)) { + data.push(recData[key]); + } + } + placeholder.css({width:"90%", height:window.innerHeight-100, paddingLeft:0, fontSize:"1em"}).text(""); + plot = $.plot(placeholder, data, options); + + var start = null; + for (var m in recData["solarDaten.solarPumpe.reduced"].data) { + m = recData["solarDaten.solarPumpe.reduced"].data[m]; + pumpeAn = m[1]; + + if (pumpeAn && start == null) + start = m[0]; + else if (!pumpeAn && start != null) { + options.grid.markings.push({ + color: "rgba(100, 200, 15, 0.5)", + lineWidth: 1, + xaxis: { from: start, to: m[0]}}); + start = null; + } else { + start = null; + } + } + if (start != null) + options.grid.markings.push({ + color: "rgba(100, 200, 15, 0.5)", + lineWidth: 1, + xaxis: { from: start, to:99999999999999}}); + + var start = null; + for (var m in recData["betriebsdatenFeuerungsautomat.betriebszustand.reduced"].data) { + m = recData["betriebsdatenFeuerungsautomat.betriebszustand.reduced"].data[m]; + if (m[1] == "brauchwasserHeizbetrieb" && start == null) { + start = m[0]; + } else if (m[1] == "brennerAbschalten" && start != null) { + options.grid.markings.push({ + color: "rgba(205, 15, 15, 0.5)", + lineWidth: 1, + xaxis: { from: start, to: m[0]}}); + start = null; + } + } + if (start != null) + options.grid.markings.push({ + color: "rgba(205, 15, 15, 0.5)", + lineWidth: 1, + xaxis: { from: start, to: 99999999999999}}); + + + // replot + plot = $.plot(placeholder, data, options); + } + jQuery(document).ready(function() { + var dataTypes = [ + "solarDaten.tempKollektor", + "solarDaten.tempWarmwasserSolar", + "betriebsdatenRegler1.aussenTemperatur", + "betriebsdatenRegler1.kesselTemperatur", + "betriebsdatenRegler1.boilerTemperatur", + "solarDaten.solarPumpe.reduced", + "betriebsdatenFeuerungsautomat.betriebszustand.reduced" + ] + $.ajax({ + url:'/json/' + dataTypes.join(","), + method:'GET', + dataType:'json', + success: onDataReceived}); + }); + </script> + </body> +</html> |