[Developement Thread] - Irrigation App

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.

That should go when you save it (also the ‘Click to set”)

I think also that after the initial save at the bottom when 1st assigning the driver, you need to click the upper ‘save’ button as I’ve noticed that the lowes ‘save’ doesn’t always save the settings.

Andy

I updated those fields using my iPad and the display on that browser is much better!

Basically the Time entry doesn't work right using Firefox on my Mac.

And the error was eliminated... however, maybe you can detect null (empty fields) and use a default?

I've been using "Elvis'" a lot for this:
offset = offset ?: 0
where 0 is the default for that. It doesn't fix the error of not entering a value, if just makes the error easier for someone to read.

Installed easily and the settings, save for "Day Cutoff", were very intuitive. I like the idea of everything being in a driver - works especially well for me since my system is still on ST so I can simply use Other Hub to send the switch to ST.

Thanks for all your hard work and ingenuity. I'll send any idea your way.

I do need to understand how the "days" work. I run mine at 4:00am. Is Today's Rain what is forecast or just what has actually fallen from midnight to 4am? Similarly, at 4am, is yesterday the 24 hours period that ended at the just-passed midnight?

I'm wondering if I'm better off throwing the switch at 11:59pm, thereby collecting the daily data at the end of the day, but then delaying action on the switch until 4am. This presupposes that total rainfall for the day is provided by WU and can be reported at 11:59pm.

You’re welcome!
It was/is an interesting exercise :slight_smile:

ok... it seems to me that WU uses midnight to start a new day
So, if you start the switch at 4am then today’s data would only be from midnight to 4 am
Yesterday would be the period upto midnight.

My intended use is to use the switch to remind me to water (if not enough) via ‘mp3 event player’ at around 6pm so for me, most of the day is gone. I think it would work for me ‘as is’.

However; I think your idea of switching at 11:59 pm would probably work better for you.

I’ll have to think about this for a while and see if I can come up with something that fits both scenarios.

In the meantime, if I get time tomorrow, I’ll look at adding day restrictions.

Andy

@CAL.hub
Ok... have a look at this screenshot:

I have created a new 'Check Criteria Time' setting.
For your use case... If you set this to 23:59 but still leave the time to turn on as 4am then it will do the following:

  1. Check go/nogo at 23:59 and retain the data
  2. Using the previously stored data (go/nogo) it will trigger the switch 'on' if criterias matched.

At least that's the theory :slight_smile:

I've also added a new temporary button.. "Calculate Now" which is just for testing
I'll remove it when we are done testing

Try it and let me know how you get on

New version: 1.1.0 uploaded to GitHub

Andy

Thanks, Andy. You're really going above and beyond! I'm away for a few days doi won't be able to try it until Tue, but it looks like you've hit all the hit buttons. Even thought I'm not home, some torrential downpours are on the way, so I'll be able to evaluate the rainfall, past and present.

1 Like