[Developement Thread] - Irrigation App

This is the start of the journey... :slight_smile:

My intention is to develop an app which throws a enable/disable switch to allow/disallow an irrigation system to water today. (or not!)

This will be based upon a WU driver that I helped develop and can be found here:

https://github.com/CobraVmax/Hubitat/tree/master/Drivers/Weather

Andy

2 Likes

Ok.
The free WU account does not give historical data so we can’t just pull yesterday’s rainfall from the station data.

Using the WU driver I can get:
Today’s rainfall
Tomorrow’s expected rainfall
The day after tomorrow’s expected rainfall

I think probably the best way to do this is to put today’s rainfall into a state variable and keep it until tomorrow…
That way, after a couple of days I will have a little bit of historical data to use in the app.

The way I see this working is:
If no rain for the past two days and no rain expected for two days then water.

We will need configurable thresholds so we can decide what constitutes a ‘rainy day’ and we’ll use ‘weighting’ to decide whether to water or not.

I’m doing something similar with variables in a webCoRE piston. As long as today’s rain is accurate, we should be able to collect daily rainfall and create an accurate historical record.

My preference would be to have five data points: two days back, today and two days forward. With user-defined weighting, I’d experiment with it, but start with something like these weights, respectively:

0.6 1.0 1.0 0.7 0.4

If the total weighted inches of rain exceeded 0.3, then water. That tells me I need six fields: for the weightings and the rain threshold. It would also be useful to have a temperature threshold to cancel if too cool.

A little far off the main conversation BUT... I use EtherRain and a web tool called LawnCheck.

LawnCheck does all the decision making and calculations. Once a day the EtherRain device, fetches the day's irrigation values.

I tell LawnCheck with WU to use and it makes all the "is it going to rain" decisions.

EtherRain also pointed to OptiRain for a Linux/OSX environment.

QuickSmart Ethernet/Internet Sprinkler Irrigation Controller/Timer Scheduling for Windows, Linux, HomeSeer, Mac OS X

http://thomasloughlin.com/optirain-open-and-raspberry-pi-remote-controlled-sprinkler/

My point being.. others have trod this path and seeing their solutions might augment your solution.

1 Like

Do you mean water if rainfall is BELOW a configured level?

@CAL.hub

So…
Collected data;
The day before yesterday
Yesterday
Today
Tomorrow
The day after tomorrow

If the data collected here (added together) = a configured level - Don’t Water
If less than the configured level then DO Water

With an extra restriction in case it’s too cold.

Does that sound about right?
Is it that simple?

Hmmm…
What if it rained two days ago (a lot) then didn’t rain again…
would the lawn still need watering?

LawnCheck uses "PoP" (Possibility of Precipitation.) For each "rule" one decides how high or low it matters.

It also weighs actual rain and if too cool to water. I have an extra rule for when it exceeds 90 degrees.

1 Like

I’m currently pulling in ‘pop’ from the station so I could incorporate that

Does WU’s API return Soil Temp / Moisture if they are provided from the PWS?

I am adding these sensors to my Vantage Pro2 PWS and could send to WU … that would allow me to base irrigation off of the moisture of the group of sensors … if the soil meets a certain moisture threshold dont water even regardless of past rain …

Just playing around wiht an idea in my head - but I dont know if Blunderground supports this return from their API

Whats the difference btwn the two versions? Is there a reason behind the ‘lowercase’ version?

Just trying to figure out which to use and what the differentiation is

@JHoke
John
The original version was created/modified to use uppercase variables (purely for asthetics) and for use with my 'Weather Switch' app - This does not have the 'capabilities' as I don't use them

The lowercase version has the capabilities (that you can use in dashbords like 'SmartTiles' etc but also has double entries for some attributes)

The lowercase version is no longer being developed by me, but is being developed in this thread:

Andy

1 Like

I think it is.

As to rain two days ago, I think the weighting factor addresses that: if it's a lot of rain, then the algorithm would allow for it to be determinate; if it's just a little, it would factor in to the overall equation to some user-determined extent.

Looking at the LawnCheck app that @csteele posted, I see other ideas that would be useful but are of marginal utility. If you want to go all out, then great. If not, no big deal. Days of the week are important, possibly with a date range for each day (e.g. I water Thu+Sun during DST, but just Sun outside DST). Months with a percentage time (e.g. 50% in December and 120% in August) would be useful, but that makes it more complicated than a simple water/nowater binary switch.

Wow.... Who knew there was so much interest?

I like Set-and-Forget :slight_smile:

That LawnCheck site became that almost right away. I put my EtherRain on LawnCheck day 1 because of course I had to see it work! Later I downloaded both the OptiRain and jrIrigate code and got both running, thinking I'd want more control. But I never switched away, LawnCheck has been good enough. I like that I set the max minutes for each area and automation does the calculation of what % is right this day(month) 80% of 6 mins is ?? :slight_smile:

For that reason, I've never yet added irrigation to my home automation.. same with Thermostat. I've just never bumped into a situation where I say "Enough!! I've got to get better control over that."

Here's what LawnCheck's logs show for yesterday and today... just 8 values, for 8 valves.

