1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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>
|