diff --git a/GroveWeatherPi.py b/GroveWeatherPi.py index 4704a1a..fd6b520 100644 --- a/GroveWeatherPi.py +++ b/GroveWeatherPi.py @@ -1805,6 +1805,21 @@ def checkForButtons(): while True: + # Check for new day to do some daily maintanance. + # For now, just reset the daily rainfall count. More might come... + today = datetime.now().day + if 'yesterday' in locals(): # Not the first run + if today != yesterday: # A new day has begun + # Reset daily rain count + print "Reset rain count" + totalRain = 0 + yesterday = today + else: # First run, define yesterday + print "First run, define yesterday/initialize variables..." + yesterday = today + totalRain = 0 + # New day can start... + # process Interrupts from Lightning if (as3935Interrupt == True):