Add startup and shutdown buttons

This commit is contained in:
Skylar Grant 2024-08-22 21:53:56 -04:00
parent 6ac88305a6
commit cc5dca9628
3 changed files with 30 additions and 0 deletions

View File

@ -114,4 +114,18 @@ export class Communicator {
} }
}); });
} }
// Send startup command
startup() {
this.send('hestia/command/startup', JSON.stringify({
"publisher": "front"
}));
}
// Send shutdown command
shutdown() {
this.send('hestia/command/shutdown', JSON.stringify({
"publisher": "front"
}));
}
} }

View File

@ -61,6 +61,16 @@ export function togglePower(element) {
refreshState(window.document, psState); refreshState(window.document, psState);
} }
export function startup() {
psState.startup(comms);
refreshState(window.document, psState);
}
export function shutdown() {
psState.shutdown(comms);
refreshState(window.document, psState);
}
window.onload = function() { window.onload = function() {
comms.init(psState, config); comms.init(psState, config);
refreshState(window.document, psState); refreshState(window.document, psState);

View File

@ -64,6 +64,12 @@
<div class="button-container flex mt-4"> <div class="button-container flex mt-4">
<input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="auger-toggle-btn" value="Toggle Auger" name="augerToggle" onclick="togglePower('auger')"> <input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="auger-toggle-btn" value="Toggle Auger" name="augerToggle" onclick="togglePower('auger')">
</div> </div>
<div class="button-container flex mt-4">
<input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="start-btn" value="Startup" name="startButton" onclick="startup()">
</div>
<div class="button-container flex mt-4">
<input class="btn bg-gray-700 hover:bg-purple-600 text-white py-2 w-full rounded mx-auto" type="submit" id="stop-btn" value="Shutdown" name="stopButton" onclick="shutdown()">
</div>
<form action="/" method="post"> <form action="/" method="post">
<!-- Set feed rates --> <!-- Set feed rates -->
<div class="form-group mt-4"> <div class="form-group mt-4">