Hi, I have a little problem. I want to write a program in which I can control the valve for a certain period of time depending on the soil moisture of the sensor. I wrote a program where for the moisture intervals:
75-70 = 1:30 min
70-65 = 2 min
65 - 60 = 2:30 min
and <60 = 3 min
After bringing the humidity, for example, from a value of 63% to about 30%, the solenoid valve should turn on for 3 min, and it turns on for 1:30 min each time. Please help. Code:
trigger:
- platform: state
entity_id:
- switch.esphome_web_74c344_elektrovalve
to: "on"
for:
hours: 0
minutes: 1
seconds: 30
id: auto_wyl_75_70
- platform: numeric_state
entity_id: sensor.esphome_web_74c344_soil_moisture
above: 70
below: 75
id: auto_wl_75_70
- platform: state
entity_id:
- switch.esphome_web_74c344_elektrovalve
to: "on"
for:
hours: 0
minutes: 2
seconds: 0
id: auto_wyl_70_65
- platform: numeric_state
entity_id: sensor.esphome_web_74c344_soil_moisture
above: 65
below: 70
id: auto_wl_70_65
- platform: state
entity_id:
- switch.esphome_web_74c344_elektrovalve
to: "on"
for:
hours: 0
minutes: 2
seconds: 30
id: auto_wyl_65_60
- platform: numeric_state
entity_id: sensor.esphome_web_74c344_soil_moisture
above: 60
below: 65
id: auto_wl_65_60
- platform: state
entity_id:
- switch.esphome_web_74c344_elektrovalve
to: "on"
for:
hours: 0
minutes: 3
seconds: 0
id: auto_wyl_60
- platform: numeric_state
entity_id: sensor.esphome_web_74c344_soil_moisture
below: 60
id: auto_wl_60
above: 1
condition:
- condition: sun
before: sunrise
after: sunset
enabled: false
action:
- choose:
- conditions:
- condition: trigger
id:
- auto_wl_75_70
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wyl_75_70
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wl_70_65
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wyl_70_65
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wl_65_60
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wyl_65_60
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wl_60
sequence:
- service: switch.turn_on
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
- conditions:
- condition: trigger
id:
- auto_wyl_60
sequence:
- service: switch.turn_off
data: {}
target:
entity_id: switch.esphome_web_74c344_elektrovalve
mode: single