Select Git revision
dosing.yaml
dosing.yaml 1.80 KiB
switch:
- platform: template
id: ph_dosing_enabled
name: "pH Dosing"
optimistic: true
restore_mode: RESTORE_DEFAULT_OFF
select:
- platform: template
id: ph_dosing_target
name: "pH Dosing: Target Value"
options: ["5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7", "5.8", "5.9", "6.0", "6.1", "6.2", "6.3", "6.4", "6.5"]
initial_option: "5.8"
optimistic: true
restore_value: true
- platform: template
id: ph_dosing_min
name: "pH Dosing: Min. Value"
options: ["5.0", "5.1", "5.2", "5.3", "5.4", "5.5", "5.6", "5.7", "5.8", "5.9", "6.0"]
initial_option: "5.5"
optimistic: true
restore_value: true
- platform: template
id: ph_dosing_max
name: "pH Dosing: Max. Value"
options: ["5.5", "5.6", "5.7", "5.8", "5.9", "6.0", "6.1", "6.2", "6.3", "6.4", "6.5"]
initial_option: "6.0"
optimistic: true
restore_value: true
interval:
- interval: 15min
then:
- script.execute: ph_dosing
script:
- id: ph_dosing
then:
- lambda: |-
if (id(ph_dosing_enabled).state)
{
if (id(ph).state <= atof(id(ph_dosing_min).state.c_str()))
{
ESP_LOGI("dosing", "pH value too low (%.2f <= %.2f)", id(ph).state, atof(id(ph_dosing_min).state.c_str()));
id(ph_up).turn_on();
}
else if (id(ph).state >= atof(id(ph_dosing_max).state.c_str()))
{
ESP_LOGI("dosing", "pH value too high (%.2f >= %.2f)", id(ph).state, atof(id(ph_dosing_max).state.c_str()));
id(ph_down).turn_on();
}
else
{
ESP_LOGI("dosing", "pH value within range (%.2f <= %.2f <= %.2f)", atof(id(ph_dosing_min).state.c_str()), id(ph).state, atof(id(ph_dosing_max).state.c_str()));
}
}