My Garden Irrigation

EDIT: Sorry, this request wasn’t aimed at me but I’ll leave it here in case it is useful!


By all means…

#==================
#=== Substitutions
#==================
substitutions:
  device_name: esphome_irrigation_controller
  friendly_name: ESPHome Irrigation Controller
#==================

# Board
esphome:
  name: ${device_name}
  platform: ESP32
  board: mhetesp32devkit

# WiFi
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password
  fast_connect: True

  ap:
    ssid: IrrigationHotspot
    password: some.random.password!

# Fallback portal 
captive_portal:

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable Over-The-Air updates
ota:

# # Enable Web server.
# web_server:
#   port: 80

    
#=== Sensors
sensor:
  #=== Uptime
  - platform: uptime
    name: ${friendly_name} Uptime

  #=== WiFi Signal
  - platform: wifi_signal
    name: ${friendly_name} WiFi Signal
    update_interval: 60s

  #=== Failsafe time
  - platform: homeassistant
    id: failsafe_time
    name: ${friendly_name} Failsafe Time
    entity_id: input_number.irrigation_failsafe_time_in_seconds


#=== Switches
switch:
  #=== Zone Relay 1
  - platform: gpio
    pin: 
      number: 21
      inverted: True
    name: Garden Irrigation Relay Zone1
    id: relay1
    restore_mode : ALWAYS_OFF
    interlock: &interlock_group [relay1, relay2, relay3, relay4, relay5, relay6, relay7, relay8]
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 2
  - platform: gpio
    name: Garden Irrigation Relay Zone2
    id: relay2
    pin: 
      number: 22
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
      
  #=== Zone Relay 3
  - platform: gpio
    name: Garden Irrigation Relay Zone3
    id: relay3
    pin: 
      number: 23
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe
      
  #=== Zone Relay 4
  - platform: gpio
    name: Garden Irrigation Relay Zone4
    id: relay4
    pin: 
      number: 14
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 5
  - platform: gpio
    name: Garden Irrigation Relay Zone5
    id: relay5
    pin: 
      number: 25
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 6
  - platform: gpio
    name: Garden Irrigation Relay Zone6
    id: relay6
    pin: 
      number: 26
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 7
  - platform: gpio
    name: Garden Irrigation Relay Zone7
    id: relay7
    pin: 
      number: 27
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Zone Relay 8
  - platform: gpio
    name: Garden Irrigation Relay Zone8
    id: relay8
    pin: 
      number: 18
      inverted: True
    restore_mode : ALWAYS_OFF
    interlock: *interlock_group
    on_turn_on:
      - script.execute: failsafe
    on_turn_off:
      - script.stop: failsafe

  #=== Reboot
  - platform: restart
    name: ${friendly_name} Reboot
    id: reboot


#=== Scripts
script:

  #=== Set failsafe time converted to milliseconds
  - id: failsafe
    then:
      - delay: !lambda |-
          return id(failsafe_time).state * 1000;
      - switch.turn_off: relay1
      - switch.turn_off: relay2
      - switch.turn_off: relay3
      - switch.turn_off: relay4
      - switch.turn_off: relay5
      - switch.turn_off: relay6
      - switch.turn_off: relay7
      - switch.turn_off: relay8

Thanks! I am planning on using your github irrigation project once I get the hardware working.
This will save me a lot of time. What IO expander are you using? I have the 8574 io expander but it is not being detected. I have tried addresses 0x21 and 0x20 with no luck.

Hi there…

i have 8 Zones and 1 Main Relay. How can i add this Main relay to open before zone 1 starts and close after the last zone?

Thanks in advance

Edit: Solved:
garden_irrigation_triggered_cycle_start.yaml:
#=== Run all the zones in turn
- service: switch.turn_on
target:
entity_id: switch.yourswitch


#=== CYCLE END PROCESSING
- service: switch.turn_off
target:
entity_id: switch.yourswitch

1 Like

Also:
Is it possible to add a language page where all the Labels can be defined? To change them to german :wink:

1 Like

Why is here always 0 Minutes?

I did start on this a while ago but the method I used failed due to a bug feature in HA.
( Reload of input_text should also reset to initial - Feature Requests - Home Assistant Community (home-assistant.io))

I couldn’t think of an alternative and simple way to implement this natively in HA.
But if anyone has any ideas…

A guy here in german Forum has it working… Funny…

Also a Problem: I can’t see the Value on the slider… Is there a way to correct this?

1 Like

Next issue?

Only the first cycle is added to End Time…?

When i try to cancel a cycle:

Keeps watering…

Haven’t looked at the issue, but might be best to log the problems on the GitHub repo, that way they’re trackable and able to be tied together…

Nevermind…

i don’t know why it’s so buggy for me. Installed the latest Github version again but same problems…

I removed everything now and i need to check other solutions. Thank you anyway…

Hi, i followed this instruction step by step (translated it via google translate to english) https://www.domoticadiy.it/2020/06/irrigazione-smart-my-garden-irrigation-home-assistant/#comment-57 and its working for me - have you tried this one?

Hi @klogg, thanks a lot for sharing your wonderful project - i started using your irrigation system v1 two years ago and it never failed me. Due to the latest HA-updates i thought “lets give this v2 a try” and after some tinkering, its working for me - so thanks again!!
I followed the instruction at https://www.domoticadiy.it/2020/06/irrigazione-smart-my-garden-irrigation-home-assistant/#comment-57 (thanks to google translate).

One last topic ist active - i’m using an additional ESPhome switch to control my water pump - where would be the best spot to implement this in your cycles, especially the manual cycle?

It’s a long time since I looked at this code in detail (which I guess is a good thing as it means it just works - for most people :wink: ) but I am pretty sure you could implement this with a small addition to the automation irrigation_run_a_cycle in the file garden_irrigation_run_a_cycle.yaml. Look for the comments #=== Start watering and #=== Stop watering.

Or you could follow the suggestion by ‘genestealer’ in Issue #44 on Github and

simply add a separate automation, triggered by the state-change of the downstream valves.

That would have the advantage of being outside the package and not affected by any changes that might be made to the package.

I hope that helps.

I tried to configure it using the italian instruction but obviously something is not loading as expected and i have no clue whats wrong.

Any ideas?

Great, clean and simple, I could have thought of it myself. :wink:

garden_irrigation_triggered_cycle_start.yaml:
#=== Run all the zones in turn

  • service: switch.turn_on
    target:
    entity_id: switch.yourswitch


    #=== CYCLE END PROCESSING
  • service: switch.turn_off
    target:
    entity_id: switch.yourswitch

Hi…
is there a way to flush all settings that were made?

I deleted all files and downloaded everything new but Names that i gave are stored somewhere else…

Any ideas?