I have a very basic Orbit 4-station sprinkler controller and have been wanting to smarten it up. I bought a cheap WH51 moisture sensor, already have an Acurite 5n1 weather station that’s feeding MQTT, and have a Wunderground weather forecast feed. I even bought a Sonoff mini R2 intending to use it to mimic the supported hard-wired rain sensor (that I don’t have). At that point I was temporarily stuck considering how to power the Sonoff with the 24VAC rain sensor circuit.
Ultimately I realized that the controller has a battery to maintain programs and time when it loses power. So I just plugged it into an existing HS100 smart plug, whipped up some automation, and voila - smart sprinkler controller, and no need to wire anything additional for the sprinkler controller. Just turn check the sensor for damp soil, current rain in the last (TBD) days, and rain in the forecast, and turn off the sprinklers shortly before they normally run in the morning if any of those are true. Turn back on a couple of hours later. Simple!
alias: "block sprinklers "
description: if rain predicted or rained in last 24
trigger:
- platform: time_pattern
hours: "6"
minutes: "45"
condition:
- condition: or
conditions:
- condition: numeric_state
entity_id: sensor.rain_4
above: 75
- condition: numeric_state
entity_id: sensor.friendly_rain
above: "0"
- condition: numeric_state
entity_id: sensor.soil_moisture
above: 75
action:
- service: mqtt.publish
data:
qos: 0
retain: true
topic: rain_sensor
payload: "1"
- service: notify.notify
data:
message: Blocking sprinklers due to rain
- service: switch.turn_off
data: {}
target:
entity_id: switch.sprinklers
- delay:
hours: 2
minutes: 0
seconds: 0
milliseconds: 0
- service: mqtt.publish
data:
qos: 0
retain: true
topic: rain_sensor
payload: "0"
- service: switch.turn_on
data: {}
target:
entity_id: switch.sprinklers
mode: single