allow parsing config with missing keys, added nightlamp config stuff, added nightlamp testing,

This commit is contained in:
2025-03-08 18:47:30 +01:00
parent a4fd4acaa3
commit d11dc523f0
9 changed files with 140 additions and 41 deletions

View File

@@ -225,7 +225,16 @@ export class Controller {
}
}
testNightLamp(active: boolean){
var body: NightLampCommand = {
active: active
}
var pretty = JSON.stringify(body, undefined, 1);
fetch(PUBLIC_URL + "/lamptest", {
method: "POST",
body: pretty
})
}
testPlant(plantId: number) {
let counter = 0
@@ -349,11 +358,19 @@ export class Controller {
waitForReboot() {
console.log("Check if controller online again")
fetch(PUBLIC_URL + "/version", {
method: "POST",
method: "GET",
signal: AbortSignal.timeout(5000)
}).then(response => {
console.log("Reached controller, reloading")
window.location.reload();
if (response.status != 200){
console.log("Not reached yet, retrying")
setTimeout(controller.waitForReboot, 1000)
} else {
console.log("Reached controller, reloading")
controller.progressview.addIndeterminate("rebooting", "Reached Controller, reloading")
setTimeout(function(){
window.location.reload()
}, 2000);
}
})
.catch(err => {
console.log("Not reached yet, retrying")