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?

  name: irrigation-south

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

# Enable logging

# Enable Home Assistant API

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

# Enable Web server.
  port: 80

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

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

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

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

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

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

  - id: lawn_sprinkler_ctrlr
    main_switch: "Lawn Sprinklers"
    auto_advance_switch: "Lawn Sprinklers Auto Advance"
    reverse_switch: "Lawn Sprinklers Reverse"
    valve_open_delay: 5s
      - 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

  - 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.


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.