# Irrigation
Irrigation
T
R
P
S1
S2
S3
S4
S5
S6
S7
S8
# Eingänge
| ID | Kürzel | Name | Typ | Standard | Beschreibung |
|---|---|---|---|---|---|
trigger | T | trigger | BOOLEAN | false | |
reset | R | reset | BOOLEAN | false |
# Ausgänge
| ID | Kürzel | Name | Typ | Standard | Beschreibung |
|---|---|---|---|---|---|
pump | P | pump | BOOLEAN | false | |
section_1 | S1 | section_1 | BOOLEAN | false | |
section_2 | S2 | section_2 | BOOLEAN | false | |
section_3 | S3 | section_3 | BOOLEAN | false | |
section_4 | S4 | section_4 | BOOLEAN | false | |
section_5 | S5 | section_5 | BOOLEAN | false | |
section_6 | S6 | section_6 | BOOLEAN | false | |
section_7 | S7 | section_7 | BOOLEAN | false | |
section_8 | S8 | section_8 | BOOLEAN | false |
# Konfiguration
| ID | Name | Typ | Standard | Einheit | Beschreibung |
|---|---|---|---|---|---|
s1_enabled | s1_enabled | BOOLEAN | true | ||
s1_duration | s1_duration | NUMBER | 600 | s | Details: Sichtbar wenn s1_enabled = true≥ 0 |
s2_enabled | s2_enabled | BOOLEAN | false | ||
s2_duration | s2_duration | NUMBER | 600 | s | Details: Sichtbar wenn s2_enabled = true≥ 0 |
s3_enabled | s3_enabled | BOOLEAN | false | ||
s3_duration | s3_duration | NUMBER | 600 | s | Details: Sichtbar wenn s3_enabled = true≥ 0 |
s4_enabled | s4_enabled | BOOLEAN | false | ||
s4_duration | s4_duration | NUMBER | 600 | s | Details: Sichtbar wenn s4_enabled = true≥ 0 |
s5_enabled | s5_enabled | BOOLEAN | false | ||
s5_duration | s5_duration | NUMBER | 600 | s | Details: Sichtbar wenn s5_enabled = true≥ 0 |
s6_enabled | s6_enabled | BOOLEAN | false | ||
s6_duration | s6_duration | NUMBER | 600 | s | Details: Sichtbar wenn s6_enabled = true≥ 0 |
s7_enabled | s7_enabled | BOOLEAN | false | ||
s7_duration | s7_duration | NUMBER | 600 | s | Details: Sichtbar wenn s7_enabled = true≥ 0 |
s8_enabled | s8_enabled | BOOLEAN | false | ||
s8_duration | s8_duration | NUMBER | 600 | s | Details: Sichtbar wenn s8_enabled = true≥ 0 |
# Zustand
| ID | Name | Typ | Standard | Einheit | Beschreibung |
|---|---|---|---|---|---|
active | active | BOOLEAN | false |
# Quellcode
Volang-Quellcode anzeigen
channel = input::channel()
section_count = 8
fn disable_all(section_count) {
section = 0
while (section < section_count) {
section += 1
output::set(str::fmt("section_{}", section), false)
}
}
extern fn onCallback(section_count, callback_id) {
disable_all(section_count)
current_section = 0
if (callback_id == 0) {
output::set("pump", true)
callback::set(0, "onCallback", section_count, 1)
return
} else if (callback_id > 0 and callback_id < (section_count + 1)) {
current_section = callback_id
} else if (callback_id == (section_count + 1)) {
output::set("pump", false)
state::set("active", false)
return
}
section_output = str::fmt("section_{}", current_section)
section_enabled_cfg = str::fmt("s{}_enabled", current_section)
section_duration_cfg = str::fmt("s{}_duration", current_section)
section_enabled = config::get(section_enabled_cfg)
section_duration = config::get(section_duration_cfg)
if (!section_enabled) {
callback::set(0, "onCallback", section_count, current_section + 1)
return
}
output::set(section_output, true)
callback::set(section_duration * 1000, "onCallback", section_count, current_section + 1)
}
input_value = input::value()
if (channel == "trigger" and input_value) {
if (state::get("active")) {
return
}
state::set("active", true)
callback::set(0, "onCallback", section_count, 0)
return
}
if (channel == "reset") {
callback::clear()
callback::set(0, "onCallback", section_count, section_count + 1)
return
}
