-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.html
More file actions
246 lines (214 loc) · 12.2 KB
/
Copy pathapp.html
File metadata and controls
246 lines (214 loc) · 12.2 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Welcome to My Express App</title>
<style>
body {
font-family: Arial, sans-serif;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
h1 {
color: #333333;
}
.logo {
width: 200px;
height: auto;
margin: 20px 0;
}
.svg-text {
font-weight: bold;
fill: black;
font-size: 12px;
}
.hover-effect {
cursor: pointer;
/* Shows the pointer cursor on hover */
transition: transform 0.2s ease-in-out;
/* Optional: Smooth effect */
}
.hover-effect:hover {
transform: scale(1.1);
/* Optional: Slight zoom on hover */
}
</style>
<script>
async function fetchData() {
try {
const response = await fetch('/dashboard');
const data = await response.json();
// data.heatPump.runningStatus = true;
// data.aku.status = true;
document.getElementById('data').innerText = `Done`;
const fan = document.getElementById('fan');
const fanCircle = document.getElementById('fan-circle');
const fanColor = data.heatPump.runningStatus ? '#d80023' : 'gray';
fanCircle.setAttribute('stroke', fanColor);
fan.setAttribute('fill', fanColor);
const outletTemperature = document.getElementById("outletTemperature");
outletTemperature.textContent = `${data.heatPump.outletTemperature}`;
const inletTemperature = document.getElementById("inletTemperature");
inletTemperature.textContent = `${data.heatPump.inletTemperature}`;
if (data.heatPump.runningStatus) {
fan.style.animation = 'oscillate 2s linear infinite';
} else {
fan.style.animation = 'none';
}
const pipe1RedColor = data.aku.status ? 'red' : 'gray';
pipe1red.setAttribute('stroke', pipe1RedColor);
pipe1red.setAttribute('opacity', '0.5');
const pipe1BlueColor = data.aku.status ? 'blue' : 'gray';
pipe1blue.setAttribute('stroke', pipe1BlueColor);
pipe1blue.setAttribute('opacity', '0.5');
if (data.aku.status) {
const pipe1redCircle = document.getElementById("pipe1redCircle");
const pipe1redAnimateMotion = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion");
pipe1redAnimateMotion.setAttribute("dur", "4s");
pipe1redAnimateMotion.setAttribute("repeatCount", "indefinite");
pipe1redAnimateMotion.setAttribute("keyTimes", "0;0.5;1");
pipe1redAnimateMotion.setAttribute("keyPoints", "0;1;1");
const pipe1redMpath = document.createElementNS("http://www.w3.org/2000/svg", "mpath");
pipe1redMpath.setAttribute("href", "#pipe1red");
pipe1redAnimateMotion.appendChild(pipe1redMpath);
pipe1redCircle.appendChild(pipe1redAnimateMotion);
const pipe1blueCircle = document.getElementById("pipe1blueCircle");
const pipe1blueAnimateMotion = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion");
pipe1blueAnimateMotion.setAttribute("begin", "2s");
pipe1blueAnimateMotion.setAttribute("dur", "4s");
pipe1blueAnimateMotion.setAttribute("repeatCount", "indefinite");
pipe1blueAnimateMotion.setAttribute("keyTimes", "0;0.5;1");
pipe1blueAnimateMotion.setAttribute("keyPoints", "0;1;1");
const pipe1blueMpath = document.createElementNS("http://www.w3.org/2000/svg", "mpath");
pipe1blueMpath.setAttribute("href", "#pipe1blue");
pipe1blueAnimateMotion.appendChild(pipe1blueMpath);
pipe1blueCircle.appendChild(pipe1blueAnimateMotion);
}
if (data.zone1.status) {
const zone1Circle = document.getElementById("zone1Circle");
const zone1AnimateMotion = document.createElementNS("http://www.w3.org/2000/svg", "animateMotion");
zone1AnimateMotion.setAttribute("dur", "8s");
zone1AnimateMotion.setAttribute("repeatCount", "indefinite");
zone1AnimateMotion.setAttribute("keyTimes", "0;1");
zone1AnimateMotion.setAttribute("keyPoints", "0;1");
const zone1Mpath = document.createElementNS("http://www.w3.org/2000/svg", "mpath");
zone1Mpath.setAttribute("href", "#zone1pipe");
zone1AnimateMotion.appendChild(zone1Mpath);
zone1Circle.appendChild(zone1AnimateMotion);
}
const waterTemperature = document.getElementById("waterTemperature");
waterTemperature.textContent = `${data.water.actualTemperature}`;
const waterRequiredTemperature = document.getElementById("waterRequiredTemperature");
waterRequiredTemperature.textContent = `(${data.water.requiredTemperature})`;
const akuTopTemperature = document.getElementById("akuTopTemperature");
akuTopTemperature.textContent = `${data.aku.topTemperature}`;
const akuBottomTemperature = document.getElementById("akuBottomTemperature");
akuBottomTemperature.textContent = `${data.aku.bottomTemperature}`;
} catch (error) {
console.error('Error fetching data:', error);
}
}
setInterval(fetchData, 5000);
</script>
</head>
<body>
<div>statistic file <a href="/download?fileName=statLog.csv"></a>
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" class="hover-effect">
<title>statLog.csv</title>
<path
d="M14,2H6C4.89,2 4,2.89 4,4V20C4,21.11 4.89,22 6,22H18C19.11,22 20,21.11 20,20V8L14,2M12,19L8,15H10.5V12H13.5V15H16L12,19M13,9V3.5L18.5,9H13Z" />
</svg>
</a>
</div>
<div id="data">Loading...</div>
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600">
<!-- <rect x="0" y="0" width="100%" height="100%" fill="wheat" /> -->
<style>
@keyframes oscillate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<!-- pipes between heat and aku -->
<path d="M 245 370 L 308 370 L 308 420 L 355 420" stroke-width="10" fill="transparent" stroke="gray"
stroke-linecap="round" stroke-linejoin="round" />
<path d="M 355 435 L 292 435 L 292 385 L 245 385" stroke-width="10" fill="transparent" stroke="gray"
stroke-linecap="round" stroke-linejoin="round" />
<path d="M 245 370 L 308 370 L 308 420 L 355 420" stroke-width="8" fill="transparent" stroke="white"
stroke-linecap="round" stroke-linejoin="round" />
<path d="M 355 435 L 292 435 L 292 385 L 245 385" stroke-width="8" fill="transparent" stroke="white"
stroke-linecap="round" stroke-linejoin="round" />
<path id="pipe1red" d="M 245 370 L 308 370 L 308 420 L 355 420" stroke-width="8" fill="transparent"
stroke-linecap="round" stroke-linejoin="round" /> //red
<path id="pipe1blue" d="M 355 435 L 292 435 L 292 385 L 245 385" stroke-width="8" fill="transparent"
stroke-linecap="round" stroke-linejoin="round" /> //blue
<!-- pipes between solar and aku -->
<!-- <path id="pipe2red" d="M 80 170 L 80 470 L 355 470" stroke-width="10" fill="transparent" stroke-linecap="round"
stroke-linejoin="round" stroke="red" /> //red
<path id="pipe2blue" d="M 355 485 L 64 485 L 64 170" stroke-width="10" fill="transparent" stroke-linecap="round"
stroke-linejoin="round" stroke="blue" /> //blue -->
<!-- pipes between aku and floor heating-->
<defs>
<linearGradient id="colorGradient" x1="100%" y1="100%" x2="100%" y2="0%">
<stop offset="0%" style="stop-color:blue;stop-opacity:1" />
<stop offset="100%" style="stop-color:red;stop-opacity:1" />
</linearGradient>
</defs>
L650,420 C658,420, 658,432, 650,432 L550,432
<path d="M490,420 L650,420
C658,420, 658,432, 650,432 L550,432
C542,432 542,444 550,444 L650,444
C658,444, 658,456, 650,456 L550,456
C542,456 542,468 550,468 L650,468
C658,468, 658,480, 650,480 L490,480" stroke-width="8" fill="transparent" stroke-linecap="round"
stroke-linejoin="round" stroke="gray" />
<path id="zone1pipe" d="M490,420 L650,420
C658,420, 658,432, 650,432 L550,432
C542,432 542,444 550,444 L650,444
C658,444, 658,456, 650,456 L550,456
C542,456 542,468 550,468 L650,468
C658,468, 658,480, 650,480 L490,480" stroke-width="6" fill="transparent" stroke-linecap="round"
stroke-linejoin="round" stroke="url(#colorGradient)" />
<circle id="pipe1redCircle" r="4" fill="white"></circle>
<circle id="pipe1blueCircle" r="4" fill="white"></circle>
<circle id="zone1Circle" r="3" fill="white"></circle>
<!-- heat pump box -->
<rect x="100" y="300" width="150" height="100" rx="3" ry="3" fill="lightgray" stroke="gray" stroke-width="4" />
<line x1="120" y1="400" x2="115" y2="415" stroke="gray" stroke-width="8" />
<line x1="230" y1="400" x2="235" y2="415" stroke="gray" stroke-width="8" />
<text id="outletTemperature" x="115" y="350" class="svg-text" style="fill: black"></text>
<text id="inletTemperature" x="115" y="370" class="svg-text" style="fill: black"></text>
<!-- regulus logo -->
<g fill="#d80023" transform="matrix(0.2,0,0,0.2,45,265)">
<path
d="M468.7 290.91c-101.72-.38-105.5-46.93-105.5-46.93 5.4.35 34.3-2.24 34.58-18.24.28-16-19.92-16.34-19.92-16.34l-32.83-.07-19.05 63.52c.9 12.52 10.14 19.67 10.14 19.67l13.75-43.14c9.33 33.32 47.06 50.08 109.65 51.46 71.76 1.58 119.32-23.26 119.32-23.26l2.26-8c-29.48 12.63-75.22 21.47-112.4 21.33M354.04 235.4l5.52-18h16.42s8.38-.07 7.68 8.63c-.67 8.31-17.68 10.16-29.62 9.37" />
<path
d="M415.11 254.85s6.84-17.62-8.79-17.94c-15.63-.32-21.11 13.33-21.67 16.52-.53 3-1.74 20.42 26.04 13.63l1.79-6.42s-20.57 7.05-18-5.79zm-9.73-12.62c5.26.9 3.42 7.15 3.42 7.15h-13.05s4.37-8.05 9.63-7.15m43.5-4.58c-18.27-3.77-25.32 9.98-25.32 9.98s-7.4 12.8.76 17.9c6.5 4.08 14.71-.15 14.71-.15-1.75 13.75-20.7 7.71-20.7 7.71l-3.15 6.39c27.64 7.5 31.7-11.58 31.7-11.58l8.63-30.31-6.62.06zm-8.3 20.68s-4.74 2.68-8.27 1.57c-3.53-1.11-2.78-4.84-2.78-4.84s2.42-15.15 16.04-12.2l-5 15.47zm41.63 10.26 8.95-30.95h-9.03l-7.04 22.74s-3.71 3.26-8.1 1.63c-1.49-.55-1.2-1.93-1.1-2.26l6.45-22.1h-8.95l-7.14 24.04s-2.65 6.18 6.65 7.1c3.25.33 5.53-.1 7.12-.55l3.19-1.05-.31 1.4h9.3zm17.28 0 15.37-52.46h-9.26l-15.52 52.46zm46.03-8.23s13.75 4.33 14.27-1.09c.3-3.05-4.31-4-6-4.78-1.69-.78-6.3-2.69-5.25-8.58 1.05-5.89 8.47-10.94 23.1-8l-1.43 5.26s-11.98-2.42-12.2 3.1c-.07 1.73 2.7 2.53 3.78 3.06 1.34.65 8.53 2.3 8 10.03-.53 7.73-10.68 12.7-26.25 8.23zm-9.86 8.23 8.93-30.95h-9l-7.05 22.74s-3.71 3.26-8.1 1.63c-1.49-.55-1.2-1.93-1.1-2.26l6.45-22.1h-8.94l-7.14 24.04s-2.66 6.18 6.64 7.1c3.25.33 5.53-.1 7.12-.55l3.2-1.05-.32 1.4h9.3z" />
</g>
<!-- fan -->
<circle id="fan-circle" cx="200" cy="350" r="35" stroke="gray" stroke-width="3" fill="#ffffcc"></circle>
<g transform="matrix(2.8,0,0,2.8,167,317)">
<path id="fan" fill="gray" transform-origin="12px 12px"
d="M12 11a1 1 0 0 0-1 1a1 1 0 0 0 1 1a1 1 0 0 0 1-1a1 1 0 0 0-1-1m.5-9c4.5 0 4.61 3.57 2.25 4.75c-.99.49-1.43 1.54-1.62 2.47c.48.2.9.51 1.22.91c3.7-2 7.68-1.21 7.68 2.37c0 4.5-3.57 4.6-4.75 2.23c-.5-.99-1.56-1.43-2.49-1.62c-.2.48-.51.89-.91 1.23c1.99 3.69 1.2 7.66-2.38 7.66c-4.5 0-4.59-3.58-2.23-4.76c.98-.49 1.42-1.53 1.62-2.45c-.49-.2-.92-.52-1.24-.92C5.96 15.85 2 15.07 2 11.5C2 7 5.56 6.89 6.74 9.26c.5.99 1.55 1.42 2.48 1.61c.19-.48.51-.9.92-1.22C8.15 5.96 8.94 2 12.5 2" />
</g>
<!-- aku box -->
<rect x="350" y="250" width="150" height="250" rx="3" ry="3" fill="lightgray" stroke="gray" stroke-width="4" />
<line x1="370" y1="500" x2="365" y2="515" stroke="gray" stroke-width="8" />
<line x1="480" y1="500" x2="485" y2="515" stroke="gray" stroke-width="8" />
<line x1="350" y1="380" x2="500" y2="380" stroke="gray" stroke-width="4" />
<text id="waterTemperature" x="415" y="300" class="svg-text" style="fill: black"></text>
<text id="waterRequiredTemperature" x="415" y="320" class="svg-text" style="fill: black"></text>
<text id="akuTopTemperature" x="415" y="400" class="svg-text" style="fill: black"></text>
<text id="akuBottomTemperature" x="415" y="480" class="svg-text" style="fill: black"></text>
</svg>
</body>
</html>