allow to selectivly enable redundant sensors

This commit is contained in:
2024-02-17 17:25:50 +01:00
parent 680d1c3aaf
commit 9d1a807805
5 changed files with 260 additions and 101 deletions

View File

@@ -18,7 +18,9 @@ interface PlantConfig {
pump_time_s: number,
pump_cooldown_min: number,
pump_hour_start: number,
pump_hour_end: number
pump_hour_end: number,
sensor_b: boolean,
sensor_p: boolean
}[]
}
@@ -173,6 +175,32 @@ let fromWrapper = (() => {
holder.appendChild(text)
text.innerHTML += "Pump Hour End"
}
{
let holder = document.createElement("div");
plant.appendChild(holder);
let input = document.createElement("input");
input.id = "plant_" + i + "_sensor_b";
input.type = "checkbox";
input.onchange = updateJson;
holder.appendChild(input)
let text = document.createElement("span");
holder.appendChild(text)
text.innerHTML += "Sensor B installed"
}
{
let holder = document.createElement("div");
plant.appendChild(holder);
let input = document.createElement("input");
input.id = "plant_" + i + "_sensor_p";
input.type = "checkbox";
input.onchange = updateJson;
holder.appendChild(input)
let text = document.createElement("span");
holder.appendChild(text)
text.innerHTML += "Sensor P installed"
}
}
sync(current);
}
@@ -208,6 +236,11 @@ let fromWrapper = (() => {
plant_pump_hour_start.value = current.plants[i].pump_hour_start.toString();
let plant_pump_hour_end = document.getElementById("plant_" + i + "_pump_hour_end") as HTMLInputElement;
plant_pump_hour_end.value = current.plants[i].pump_hour_end.toString();
let plant_sensor_b = document.getElementById("plant_" + i + "_sensor_b") as HTMLInputElement;
plant_sensor_b.checked = current.plants[i].sensor_b;
let plant_sensor_p = document.getElementById("plant_" + i + "_sensor_p") as HTMLInputElement;
plant_sensor_p.checked = current.plants[i].sensor_p;
}
}
@@ -236,6 +269,8 @@ let fromWrapper = (() => {
let plant_pump_cooldown_min = document.getElementById("plant_" + i + "_pump_cooldown_min") as HTMLInputElement;
let plant_pump_hour_start = document.getElementById("plant_" + i + "_pump_hour_start") as HTMLInputElement;
let plant_pump_hour_end = document.getElementById("plant_" + i + "_pump_hour_end") as HTMLInputElement;
let plant_sensor_b = document.getElementById("plant_" + i + "_sensor_b") as HTMLInputElement;
let plant_sensor_p = document.getElementById("plant_" + i + "_sensor_p") as HTMLInputElement;
current.plants[i] = {
mode: plant_mode.value,
@@ -243,8 +278,9 @@ let fromWrapper = (() => {
pump_time_s: +plant_pump_time_s.value,
pump_cooldown_min: +plant_pump_cooldown_min.value,
pump_hour_start: +plant_pump_hour_start.value,
pump_hour_end: +plant_pump_hour_end.value
pump_hour_end: +plant_pump_hour_end.value,
sensor_b: plant_sensor_b.checked,
sensor_p: plant_sensor_p.checked
}
}
sync(current);