add ability to override frequency per plant and adjust timezone, fix missing workhour for plants

This commit is contained in:
2025-05-06 22:33:33 +02:00
parent f8274ea7a8
commit 5fe1dc8f40
10 changed files with 257 additions and 94 deletions

View File

@@ -65,6 +65,17 @@ export class Controller {
console.log(error);
});
}
populateTimezones(): Promise<void> {
return fetch('/timezones')
.then(response => response.json())
.then(json => json as string[])
.then(timezones => {
controller.timeView.timezones(timezones)
})
.catch(error => console.error('Error fetching timezones:', error));
}
updateFileList() : Promise<void> {
return fetch(PUBLIC_URL + "/files")
.then(response => response.json())
@@ -308,7 +319,8 @@ export class Controller {
network: controller.networkView.getConfig(),
tank: controller.tankView.getConfig(),
night_lamp: controller.nightLampView.getConfig(),
plants: controller.plantViews.getConfig()
plants: controller.plantViews.getConfig(),
timezone: controller.timeView.getTimeZone()
}
}
@@ -350,6 +362,7 @@ export class Controller {
this.networkView.setConfig(current.network);
this.nightLampView.setConfig(current.night_lamp);
this.plantViews.setConfig(current.plants);
this.timeView.setTimeZone(current.timezone);
}
measure_moisture() {
@@ -459,30 +472,34 @@ export class Controller {
}
const controller = new Controller();
controller.progressview.removeProgress("rebooting");
controller.progressview.addProgress("initial", 0, "read rtc");
controller.updateRTCData().then(_ => {
controller.progressview.addProgress("initial", 20, "read battery");
controller.updateBatteryData().then(_ => {
controller.progressview.addProgress("initial", 40, "read config");
controller.downloadConfig().then(_ => {
controller.progressview.addProgress("initial", 50, "read version");
controller.version().then(_ => {
controller.progressview.addProgress("initial", 70, "read filelist");
controller.updateFileList().then(_ => {
controller.progressview.addProgress("initial", 90, "read backupinfo");
controller.getBackupInfo().then(_ => {
controller.loadLogLocaleConfig().then(_ => {
controller.loadTankInfo().then(_ => {
controller.progressview.removeProgress("initial")
controller.progressview.addProgress("initial", 0, "read timezones");
controller.populateTimezones().then(_ => {
controller.progressview.addProgress("initial", 10, "read rtc");
controller.updateRTCData().then(_ => {
controller.progressview.addProgress("initial", 20, "read battery");
controller.updateBatteryData().then(_ => {
controller.progressview.addProgress("initial", 40, "read config");
controller.downloadConfig().then(_ => {
controller.progressview.addProgress("initial", 50, "read version");
controller.version().then(_ => {
controller.progressview.addProgress("initial", 70, "read filelist");
controller.updateFileList().then(_ => {
controller.progressview.addProgress("initial", 90, "read backupinfo");
controller.getBackupInfo().then(_ => {
controller.loadLogLocaleConfig().then(_ => {
controller.loadTankInfo().then(_ => {
controller.progressview.removeProgress("initial")
})
})
})
})
})
})
});
})
})
;
});
});
});
});
//controller.measure_moisture();