hestia/www/views/index.html

98 lines
4.6 KiB
HTML
Raw Normal View History

2022-12-20 20:17:30 +00:00
<!DOCTYPE html>
<html>
<head>
2022-12-21 19:16:29 +00:00
<title>Hestia Web Portal</title>
2022-12-20 20:17:30 +00:00
<link rel="stylesheet" href="/main.css">
</head>
2022-12-21 18:50:09 +00:00
<body onload="refreshData()">
2022-12-20 20:53:25 +00:00
<%- include('trial.html') -%>
2022-12-21 19:16:29 +00:00
<div id="title">Hestia Web Portal</div>
2022-12-21 18:50:09 +00:00
<div id="status">Auger: <span id="auger-status"></span> | Igniter: <span id="igniter-status"></span> | Combustion Blower: <span id="blower-status"></span></div>
<div id="safeties">Vacuum: <span id="vacuum-status"></span> | Proof of Fire: <span id="pof-status"></span></div>
2022-12-20 20:17:30 +00:00
<div id="controls-container">
2022-12-21 02:12:22 +00:00
<form action="/" method="post">
2022-12-20 20:17:30 +00:00
<!-- Start | Shutdown | Reload Settings -->
2022-12-22 02:07:46 +00:00
<div class="button-container">
<input class="button-unselected" type="submit" id="ignite" value="Start" name="start"><input class="button-unselected" type="submit" id="shutdown" value="Shutdown" name="shutdown"><input class="button-unselected" type="submit" id="reload" value="Reload" name="reload"><br>
2022-12-20 20:17:30 +00:00
</div>
<!-- Set feed rates -->
2022-12-22 02:07:46 +00:00
<!-- <label for="augerOn">Auger On Interval: </label><input type="number" id="auger-on" name="augerOn" min="500" max="1000" value="<%= intervals.augerOn %>">ms<br> -->
<!-- <label for="augerOff">Auger Off Interval: </label><input type="number" id="auger-off" name="augerOff" min="1000" max="2000" value="<%= intervals.augerOff %>">ms<br> -->
<!-- <label for="pauseInt">App Pause Interval: </label><input type="number" id="pause-int" name="pauseInt" min="1000" max="600000" value="<%= intervals.pause %>">ms<br> -->
2022-12-20 20:17:30 +00:00
</form>
</div>
2022-12-22 02:07:46 +00:00
<div class="subheading">
Pellet Feed Rate
</div>
<div class="button-container">
<button class="button-unselected" id="low-level">LOW</button><button class="button-unselected" id="med-level">MED</button><button class="button-unselected" id="hi-level">HI</button>
</div>
<div class="button-container">
<img src="./dancing_jesus.gif">
</div>
2022-12-20 20:17:30 +00:00
<div id="log-container">
2022-12-21 18:50:09 +00:00
<button id="refresh-log" onclick="refreshLog()">Refresh Log</button><br>
<!-- <textarea id="log-area"></textarea> -->
2022-12-20 20:53:25 +00:00
<iframe id="log-area" src="log.txt"></iframe>
2022-12-20 20:17:30 +00:00
</div>
2022-12-20 20:53:25 +00:00
<script>
2022-12-21 18:50:09 +00:00
function sleep(ms) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve();
}, ms);
});
}
function readJSON(path) {
var request = new XMLHttpRequest();
request.open("GET", path, false);
request.send(null)
var JSONObj = JSON.parse(request.responseText);
return JSONObj;
}
2022-12-22 02:07:46 +00:00
function parseStatus(data) {
switch (data) {
case 0:
return "Off";
break;
case 1:
return "On";
break
default:
return "Error";
break;
}
}
2022-12-21 18:50:09 +00:00
function refreshData() {
const log = document.getElementById('log-area');
log.contentWindow.location.reload();
sleep(100).then(() => {
document.getElementById('log-area').contentWindow.scrollTo(0, 9999999);
});
const augerStatus = document.getElementById('auger-status');
2022-12-22 02:31:59 +00:00
// const augerOn = document.getElementById('auger-on');
// const augerOff = document.getElementById('auger-off');
2022-12-21 18:50:09 +00:00
const igniterStatus = document.getElementById('igniter-status');
const blowerStatus = document.getElementById('blower-status');
2022-12-22 02:31:59 +00:00
// const pauseInt = document.getElementById('pause-int');
2022-12-21 18:50:09 +00:00
const config = readJSON('./config.json');
2022-12-22 02:07:46 +00:00
augerStatus.innerHTML = parseStatus(config.status.auger);
2022-12-22 02:31:59 +00:00
// augerOn.innerHTML = parseStatus(config.intervals.augerOn);
// augerOff.innerHTML = parseStatus(config.intervals.augerOff);
2022-12-22 02:07:46 +00:00
igniterStatus.innerHTML = parseStatus(config.status.igniter);
blowerStatus.innerHTML = parseStatus(config.status.blower);
2022-12-22 02:31:59 +00:00
// pauseInt.innerHTML = parseStatus(config.intervals.pause);
2022-12-21 18:50:09 +00:00
sleep(2000).then(() => {
refreshData();
2022-12-20 20:53:25 +00:00
});
};
</script>
2022-12-20 20:17:30 +00:00
</body>
</html>