generated from dohack-io/template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
283 lines (229 loc) · 10 KB
/
index.html
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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>stay-fresh</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>
<body>
<nav class="navbar navbar-expand-md navbar-dark fixed-top bg-dark">
<a class="navbar-brand" href="#">
<font color="limegreen">Stay</font>-fresh
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active">
<a class="nav-link" href="ueber.html">Über <span class="sr-only">(current)</span></a>
</li>
</ul>
</div>
</nav>
<div class="rahmen">
<div class="row">
<div class="col-12">
<h2>Außenluft</h2>
</div>
</div>
<div class="row">
<div class="col-6">
<div class="container">
<table class="table table-striped">
<thead>
<tr align="center" style="font-size:20px">
<th>NO2 [µg/m3]</th>
<th>PM10 [µg/m3]</th>
<th>Hum. [%]</th>
<th>Temp. [°C]</th>
</tr>
</thead>
<tbody>
<tr align="center" class="display-4">
<td id="extern_no2"></td>
<td id="extern_pm10"></td>
<td id="extern_hum"></td>
<td id="extern_temp"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="col-6">
<img id="bild_aussen" class="img-fluid" src="" alt="">
</div>
</div>
<div class="row">
<div class="border col-6">
<div class="row">
<div class="col-4">
<h2 class="room-head">Raum 1</h2>
<img id="nase1" class="img-fluid" src="" alt="" srcset="">
</div>
<div class="col-8 parameter-list d-flex flex-column">
<div><img class="img-fluid" src="./img/tropfen.png">
<strong class="display-4" id="r1_hum"></strong>
</div>
<div><img class="img-fluid" src="./img/thermometer.png"><strong class="display-4"
id="r1_temp"></strong>
</div>
<div><img class="img-fluid" src="./img/CO2.png"> <strong class="display-4" id="r1_co2"></strong>
</div>
<div><img class="img-fluid" src="./img/VOC.png"> <strong class="display-4" id="r1_voc"></strong>
</div>
</div>
</div>
</div>
<div class="border col-6">
<div class="row">
<div class="col-4">
<h2 class="room-head">Raum 2</h3>
<img id="nase2" class="img-fluid" src="" alt="" srcset="">
</div>
<div class="col-8 parameter-list d-flex flex-column">
<div><img class="img-fluid" src="./img/tropfen.png"><strong class="display-4"
id="r2_hum"></strong>
</div>
<div><img class="img-fluid" src="./img/thermometer.png"><strong class="display-4"
id="r2_temp"></strong>
</div>
<div><img class="img-fluid" src="./img/CO2.png"> <strong class="display-4" id="r2_co2"></strong>
</div>
<div><img class="img-fluid" src="./img/VOC.png"> <strong class="display-4" id="r2_voc"></strong>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="border col-6">
<h4 id="Text1">Ermittle Empfehlung...</h4>
</div>
<div class="border col-6">
<h4 id="Text2">Ermittle Empfehlung...</h4>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js"
integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo"
crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"
integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1"
crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"
integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM"
crossorigin="anonymous"></script>
<script>
function refresh_data() {
fetch('http://10.4.135.32:5000/get-data', {
method: 'get'
}).then(function (response
) {
return response.json();
}).then(function (json) {
console.log("Daten übergabe");
updateData(json)
});
if (ZAussen >= ZRaum1) {
document.getElementById("Text1").innerHTML = "Fenster öffnen";
} else {
document.getElementById("Text1").innerHTML = "Fenster schließen";
}
if (ZAussen >= ZRaum2) {
document.getElementById("Text2").innerHTML = "Fenster öffnen";
} else {
document.getElementById("Text2").innerHTML = "Fenster schließen";
}
}
refresh_data();
console.log("Elemente finden!");
const r1Temp = document.getElementById("r1_temp");
const r1hum = document.getElementById("r1_hum");
const r1co2 = document.getElementById("r1_co2");
const r1voc = document.getElementById("r1_voc");
const r2hum = document.getElementById("r2_hum");
const r2temp = document.getElementById("r2_temp");
const r2co2 = document.getElementById("r2_co2");
const r2voc = document.getElementById("r2_voc");
const externno2 = document.getElementById("extern_no2");
const externpm10 = document.getElementById("extern_pm10");
const nose1 = document.getElementById("nase1");
const nose2 = document.getElementById("nase2");
const pic_ext = document.getElementById("bild_aussen");
const exthum = document.getElementById("extern_hum");
const exttemp = document.getElementById("extern_temp");
var ZRaum1 = 0;
var ZRaum2 = 0;
var ZAussen = 0;
function updateData(data) {
console.log("Daten aktualisieren")
r1Temp.innerText = data.intern[0].temp + " °C";
r1hum.innerText = data.intern[0].hum + " %";
r1co2.innerText = data.intern[0].co2 + " ppm";
changeNose(nose1, data.intern[0].co2, data.intern[0].voc);
changeNose(nose2, data.intern[1].co2, data.intern[1].voc);
r1voc.innerText = data.intern[0].voc + " ppb";
r2hum.innerText = data.intern[1].hum + " %";
r2temp.innerText = data.intern[1].temp + " °C";
r2co2.innerText = data.intern[1].co2 + " ppm";
r2voc.innerText = data.intern[1].voc + " ppb";
externno2.innerText = data.extern.no2;
externpm10.innerText = data.extern.pm10;
change_pic_ext(pic_ext, data.extern.no2, data.extern.pm10);
exthum.innerText = data.extern.hum;
exttemp.innerText = data.extern.temp;
}
function change_pic_ext(pic, no2_data, pm10_data) {
if (no2_data <= 30 || pm10_data <= 30) {
pic.src = "./img/nice_bg_schmal.png";
ZAussen = 3;
}
else if (no2_data > 30 && no2_data < 100 || pm10_data > 30 && pm10_data < 50) {
pic.src = "./img/mittel_bg_schmal.png";
ZAussen = 2;
}
else {
pic.src = "./img/bad_bg_schmal.png";
ZAussen = 1;
}
}
function changeNose(nose, co2_data, voc_data) {
if (co2_data <= 1000) {
nose.src = "./img/nasegut.png";
if (nose == nose1) {
ZRaum1 = 3;
} else {
ZRaum2 = 3;
}
}
else if (co2_data > 1000 && co2_data < 2000) {
nose.src = "./img/mittel.png";
if (nose == nose1) {
ZRaum1 = 2;
} else {
ZRaum2 = 2;
}
}
else {
nose.src = "./img/naseschlecht.png";
if (nose == nose1) {
ZRaum1 = 1;
} else {
ZRaum2 = 1;
}
}
}
setInterval(function () { refresh_data(); }, 3000);
</script>
</div>
</body>
</html>