Hi, I need some advice.
I’m building an ESP sprinkler with:
• 1 water pump
• 6 valves
• 1 tank level sensor
I’m using the “sprinkler” component of ESPhome.
For me it would be very important that for each sprinkler, I could choose, in addition to the duration, the interval of days. This is because I water some plants every 3 days, others every 2 days and others daily.
Each plant has different needs (I use it to water potted plants).
Example sprinkler options (valves):
SPRINKLER_1
Enable: true
Duration: 60s (from 60 to 600)
Day interval: 1 (1 to 7)
SPRINKLER_2
Enable: true
Duration: 200s (from 60 to 600)
Day interval: 3 (1 to 7)
SPRINKLER_3
Enable: true
Duration: 150s (60 to 600)
Day interval: 5 (1 to 7)
IRRIGATION AUTOMATION:
For automation, I would like to have this control of the water level in the tank, especially the notification in case of problem (notification on companion app)
TANK LEVEL CHECK
- if sensor_tank_level: false > run automation
- if sensor_tank_level: true > do not run automation > notify companion app
Would anyone be kind enough to help me?
Thank you
This is my code:
sprinkler:
- id: controller_micro_irrigazione
main_switch: "Irrigatori"
auto_advance_switch: "Irrigatori Auto Advance"
reverse_switch: "Irrigatori Reverse"
valve_open_delay: 0s
valves:
- valve_switch: "Irrigatore 1"
enable_switch: "Enable Irrigatore 1"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel1
- valve_switch: "Irrigatore 2"
enable_switch: "Enable Irrigatore 2"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel2
- valve_switch: "Irrigatore 3"
enable_switch: "Enable Irrigatore 3"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel3
- valve_switch: "Irrigatore 4"
enable_switch: "Enable Irrigatore 4"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel4
- valve_switch: "Irrigatore 5"
enable_switch: "Enable Irrigatore 5"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel5
- valve_switch: "Irrigatore 6"
enable_switch: "Enable Irrigatore 6"
pump_switch_id: irrigation_pump
run_duration: 1s
valve_switch_id: irrigation_channel6
binary_sensor:
- platform: template
name: Livello Serbatoio Acqua
id: adc_to_digital
##LEVEL SENSOR
sensor:
- platform: adc
internal: false
pin: A0
id: adc_to_digital_value
update_interval: 120s
on_value:
then:
- if:
condition:
- binary_sensor.is_on: adc_to_digital
then:
- if:
condition:
- lambda: "return x<0.3;"
then:
- binary_sensor.template.publish:
id: adc_to_digital
state: false
else:
- if:
condition:
- lambda: "return x>0.6;"
then:
- binary_sensor.template.publish:
id: adc_to_digital
state: true
switch:
- platform: gpio
name: "Pompa Acqua"
icon: mdi:water-pump
id: irrigation_pump
pin: GPIO5
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 1"
icon: mdi:pipe-valve
id: irrigation_channel1
pin: GPIO16
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 2"
icon: mdi:pipe-valve
id: irrigation_channel2
pin: GPIO14
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 3"
icon: mdi:pipe-valve
id: irrigation_channel3
pin: GPIO12
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 4"
icon: mdi:pipe-valve
id: irrigation_channel4
pin: GPIO13
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 5"
icon: mdi:pipe-valve
id: irrigation_channel5
pin: GPIO15
inverted: false
restore_mode: ALWAYS_OFF
- platform: gpio
name: "Valvola 6"
icon: mdi:pipe-valve
id: irrigation_channel6
pin: GPIO0
inverted: false
restore_mode: ALWAYS_OFF
number:
- platform: template
id: irrigatore_1_timer
name: "Irrigatore 1 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(0);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 0
run_duration: !lambda 'return x;'
- platform: template
id: irrigatore_2_timer
name: "Irrigatore 2 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(1);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 1
run_duration: !lambda 'return x;'
- platform: template
id: irrigatore_3_timer
name: "Irrigatore 3 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(2);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 2
run_duration: !lambda 'return x;'
- platform: template
id: irrigatore_4_timer
name: "Irrigatore 4 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(3);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 3
run_duration: !lambda 'return x;'
- platform: template
id: irrigatore_5_timer
name: "Irrigatore 5 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(4);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 4
run_duration: !lambda 'return x;'
- platform: template
id: irrigatore_6_timer
name: "Irrigatore 6 Timer"
icon: mdi:timer-outline
min_value: 5
max_value: 120
step: 1
mode: box
unit_of_measurement: s
lambda: "return id(controller_micro_irrigazione).valve_run_duration(5);"
set_action:
- sprinkler.set_valve_run_duration:
id: controller_micro_irrigazione
valve_number: 5
run_duration: !lambda 'return x;'