ESPHome Irrigation

During a recent update, I discovered a new component for ESPHome; Irrigation. Given that I had recently started working on an irrigation system, I was pleased to see this addition.

I have a couple of ESP8266’s already running on HA. A salt level detector and a garage door switch. I’d like to add the irrigation system. Based on my understanding of the irrigation integration, I’ve pieced together some code. It’s meant for a four valve control. No pump, just four valves. Would you mind having a look through it and advising of any issues?

---
esphome:
  name: irrigation-south

esp8266:
  board: esp01_1m
  
# WiFi connection, replace these with values for your WiFi.
wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

# Enable logging
logger:

# Enable Home Assistant API
api:

# Enable over-the-air updates.
ota:
    password: !secret ota_password

# Enable Web server.
web_server:
  port: 80

# Sync time with Home Assistant.
time:
  - platform: homeassistant
    id: homeassistant_time

# Text sensors with general information.
text_sensor:
  # Expose ESPHome version as sensor.
  - platform: version
    name: irrigation_south ESPHome Version
  # Expose WiFi information as sensors.
  - platform: wifi_info
    ip_address:
      name: irrigation_south IP
    ssid:
      name: irrigation_south SSID
    bssid:
      name: irrigation_south BSSID

# Exposed switches.
# Switch to restart the irrigation_south.   
switch:
  - platform: restart
    name: "irrigation_south Restart"

# Enable On-Board Status LED.
status_led:
  pin:
    # Pin D4
    number: GPIO2
    inverted: true

sensor:
  # Uptime sensor.
  - platform: uptime
    name: irrigation_south Uptime

  # WiFi Signal sensor.
  - platform: wifi_signal
    name: irrigation_south WiFi Signal
    update_interval: 60s

sprinkler:
  - id: lawn_sprinkler_ctrlr
    main_switch: "Lawn Sprinklers"
    auto_advance_switch: "Lawn Sprinklers Auto Advance"
    reverse_switch: "Lawn Sprinklers Reverse"
    valve_open_delay: 5s
    valves:
      - valve_switch: "Front Lawn"
        enable_switch: "Enable Front Lawn"
        run_duration: 900s
        valve_switch_id: sprinkler_valve_sw0
      - valve_switch: "Front Garden"
        enable_switch: "Enable Front Garden"
        run_duration: 900s
        valve_switch_id: sprinkler_valve_sw1
      - valve_switch: "South Gaden"
        enable_switch: "Enable South Garden"
        run_duration: 900s
        valve_switch_id: sprinkler_valve_sw2
      - valve_switch: "Back Garden"
        enable_switch: "Enable Back Garden"
        run_duration: 900s
        valve_switch_id: sprinkler_valve_sw3

switch:
  - platform: gpio
    id: sprinkler_valve_sw0
    pin: 0
  - platform: gpio
    id: sprinkler_valve_sw1
    pin: 2
  - platform: gpio
    id: sprinkler_valve_sw2
    pin: 4
  - platform: gpio
    id: sprinkler_valve_sw3
    pin: 14

For starters an ESP01 does not have all those GPIO’s you plan to use. You need to change the board: listing.

Secondly, I suggest checking here to see which GPIO’s you can / can’t use.

Also, this will work for a starting point but you might want to add in a way to change the run times from HA. There is an example on the ESPhome Sprinkler component doc page of how to use the ‘multiplier’.

Didn’t realize that, thanks for pointing that out.

Thanks for the link.

For sure! I thought something was missing. Reading the documents over again, it seems there may be more than that to add.

Thanks

I currently have an ESP running my sprinklers (and bore pump) which uses ESPhome and has been great for years but since this new Component I’m now wanting to re-code it since it’s currently dependant on HA doing the automation. This component looks like a great addition to ESPhome.

I’m rather new to ESPHome. A little challenged when it comes to programming yaml but I’m slowly learning. I have three other ESP devices programmed and running successfully. I’m looking forward to working my way through this project.