Thank you, berkinet, for the great reply. I forgot I had those HiLo variables in my variables list and had to do a little digging to see what was setting them as they hadn't been updated in quite a while. It turns out I lacked the scheduled event to reset those variables at the start of each new day, so they were holding old HiLo values.
To make use of them, I wrote this script to be run each night at 11:50:
- Code: Select all
from datetime import date
# Indigo Variables
runDripToday = indigo.variables[542358241] # Set to true if the drip should run today
dripDayInterval = indigo.variables[1228875068] # Nominal watering period in days
todaysHighTemp = indigo.variables[53056838] # The high temperature of the day in degreesF
dripTemperature = indigo.variables[1965665196] # Above this temperature, the drip should run
# Reset runDripToday variable
indigo.variable.updateValue(runDripToday, "false")
# Grab today's date and convert it to a day count
today = date.today()
dayNumber = date.toordinal(today)
# Ensure dripDayInterval is an integer
interval = int(dripDayInterval.value, base=10)
# Set runDripToday to true if the daily high temperature exceeded the threshold set
# by dripTemperature, or if the number of days set by dripDayInterval has passed.
if ((dayNumber % interval == 0) or (todaysHighTemp.value >= dripTemperature.value)):
indigo.variable.updateValue(runDripToday, "true")
indigo.server.log("runDripToday Enabled")
else:
indigo.server.log("runDripToday Disabled")
I set up the variables in Indigo so that I can easily change the temperature threshold and the nominal watering interval, even from Indigo Touch. The scheduled event that runs the drip irrigation is called daily, but only runs if two variables are true,
runDripToday (set by this script) and
enableSprinklers, which is a global variable I use in all my sprinkler schedules so I can toggle them with a single variable. I run the drip every three days (
dripDayInterval = 3) in the early morning, but will run it if the previous day exceeded the
dripTemperature, regardless how many days have passed since the last watering.