Rainbird or irrigation control


(Michael Sammon) #1

i know the thermostat will soon be added to the dashboard but will ST be adding any other home products? becuase…after watching the bloomberg interview yesterday by alex, it is absolutely right how the IoT will effect other industries. for example! i moved into a house that has rainbird, irrigation control, now you can buy a basic(not programmable) rainbird or for a premium get a programmable. i looked into buying a smart irrigation system before but it was way to pricey. well along comes smartthings. i bought a ge jasco receptacle that i will now control my irrigation system due to weather :slight_smile:
think of the money a farmer could save by adding something as simple as controlling themselves through the IoT


(esung) #2

Hope ST would support some of those smart irrigation systems someday.


(Minollo) #3

Most of those seem to support HTTP based APIs, which should make it possible to create a device for ST. I’m planning to try doing that with BlueSpray or IrrigationCaddy soon - probably BlueSpray, as its wifi version is cheaper.


(Minollo) #4

I contacted the BlueSpray folks, and they told me that you need to sign and NDA and such before being granted access to their API… I find that way too complicated for something which should be in their own interested to make available to the public.

To avoid further disappointments, I decided to work on a home grown solution: 3 zwave dry contact switches and one 120-24V transformer. With a fairly simple ST app I should be up & running for about $100 and without dealing with hidden APIs or NDAs…


(Ehanson23) #5

I was contemplating this very topic and I believe that an existing irrigation controller, that has rain sensor add-on capabilities, could be ‘upgraded’ to a smart controller.

I am going to wire an Evolve LFM-20 to the rain sensor terminals, on my Rainbird irrigation controller, to be able to turn it on and off by making it think that the rain sensor is dry or wet using the LFM-20 switch. I believe someone else has mentioned this, in these forums, but I have not heard whether it was tested or not.

Once that is done and works, a weather tile could be used to see if it has rained or is raining. If it has (or is), set the LFM-20 to the ‘wet’ setting. This could also be used for rain forecasts. If there is a >50% (or whatever number) chance of rain in the next 24 hours, set the LFM-20 to the ‘wet’ setting.

What gets really exciting, to me, is thinking about using the Plantlink sensors when they are integrated with ST. In that scenario, I would set the weather tile to only use the forecasted rain feature and would set the irrigation controller’s schedule to run every day (or on every possible day when watering restrictions are enforced). Then, I would include another virtual switch that looked at the Plantlink sensor’s status, too, to set the LFM-20 to ‘wet’ or ‘dry’.

To summarize: Attach a LFM-20, to the rain sensor terminals, on an existing irrigation controller and use a weather app to setup a ‘virtual rain sensor’ using past, present, and forecasted rain events. Then, when the Plantlink sensors are ST enabled, put one in the lawn and use its output to turn the ‘virtual rain sensor’ on and off per the soil moisture measurement. If the soil moisture is below a certain level, let the irrigation controller run. If there is enough soil moisture, don’t let the irrigation controller run that day. To get really fancy and be ultra conservative, the weather tile forecasted rain could be used in conjunction with the plantlink sensor (e.g. soil moisture is dry but rain forecast is greater than 50%, do not let the irrigation controller run (set to ‘wet’ position)).


(Darryl) #6

I was thinking about pursuing integration to my Irrigation Controller (etherRain 7P). Its an easy to use/manage irrigation controller, good price, and even has a pump start relay which is a big deal for me. It has an open API, and I have already received the documentation from Jim (owner/Developer). Do we have a basic interface someone has built out yet? I’d love an existing sample, that I could just go in and build out from by tweaking the integration in.

Thanks! :slight_smile:


(Longhorn84) #7

My buddy bought the RainMachine and loves it. Not sure if I want to spend $260 to see how well it works though.


(Darryl) #8

I’ve successfully started integration on my EtherRain 7P. Works very well so far. Right now its being developed as a manual-control zone test. So while I am in the yard, I can tap the button and the zone turns on immediately. I don’t see myself fully building out functionality though, as I have it scheduled through their website. Though who knows what the future holds.


(Minollo) #9

As mentioned above, I ended up getting three dry contact switches for about $100, and I created a little app (see below) to control them, also based on measured and forecasted rain. Much cheaper, and I have all components under control.
It’s working well, even if I’m sure I’ll tweak the very simple watering heuristic as I get more experience

/**
 *  Sprinklers
 *
 *  Copyright 2014 Carlo Innocenti
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 *  in compliance with the License. You may obtain a copy of the License at:
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed
 *  on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License
 *  for the specific language governing permissions and limitations under the License.
 *
 */
definition(
    name: "Sprinklers",
    namespace: "",
    author: "Carlo Innocenti",
    description: "Sprinklers",
    category: "My Apps",
    iconUrl: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience.png",
    iconX2Url: "https://s3.amazonaws.com/smartapp-icons/Convenience/Cat-Convenience@2x.png"
)

