allow parsing config with missing keys, added nightlamp config stuff, added nightlamp testing,
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user