feat: add fertilizer cooldown functionality with web UI, HAL integration, and configuration support

This commit is contained in:
2026-04-30 22:09:04 +02:00
parent 6809a37d9d
commit db0f7daa4c
8 changed files with 63 additions and 6 deletions

View File

@@ -129,6 +129,7 @@ export interface PlantConfig {
pump_time_s: number,
pump_cooldown_min: number,
fertilizer_s: number,
fertilizer_cooldown_min: number,
pump_hour_start: number,
pump_hour_end: number,
pump_limit_ml: number,

View File

@@ -83,6 +83,11 @@
<input class="plantvalue" id="plant_${plantId}_fertilizer_s" type="number" min="0" max="60"
placeholder="0">
</div>
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
<div class="plantkey">Fertilizer Cooldown (m):</div>
<input class="plantvalue" id="plant_${plantId}_fertilizer_cooldown_min" type="number" min="0" max="20160"
placeholder="1440">
</div>
<div class="flexcontainer plantPumpEnabledOnly_${plantId}">
<div class="plantkey">"Pump Hour Start":</div>
<select class="plantvalue" id="plant_${plantId}_pump_hour_start">10</select>

View File

@@ -80,6 +80,7 @@ export class PlantView {
private readonly pumpTimeS: HTMLInputElement;
private readonly pumpCooldown: HTMLInputElement;
private readonly fertilizerS: HTMLInputElement;
private readonly fertilizerCooldownMin: HTMLInputElement;
private readonly pumpHourStart: HTMLSelectElement;
private readonly pumpHourEnd: HTMLSelectElement;
private readonly sensorAInstalled: HTMLInputElement;
@@ -186,6 +187,11 @@ export class PlantView {
controller.configChanged()
}
this.fertilizerCooldownMin = document.getElementById("plant_" + plantId + "_fertilizer_cooldown_min") as HTMLInputElement;
this.fertilizerCooldownMin.onchange = function () {
controller.configChanged()
}
this.pumpHourStart = document.getElementById("plant_" + plantId + "_pump_hour_start") as HTMLSelectElement;
this.pumpHourStart.onchange = function () {
controller.configChanged()
@@ -335,6 +341,7 @@ export class PlantView {
this.pumpTimeS.value = plantConfig.pump_time_s.toString();
this.pumpCooldown.value = plantConfig.pump_cooldown_min.toString();
this.fertilizerS.value = plantConfig.fertilizer_s?.toString() || "0";
this.fertilizerCooldownMin.value = plantConfig.fertilizer_cooldown_min?.toString() || "1440";
this.pumpHourStart.value = plantConfig.pump_hour_start.toString();
this.pumpHourEnd.value = plantConfig.pump_hour_end.toString();
this.sensorBInstalled.checked = plantConfig.sensor_b;
@@ -363,6 +370,7 @@ export class PlantView {
pump_limit_ml: 5000,
pump_cooldown_min: this.pumpCooldown.valueAsNumber,
fertilizer_s: this.fertilizerS.valueAsNumber || 0,
fertilizer_cooldown_min: this.fertilizerCooldownMin.valueAsNumber || 1440,
pump_hour_start: +this.pumpHourStart.value,
pump_hour_end: +this.pumpHourEnd.value,
sensor_b: this.sensorBInstalled.checked,