05-01-2018 07:22:40 dn:EtherRain.8 cmd:(S)IRRIGATE-->>xi=49:0:0:16:0:0:0:20:2
04-30-2018 19:18:35 dn:EtherRain.8 cmd:(S)IRRIGATE-BLOCK (Not Hot) Y/T/F Hi:68/63/56<90
04-30-2018 07:21:47 dn:EtherRain.8 cmd:(S)IRRIGATE-->>xi=50:0:0:12:0:0:0:16:1
04-30-2018 04:21:19 dn:EtherRain.8 cmd:(S)IRRIGATE-->>xi=50:3:3:0:3:9:9:0:0
yesterday was April, an 80% month and thus 80% of the 20 min "allocation" was sent across as 16 mins. Today though, being May and 100%, it's gonna run that valve 20 mins. (I don't know what the first value corresponds to. 50 yesterday, 49 today.) It's not going to be anywhere close to the 90 degree "hot" value I've set so it skipped that "rule".

Again, not saying "do this" but just adding some flavor/spice to the conversation. :slight_smile:

Spice is always good!
I started this because of the work I did on the driver and thought it would be interesting.
Since then I have found a use for it (yes even in the UK :slight_smile:)
I’ll use the switch to remind me to water my shed roof (just planted it) as it needs a little extra care for a month or two.
Coincidentally, we haven’t had much rain for a couple of weeks here it seems, and I’ve actually had to water it.

Andy

I used to go to the UK on Holiday pretty often. Once I was there for 3 weeks and it rained only one day. Crazy talk on the radio… end of the world. :slight_smile:

Here, water (irrigation) does not fall from the sky, it comes outta pipes!! :smiley:

1 Like

@CAL.hub

OK.. Here we go.. :slight_smile:

I was thinking outside the box a little so created not an app but a DRIVER..
Hey! I thought I'd try something different and see if I could get the driver to do everything :slight_smile:

It has its own 'internal' switch so it becomes your go/nogo control switch

So install it as 'driver code' then create a new virtual device and assign this driver 'Irrigation Switch Driver'
Now on to configuration...
You obviously need to input your api key and zipcode/postcod or station ID

Some of the other settings are obvious and I've left a button in that will be taken out once you have tested it 'Create History'
This button moves today's rainfall to yesterday's and moves yesterday's to the day before's
This is just so you can play with it a bit by sending today's data into the other past days
Once you have tested it I will remove it to clean up the page and make sure of no errors or mistakes are created by pressing it when in use.

I have stripped the driver of all the stuff not required for this use.
I have also removed the 'reset poll count' button as the counter is now reset automatically when saved and at a specified time.

This is the counter auto reset. - You need to calculate the time difference (if there is any) between your home and New York City (where WU base all their calculations from) The counter is reset at midnight in NY
As you can see I am 5 hours forward so I have set this to 7:00 (although I made a mistake before taking the screenshot and it should be 05.00)

The above is obvious really ... the time to turn on the switch if we want to water today.
(It's also the time all the calculations are done)

Again.. obvious - time to turn the switch off

The next thing you need to do is assign an 'importance weighting' to each of the 5 days. (Weighting can be set at anything 1-5)
If you look at the numbers I set.. I thought if it rained today it was more important than yesterday or tomorrow.

These numbers are all multiplied by the actual readings (or expected readings) and compared to a figure you set...

Like above.

The final setting that you need is whether to actually action the switch or not

With this switched off the calculations will be done but nothing will happen.
This is here just so you can use it for a few days while working out your weighting and having a play.

I also intend to add a day restriction so it can only switch on certain days..
Not done that yet but I thiought I'd see what you think about it so far..

Here is the driver:

https://github.com/CobraVmax/Hubitat/tree/master/Drivers/Weather

Andy

2018-05-03 08:51:34.965:info state.NumOfPolls = 1
dev:6172018-05-03 08:51:34.960:debugupdated called - [pollInterval:5 Minutes, tdWeight:5, enableAction:true, tmWeight:1, dbyWeight:1, goNogo:6, tempFormat:Fahrenheit, apiKey:caec8f495ec8f64c, logSet:true, datWeight:1, rainFormat:Inches, pollLocation:92562, yWeight:1, autoPoll:true]
dev:6172018-05-03 08:51:12.951:errorAmbiguous method overloading for method com.hubitat.hub.executor.DeviceExecutor#schedule. Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between: [class java.lang.String, class java.lang.String] [class java.util.Date, class java.lang.String] on line 96
dev:6172018-05-03 08:51:12.908:errorsomething went wrong: groovyx.net.http.HttpResponseException: Not Found
dev:6172018-05-03 08:51:10.562:debugWU: ForcePoll called
dev:6172018-05-03 08:51:10.557:info state.NumOfPolls = 1
dev:6172018-05-03 08:51:10.540:debugupdated called - [pollInterval:5 Minutes, tdWeight:5, enableAction:true, tmWeight:1, dbyWeight:1, goNogo:6, tempFormat:Fahrenheit, apiKey:caec8f495ec8f64c, logSet:false, datWeight:1, rainFormat:Inches, pollLocation:92562, yWeight:1]
dev:6172018-05-03 08:43:27.636:debug****************** Irrigation Driver Version 1.0 - OFF *********************

Initial install of the driver and then clicky around for values similar to your screenshots. Got that error, twice.
"Ambiguous method overloading for method com.hubitat.hub.executor.DeviceExecutor#schedule. Cannot resolve which method to invoke for [null, class java.lang.String] due to overlapping prototypes between: [class java.lang.String, class java.lang.String] [class java.util.Date, class java.lang.String] on line 96"

@csteele

I’m not sure, but it looks like you don’t have ‘Day cutoff’ set
I forgot to make all the settings compulsory (I’ll fix that soon)

Can you check all your settings please?

Andy

Interesting.

I set it plus "Time to turn ON" and "Time to turn OFF" the first time through.. now, all 3 are "blank".

I've attempted to set them but now I notice there's "extra" -- in each that do not show on your screen caps.