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.