@DanTripp – I’m looking at something similar, which is great – I’d like somebody to collaborate with.

One thing I saw was that Texas A&M claims that you can’t get an accurate ETo without having solar radiation values in addition to local soil temperature and moisture readings. I can’t get all that from wunderground. Have you done some simulation that suggests that isn’t that critical? I’ve messed around with some calculations and it looks like even being way off on some calculations has only moderate impact on the amount of watering.

However, I’m not sure how important ETo really is? I haven’t modeled it, but I should. Instead, I was going to start with a simpler version that adjusted the pattern based on the amount of watering+rainfall over the last 7 day period. I’m going to post my algorithm in the other thread I created for this discussion.

In the meantime, here is a python routine to get yesterday’s rainfall total from the wunderground api. I’m thinking that certain configuration items like the decision to use wunderground or your local rain gauge should be something set globally, so I created a settings module and put a couple global variables in there (that’s what settings.useWunderground, settings.pwd and settings.keyWunderground are from.)


# getYesterdayRain
# - returns a floating point value that represents the total rainfall from yesterday
def getYesterdayRain():

rainfall = 0.0

if settings.useWunderground:
# if we are using wunderground.com as a data source, then pull from their api using the configured key
url = r'http://api.wunderground.com/api/' + settings.keyWunderground + r'/yesterday/q/pws:' + settings.pws + r'.json'
json_data = wget(url)
if (json_data):
data = json.load(json_data)
else: return -1
# print 'hour:', hr, 'date:', data[hr], 'data:', data[hr]

return rainfall