button on index to get FW-Version

This commit is contained in:
Andreas Schiffler 2022-08-17 11:30:18 +02:00
parent e8524961c5
commit 458639b648
6 changed files with 25 additions and 11 deletions

View file

@ -5,6 +5,11 @@
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript">
document.addEventListener('DOMContentLoaded', function(){
document.getElementById("btn_req_fw").addEventListener("click", function(){
getInverterInfo(`{"inverter":0,"tx_request": 21,"cmd": 1}`);
});
});
getAjax('/uptime', 'uptime');
getAjax('/cmdstat', 'cmds');
window.setInterval("getAjax('/uptime', 'uptime')", {JS_TS});
@ -25,6 +30,16 @@
}
}
}
function getInverterInfo(data){
var http = null;
http = new XMLHttpRequest();
if(http != null) {
http.open("POST", "/api");
http.setRequestHeader("Accept", "application/json");
http.setRequestHeader("Content-Type", "application/json");
http.send(data);
}
}
</script>
</head>
<body>
@ -38,6 +53,7 @@
<p><span class="des">Uptime: </span><span id="uptime"></span></p>
<p><span class="des">Statistics: </span><pre id="cmds"></pre></p>
<p>Every {TS}seconds the values are updated</p>
<p><input type="button" id="btn_req_fw" value="Get FW-Info"/></p>
<div id="note">
This project was started from <a href="https://www.mikrocontroller.net/topic/525778" target="_blank">this discussion. (Mikrocontroller.net)</a><br/>