preferences {
	section("Sprinklers") {
		input "sprinkler1", "capability.switch", title: "Sprinkler 1", multiple: false, required: true
        input "time1", "number", title: "Time sprinkler 1", required: true
		input "sprinkler2", "capability.switch", title: "Sprinkler 2", multiple: false, required: true
        input "time2", "number", title: "Time sprinkler 2", required: true
		input "sprinkler3", "capability.switch", title: "Sprinkler 3", multiple: false, required: false
        input "time3", "number", title: "Time sprinkler 3", required: false
		input "sprinkler4", "capability.switch", title: "Sprinkler 4", multiple: false, required: false
        input "time4", "number", title: "Time sprinkler 4", required: false
	}
    
    section("Starting Times") {
    	input "startTime1", "time", title: "Start time morning", required: true
        input "enabledStartTime1", "bool", title: "Morning enabled?", required: true
    	input "startTime2", "time", title: "Start time afternoon", required: false
        input "enabledStartTime2", "bool", title: "Afternoon enabled?", required: false
    	input "startTime3", "time", title: "Start time evening", required: false
        input "enabledStartTime3", "bool", title: "Evening enabled?", required: false
    }
}

def installed() {
	log.debug "Installed with settings: ${settings}"

    state.running = false
	initialize()
}

def updated() {
	log.debug "Updated with settings: ${settings}"

	unsubscribe()
    state.running = false
    sprinkler1?.off()
    sprinkler2?.off()
    sprinkler3?.off()
    sprinkler4?.off()
	initialize()
}

def initialize() {
	unschedule()
	schedule("0 0/5 * * * ?", timeMonitor)    
	subscribe(sprinkler1, "switch.off", startSprinkler2)
	subscribe(sprinkler2, "switch.off", startSprinkler3)
	subscribe(sprinkler3, "switch.off", startSprinkler4)
	subscribe(app, appTouch)
}

def timeMonitor() {
	if (state.running == false) {
    	def startTime
        def startDate
        def nowTime = now()
        if (enabledStartTime1) {
        	startDate = timeToday(startTime1, location.timeZone)
        	startTime = startDate.getTime()
            if (nowTime > startTime && nowTime - startTime < 10 * 60 * 1000) {	// < 10 minutes past required start time
            	log.info "Activating sprinklers, start time 1: ${startDate}"
            	startSprinkler1(false)
            } else if (startTime2 && enabledStartTime2) {
	        	startDate = timeToday(startTime2, location.timeZone)
                startTime = startDate.getTime()
	            if (nowTime > startTime && nowTime - startTime < 10 * 60 * 1000) {	// < 10 minutes past required start time
	            	log.info "Activating sprinklers, start time 2: ${startDate}"
                    startSprinkler1(false)
	            } else if (startTime3 && enabledStartTime3) {
		        	startDate = timeToday(startTime3, location.timeZone)
                	startTime = startDate.getTime()
		            if (nowTime > startTime && nowTime - startTime < 10 * 60 * 1000) {	// < 10 minutes past required start time
		            	log.info "Activating sprinklers, start time 3: ${startDate}"
                    	startSprinkler1(false)
                    }
                }
            }
        }
	}
}

def startSprinkler1(bForce) {
	if (bForce || shouldWater()) {
        log.info "Turning on Sprinker 1 for ${time1} minutes"
        state.running = true
        sprinkler1.on()
        def nowTime = now()
        def theDate = new Date(nowTime + (time1 * 60 * 1000))
        runOnce(theDate, stopSprinkler1)
    } else {
    	log.info "Sprinkler activation requested and declined"
    }
}

def stopSprinkler1() {
	log.info "Stopping Sprinkler 1"
	sprinkler1.off()
}

def startSprinkler2(evt) {
	if (state.running == true) {
        log.info "Turning on Sprinker 2 for ${time2} minutes"
        sprinkler2.on()
        def nowTime = now()
        def theDate = new Date(nowTime + (time2 * 60 * 1000))
        runOnce(theDate, stopSprinkler2)
    }
}

def stopSprinkler2() {
	log.info "Stopping Sprinkler 2"
	sprinkler2.off()
}

def startSprinkler3(evt) {
	if (state.running == true && sprinkler3) {
		log.info "Turning on Sprinker 3 for ${time3} minutes"
        sprinkler3.on()
        def nowTime = now()
        def theDate = new Date(nowTime + (time3 * 60 * 1000))
        runOnce(theDate, stopSprinkler3)
    } else {
    	state.running = false
    }
}

def stopSprinkler3() {
	log.info "Stopping Sprinkler 3"
	if (sprinkler3) {
		sprinkler3.off()
    } else {
    	state.running = false
    }
}

def startSprinkler4(evt) {
	if (state.running == true && sprinkler4) {
		log.info "Turning on Sprinker 4 for ${time4} minutes"
        sprinkler4.on()
        def nowTime = now()
        def theDate = new Date(nowTime + (time4 * 60 * 1000))
        runOnce(theDate, stopSprinkler4)
    } else {
    	state.running = false
    }
}

def stopSprinkler4() {
	log.info "Stopping Sprinkler 4"
	if (sprinkler4) {
		sprinkler4.off()
    }
    state.running = false
}

