forked from patience4711/ESP32-read-APS-inverters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
DETAILSPAGE.H
115 lines (102 loc) · 4.68 KB
/
DETAILSPAGE.H
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
const char DETAILSPAGE [] PROGMEM = R"=====(
<!DOCTYPE html><html><head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" type="text/css" href="/STYLESHEET">
<meta charset='utf-8'>
<link rel="icon" type="image/x-icon" href="/favicon.ico" />
<title>ESP-ECU</title>
<style>
table, th, td {border: 1px solid blue; font-size:14px; text-align:center}
body {margin:10px 10px 0px 20px; font-family:'lato',Verdana,Sans-serif;font-size:16px;}
tr {height:30px;}
.pol {display:none;}
@media only screen and (max-width: 800px) {
th, td { width:60px; font-size:12px; }
}
</style>
<script>
function loadScript() {
loadData();
setInterval(function ld() {
//console.log("setting interval");
loadData();
},90000);
}
function loadData() {
console.log("function loadData");
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var antwoord = this.responseText;
//console.log("answer = " + antwoord);
var obj = JSON.parse(antwoord);
// first display general data name, shortid, type,
document.getElementById("ivn").innerHTML = obj.inv;
document.getElementById("nm").innerHTML = "<strong>" + obj.name + "</strong>";
document.getElementById("snr").innerHTML = obj.serial;
var sid = obj.sid; //if 0000 not paired
document.getElementById("sid").innerHTML = sid;
var t = obj.type;
var type ="YC600";
if(t=="1"){type="QS1";} if(t=="2") {type = "DS3";}
document.getElementById("tp").innerHTML = type;
//console.log("sid = " + sid);
if(sid != "0000" || sid == "") {
var polled = obj.polled;
if( polled=="1" ) {
document.getElementById("dcvc").style.display = "block";
document.getElementById("npo").style.display = "none";
document.getElementById("sq").innerHTML = obj.sq + " %";
document.getElementById("acv").innerHTML = obj.acv + " V";
document.getElementById("tmp").innerHTML = obj.temp + " ℃"
document.getElementById("fr").innerHTML = obj.freq + " Hz";
document.getElementById("v0").innerHTML = obj.dcv0;
document.getElementById("v1").innerHTML = obj.dcv1;
document.getElementById("v2").innerHTML = obj.dcv2;
document.getElementById("v3").innerHTML = obj.dcv3;
document.getElementById("c0").innerHTML = obj.dcc0;
document.getElementById("c1").innerHTML = obj.dcc1;
document.getElementById("c2").innerHTML = obj.dcc2;
document.getElementById("c3").innerHTML = obj.dcc3;
} else {
//display the not polled message
document.getElementById("npo").style.display = "block";
document.getElementById("dcvc").style.display = "none";
}
} else {
document.getElementById("npa").style.display = "block";
}
}
};
xhttp.open("GET", "get.Inverter", true);
xhttp.send();
}
</script>
</head><body onload='loadScript()'><center>
<h3>ESP-ECU INVERTER : <span id="ivn"></span></h3>
<table>
<tr><td colspan="2" id="nm"></tr>
<colgroup><col span="1" style="background:#00cc66; width:100px;"><col span="1" style="background:#99ffcc; width:120px;"></colgroup>
<tr><td> Type <td id="tp">n/a</td></tr>
<tr><td> serialnr <td id="snr">n/a</td></tr>
<tr><td> ID <td id="sid">n/a</td></tr>
<tr><td> signal quality <td id="sq">n/a</td></tr>
<tr><td> ac voltage<td id="acv">n/a</td></tr>
<tr><td> temperature<td id="tmp">n/a</td></tr>
<tr><td> frequency<td id="fr">n/a</td></tr>
</table>
<h4>INVERTER OUTPUT</h4>
<div id="dcvc" style="display:none;">
<table><tr style='background:#ccff33;'><td>unit</td><td>panel 0<td>panel 1<td>panel 2<td>panel 3</tr>
<colgroup><col span='1' style='background:#00cc66; width:80px;'><col span='4' style='background:#99ffcc; width:80px;'></colgroup>
<tr><td>dc voltage<td id="v0">n/a</td><td id="v1">n/a</td>
<td id="v2">n/a</td><td id="v3">n/a</td></tr>
<tr><td>dc current<td id="c0">n/a</td><td id="c1">n/a</td>
<td id="c2">n/a</td><td id="c3">n/a</td></tr>
</table></div>
<span id="npa" style="display:none;"><h2>this inverter is not paired!</h2></span>
<span id="npo" style="display:none;"><h2>this inverter is not polled!</h2></span>
<div style="position:fixed; text-align:center; width:100%;"><br><a href="/"><button style="width:150px; height:50px;text-align:center; font-weight:bold; font-size:20px; background:#db97b9;">close</button></a></div>
<br><br><br><br>
</body></html>
)=====";