nsheldon wrote:If you're looking for weather forecast information, you might try using my NOAA Weather Plus plugin instead.
Prior to creating that plugin, though, I did modify that Google Weather script to use curl instead of AppleScript's URL Access. If the plugin doesn't provide the information you want, let me know. I might be able to modify the plugin to provide what you're looking for. Or I can give you the AppleScript code I used to modify the Google Wether script if you'd prefer (or if you're using Indigo 4 still, in which case the plugin obviously won't work).
nsheldon wrote:Hi Eric.
I'm glad you like the plugin.
There are actually quite a number of ways to handle sprinkler schedules based on current and forecast weather. What are your goals in customizing your sprinkler schedules? I can tell you what I've done with my setup which may give you an idea of some of the things you want to do. Others here on the forum, I'm sure, have some great solutions too.
In my case, to comply with my city's watering ordinances, I have 4 different watering schedules (2 groups of 2 schedules) created in Indigo, plus 2 other annually executed schedules that switch between spring/summer and winter watering schedules on the city's required dates. The first group of schedules are for spring/summer watering and the other group is for winter watering. In each group, one schedule begins around 11:30 at night (randomized by +/- 30 minutes) on my block's scheduled watering days and executes a short cycle through watering zones. Then at around 3:15 AM of the next morning (again, +/- 30 minutes), the second schedule executes another short cycle through the watering zones. Why randomize the start time? The city recommends doing this to reduce load on their water pumping systems caused by large groups of homeowners watering at the same time. Why 2 schedules per night? To allow the water to soak into the soil, reducing runoff and wasted water.
Additionally, all the scheduled watering times for each zone are multiplied by the value stored in an Indigo variable before the schedule begins. This is a built-in feature of Indigo Pro that can be enabled within any Control Sprinkler action type. This allows a single watering schedule to have variable zone watering times based on varying weather conditions. In my case, I use a Trigger that executes whenever the current temperature changes in my NOAA Weather Plus device. It stores the value of the current temperature in a separate Indigo variable. Later in the evening, an Indigo Scheduled event takes the highest temperature recorded for that day and calculates a coefficient to be applied to the sprinkler schedule's watering times. So, for example, if the highest temperature for the day were 75 degrees, the calculated coefficient to multiply all watering times by would be 1. If the highest temperature were 100 degrees, the coefficient would be 1.33. If the high temperature were 50, the coefficient would be 0.67. When that coefficient is multiplied by the watering times, you get longer watering times on hot days and shorter watering times on cold days.
In addition to all that, I also have a separate Trigger that sets an Indigo variable to disable sprinkler schedules for that day if the current condition in my NOAA Weather Plus device ever changes to show any kind of precipitation. Other than making slight tweaks to the base watering times in my schedules recently, I haven't had to mess with the automated watering system since I put it in place over a year and a half ago.
Sorry for the long reply. I hope that was of some help.
Ericbo wrote:Thanks a lot Nsheldon, that is really great !! (and quick)
Well it seems I have the same goal as you ie optimize the watering while minimizing the water consumption.
Would it be possible for you to share your schedules and variables ? I would honestly copy/paste and adjust to my Californian environment ...
Thanks a lot !! ... Eric
-- Test the old sprinklerDurationMultiplier value compared to the new calculated one. If the newly calculated one is higher, continue. This ensures that the coefficient used to calculate sprinkler duration for each zone takes into account the highest temperature in the day.
set theTemperature to (value of variable "Weather_Temperature_F") as number
-- This rounds to the nearest hundredths place.
set theCoefficient to round ((theTemperature / 75) * 100)
set theCoefficient to theCoefficient / 100
if theCoefficient > ((value of variable "sprinklerDurationMultiplier") as number) then
return true
else
return false
end if
-- This sets the value of the "sprinklerDurationMultiplier" Indigo variable to a real number somewhere between 0.50 and 1.50, depending on the temperature as reported by the National Weather Service at the Fresno Yosemite International airport at the time this trigger is executed. The higher the temperature, the larger the coefficient, which thus increases the sprinkler run time per zone. The coefficient is calculated assuming temperature is measured in Fahrenheit, with 75 degrees as the baseline temperature (coefficient = 1 if temperature is 75).
set theTemperature to (value of variable "Weather_Temperature_F") as number
-- This rounds to the nearest hundredths place.
set theCoefficient to round ((theTemperature / 75) * 100)
set theCoefficient to theCoefficient / 100
set value of variable "sprinklerDurationMultiplier" to (theCoefficient as text)
if value of variable "Weather_Condition" contains "Rain" or value of variable "Weather_Condition" contains "Showers" or value of variable "Weather_Condition" contains "Thunderstorms" then
return true
else
return false
end if
if value of variable "Weather_Condition" contains "Rain" or value of variable "Weather_Condition" contains "Showers" or value of variable "Weather_Condition" contains "Thunderstorm" then
return false
else
return true
end if
nsheldon wrote:Ericbo wrote:Thanks a lot Nsheldon, that is really great !! (and quick)
Well it seems I have the same goal as you ie optimize the watering while minimizing the water consumption.
Would it be possible for you to share your schedules and variables ? I would honestly copy/paste and adjust to my Californian environment ...
Thanks a lot !! ... Eric
Hi Eric.
There are a lot of different settings in a number of different windows, but I'll try to get all the information posted in here for you to use.
So, first... the variables. I have 4 variables that are relevant to irrigation control
- Wather_Condition: Contains a copy of the value in the "currentCondition" state of the NOAA Weather Plus device.
- Weather_Temperature_F: Contains a copy of the value in the "temperatureF" state of the NOAA Weather Plus device.
- sprinklerDurationMultiplier: Contains a number (usually between 0.5 and 1.5) used to increase or decrease the default running time for each sprinkler zone each watering day.
- isPrecipitationToday: Contains "true" if there was precipitation during the current day or "false" if not.
Next... the triggers. I have one for each of the above variables. You might wonder why I copy the value of the NOAA Weather Plus device states into variables. The main reason is that you can't use AppleScript to access plugin device states, so I have triggers that copy the content of the device states into Indigo variables so I can use AppleScript to manipulate those values. Note that if you don't have the included "Action Collection" plugin enabled, you'll need to enable it from the Plugins menu in Indigo before creating the below triggers.
- Weather Condition Change Update trigger
- Trigger: Type: Device State Changed. Device: (Your NOAA Weather Plus device name), "Current Condition" state, "Has Any Change"
- Condition: Always
- Actions: Type: Plugin, Plugin: Action Collection, Action: Insert Device State into Veriable, Device: (Your NOAA Weather Plus device name), Edit Action Settings...: Insert state: currentCondition, Into variable: Weather_Condition
- Weather Temperature Change Update trigger
- Trigger: Type: Device State Changed. Device: (Your NOAA Weather Plus device name), "Temperature (ºF)" state, "Has Any Change"
- Condition: Always
- Actions: Type: Plugin, Plugin: Action Collection, Action: Insert Device State into Veriable, Device: (Your NOAA Weather Plus device name), Edit Action Settings...: Insert state: temperatureF, Into variable: Weather_Temperature_F
- Set sprinklerDurationMultiplier for Highest Temperature trigger
- Trigger: Type: Variable Changed. Variable: Weather_Temperature_F, "changes"
- Condition: If script returns true,
- Code: Select all
-- Test the old sprinklerDurationMultiplier value compared to the new calculated one. If the newly calculated one is higher, continue. This ensures that the coefficient used to calculate sprinkler duration for each zone takes into account the highest temperature in the day.
set theTemperature to (value of variable "Weather_Temperature_F") as number
-- This rounds to the nearest hundredths place.
set theCoefficient to round ((theTemperature / 75) * 100)
set theCoefficient to theCoefficient / 100
if theCoefficient > ((value of variable "sprinklerDurationMultiplier") as number) then
return true
else
return false
end if- Actions: Type: Execute Script, Embedded
- Code: Select all
-- This sets the value of the "sprinklerDurationMultiplier" Indigo variable to a real number somewhere between 0.50 and 1.50, depending on the temperature as reported by the National Weather Service at the Fresno Yosemite International airport at the time this trigger is executed. The higher the temperature, the larger the coefficient, which thus increases the sprinkler run time per zone. The coefficient is calculated assuming temperature is measured in Fahrenheit, with 75 degrees as the baseline temperature (coefficient = 1 if temperature is 75).
set theTemperature to (value of variable "Weather_Temperature_F") as number
-- This rounds to the nearest hundredths place.
set theCoefficient to round ((theTemperature / 75) * 100)
set theCoefficient to theCoefficient / 100
set value of variable "sprinklerDurationMultiplier" to (theCoefficient as text)- Weather Precipitation Check trigger
- Trigger: Type: Variable Changed. Variable: Weather_Condition, "changes"
- Condition: If script returns true,
- Code: Select all
if value of variable "Weather_Condition" contains "Rain" or value of variable "Weather_Condition" contains "Showers" or value of variable "Weather_Condition" contains "Thunderstorms" then
return true
else
return false
end if- Actions: Type: Modify Variable, Variable: "isPrecipitationToday", "Set to true"
And finally, the schedules. I have a total of 8. 1 to reset the "isPrecipitationToday" variable, 1 to reset the "sprinklerDurationMultiplier" variable, 2 for spring/summer watering, 2 for winter watering, 1 to switch from winter to spring/summer schedule, and 1 to switch from spring/summer to winter schedule.
- Reset isPrecipitationToday Variable schedule
- Schedule: Time: 5:00 AM, Date: Every "1" days, Start on: (select the current date)
- Condition: If script returns true:
- Code: Select all
if value of variable "Weather_Condition" contains "Rain" or value of variable "Weather_Condition" contains "Showers" or value of variable "Weather_Condition" contains "Thunderstorm" then
return false
else
return true
end if- Actions: Type: Modify Variable, Variable: "isPrecipitationToday", "Set to false"
- Reset sprinklerDurationMultiplier Variable schedule
- Schedule: Time: 5:00 AM, Date: Every "1" days, Start on: (select the current date)
- Condition: Always
- Actions: Type: Modify Variable, Variable: "sprinklerDurationMultiplier", Set to: "0"
- Sprinklers - Night - Spring/Summer schedule
- Schedule: Time: 11:30 PM, Randomize by +/- "30" minutes, Date: Days of week: Sunday, Wednesday, Friday, Repeat "Every week", Start on: (select the current date)
- Condition: If conditions match rules: "All", "If variable" "isPrecipitationToday" "is false"
- Actions: Type: Control Sprinkler, Device: (Your Rain8 device name), Action: "Run Schedule", (Enter the number of minutes for each of your zones, assuming a moderate temperature day), (Checked) Multiply durations by Variable value "sprinklerDurationMultiplier"
- Sprinklers - Morning - Spring/Summer schedule
- Schedule: Time: 3:15 AM, Randomize by +/- "30" minutes, Date: Days of week: Monday, Thursday, Saturday, Repeat "Every week", Start on: (select the current date)
- Condition: If conditions match rules: "All", "If variable" "isPrecipitationToday" "is false"
- Actions: Type: Control Sprinkler, Device: (Your Rain8 device name), Action: "Run Schedule", (Enter the number of minutes for each of your zones, assuming a moderate temperature day), (Checked) Multiply durations by Variable value "sprinklerDurationMultiplier"
- Sprinklers - Night - Winter schedule
- Schedule: Time: 11:45 PM, Randomize by +/- "30" minutes, Date: Days of week: Sunday, Repeat "Every week", Start on: (select the current date)
- Condition: If conditions match rules: "All", "If variable" "isPrecipitationToday" "is false"
- Actions: Type: Control Sprinkler, Device: (Your Rain8 device name), Action: "Run Schedule", (Enter the number of minutes for each of your zones, assuming a moderate temperature day), (Checked) Multiply durations by Variable value "sprinklerDurationMultiplier"
- Sprinklers - Morning - Winter schedule
- Schedule: Time: 3:30 AM, Randomize by +/- "30" minutes, Date: Days of week: Monday, Repeat "Every week", Start on: (select the current date)
- Condition: If conditions match rules: "All", "If variable" "isPrecipitationToday" "is false"
- Actions: Type: Control Sprinkler, Device: (Your Rain8 device name), Action: "Run Schedule", (Enter the number of minutes for each of your zones, assuming a moderate temperature day), (Checked) Multiply durations by Variable value "sprinklerDurationMultiplier"
- Switch to Winter Watering Schedule schedule
- Schedule: Time: 12:00 PM, Date: 12/1/2012, Repeat "Every year"
- Condition: Always
- Actions:
- Type: Enable Schedule, Enable: "Sprinklers - Night - Winter"
- Type: Enable Schedule, Enable: "Sprinklers - Morning - Winter"
- Type: Disable Schedule, Disable: "Sprinklers - Night - Spring/Summer"
- Type: Disable Schedule, Disable: "Sprinklers - Morning - Spring/Summer"
- Switch to Spring/Summer Watering Schedule schedule
- Schedule: Time: 12:00 PM, Date: 3/2/2013, Repeat "Every year"
- Condition: Always
- Actions:
- Type: Enable Schedule, Enable: "Sprinklers - Night - Spring/Summer"
- Type: Enable Schedule, Enable: "Sprinklers - Morning - Spring/Summer"
- Type: Disable Schedule, Disable: "Sprinklers - Night - Winter"
- Type: Disable Schedule, Disable: "Sprinklers - Morning - Winter"
Let me know if you need anything cleared up.
nsheldon wrote:Hey, glad I could help!
Ericbo wrote:nsheldon wrote:Hey, glad I could help!
Just finished coding the rain precipitation ... as California is getting its first rain of the season ... Thanks again !! Eric
nsheldon wrote:Awesome! Glad I could help out Eric.
Users browsing this forum: No registered users and 1 guest