refactor: unify moisture handling, update config structure, and add peer dependencies

This commit is contained in:
2025-10-23 22:44:44 +02:00
parent 1db3f7af64
commit cafe1b264e
26 changed files with 516 additions and 69 deletions

View File

@@ -112,6 +112,7 @@ export interface PlantConfig {
pump_cooldown_min: number,
pump_hour_start: number,
pump_hour_end: number,
pump_limit_ml: number,
sensor_a: boolean,
sensor_b: boolean,
max_consecutive_pump_count: number,

View File

@@ -296,6 +296,7 @@ export class Controller {
configChanged() {
const current = controller.getConfig();
var pretty = JSON.stringify(current, undefined, 0);
controller.submitView.setJson(pretty);

View File

@@ -53,7 +53,7 @@
Mode:
</div>
<select class="plantvalue" id="plant_${plantId}_mode">
<option value="OFF">Off</option>
<option value="Off">Off</option>
<option value="TargetMoisture">Target</option>
<option value="MinMoisture">Min Moisture</option>
<option value="TimerOnly">Timer</option>

View File

@@ -213,7 +213,7 @@ export class PlantView {
console.log("updateVisibility plantConfig: " + plantConfig.mode)
let showSensor = plantConfig.sensor_a || plantConfig.sensor_b
let showPump = plantConfig.mode !== "OFF"
let showPump = plantConfig.mode !== "Off"
let showTarget = plantConfig.mode === "TargetMoisture"
let showMin = plantConfig.mode === "MinMoisture"
@@ -299,6 +299,7 @@ export class PlantView {
target_moisture: this.targetMoisture.valueAsNumber,
min_moisture: this.minMoisture.valueAsNumber,
pump_time_s: this.pumpTimeS.valueAsNumber,
pump_limit_ml: 5000,
pump_cooldown_min: this.pumpCooldown.valueAsNumber,
pump_hour_start: +this.pumpHourStart.value,
pump_hour_end: +this.pumpHourEnd.value,