def shouldWater() {
	def rainYesterday = getWeatherFeature("yesterday").history.dailysummary.precipm[0].toDouble()
    def rainToday = getWeatherFeature("history").history.dailysummary.precipm[0].toDouble()
    def forecastData = getWeatherFeature("forecast").forecast.simpleforecast.forecastday
    def rainForecastToday = forecastData.qpf_day.mm[0] != null ? forecastData.qpf_day.mm[0] + forecastData.qpf_night.mm[0]: 0
    def rainForecastTomorrow = forecastData.qpf_day.mm[1] != null ? forecastData.qpf_day.mm[1] + forecastData.qpf_night.mm[1] : 0
	log.info "Rain condition: yesterday ${rainYesterday}, today ${rainToday}, today next ${rainForecastToday}, tomorrow ${rainForecastTomorrow}"
    def enoughWater = rainYesterday + rainToday > 10 || rainToday + rainForecastToday > 5 || rainToday + rainForecastToday + rainForecastTomorrow > 10
    log.info "Need to water: ${!enoughWater}"
	sendNotificationEvent("Rain condition: yesterday ${rainYesterday}, today ${rainToday}, today next ${rainForecastToday}, tomorrow ${rainForecastTomorrow}, enough water: ${enoughWater}")
    return !enoughWater
}

def appTouch(evt)
{
	log.debug "appTouch: $evt, $settings"
    if (state.running) {
    	if (sprinkler1.currentSwitch == "on") {
        	log.info "Manual shut down of sprinkler 1"
            unschedule(stopSprinkler1)
        	stopSprinkler1()
        } else if (sprinkler2.currentSwitch == "on") {
        	log.info "Manual shut down of sprinkler 2"
            unschedule(stopSprinkler2)
	    	stopSprinkler2()
        } else if (sprinkler3 && sprinkler3.currentSwitch == "on") {
        	log.info "Manual shut down of sprinkler 3"
            unschedule(stopSprinkler3)
	    	stopSprinkler3()
        } else if (sprinkler4 && sprinkler4.currentSwitch == "on") {
        	log.info "Manual shut down of sprinkler 4"
            unschedule(stopSprinkler4)
        	stopSprinkler4()
        } else {
        	log.error "State is flagged as running, but no switches are reported on; timing issue?"
        }
    } else {
    	startSprinkler1(true)
    }
}

(Calogero Cristiano) #10

Hey you think you can post the code for what you did. I have the same setup and would like to use just or runs test on sprinklers or just to run a certain zone for x amount of minutes. Thanks


(Calogero Cristiano) #11

Post was meant for Darryl. thanks again


(Darryl) #12

Hi @@ccristiano18 - Do you have an etherRain? If so, is it a 7P or an 8?

I’m still in an ‘early stage’ (sloppy mess of code), as it simply cycles a few zones (quickly). Its definitely responsive, and now that I have an understanding of how the coding works for SmartThings, should be able to crank out a pretty nice little device type.


(Calogero Cristiano) #13

I have the etherrain the 8. Right now I use the sprinkler ace app now but it has a horrible interface. Would love something in smartthings.


(Darryl) #14

More than happy to share what I build once its a bit more progressed. I can even put a variable to make the 8th zone available. 3 day weekend, so I am sure I will be making huge progress quickly.


(Calogero Cristiano) #15

That’s awesome. Thanks @darrylb


(Calogero Cristiano) #16

Any luck with progress, thanks!


(Darryl) #17

Sadly, I have not had a lot of time to focus on this, but if you send me a message, id be more than happy to send you the code, maybe you want to get your hands on it for a bit. There is a lot of options that I still want to incorporate, and a few bugs. I also then need to go through the code and re-write it to be ‘prettier’.

Just let me know.


(Sam) #18

I realize this is an old post and perhaps I should be starting a new thread but let’s see what happens.

I have two 6-zone controllers (currently using only 3 zones on each) which have been in place for a while. The common wire for each is sent through a moisture sensor which kind of worked but I soon bypassed it because it was too much trouble to adjust. I’d now like to add a ST device that can take the place of the moisture sensor but be more ‘intelligent’.

I see this as a 2-phase project:

  1. Use a device like Go Control FS20Z-1 ($33) or Evolve LFM-20 ($69) to open or close the common circuit from the irrigation controllers to the valves. This would at least let me stop the irrigation from running if I’m away and see that it has rained enough.
  2. Add a routine that will connect to my Weather Underground station and depending on the logic provided either open or close the circuit.

At this point I have no interest in trying to automate the setting of an irrigation schedule.

Here are links to the items mentioned above. Does this sound like a reasonable plan?

Go Control FS20Z-1

Evolve LFM-20


(Michael Sammon) #19

the evolves have been known to fail after a year. i recommend Spruce


(Sam) #20

Thanks for replying. Are you talking about a Spruce controller? If so then I really don’t want to replace the controller, just make use of the equipment I have and accomplish what I need with FS20Z (since you don’t recommend the Evolve).