to stop it from running if it is raining and although your reply did not point to it directly it gave me the information I needed.
I tried that. The issue is that the conditions at NOAA are only updated every 2 hours. So if you have light rain its light rain for 2 hours. Or no rain it is no rain for 2 hours (at least with my NOAA station) I even did a counter adding x amount depending on the rain conditions testing every 15 minutes:
light drizzle .. heavy down p. Incremented each by 1.3 . There are 10 different levels of rainfall 3 or 4 main words (drizzle, rain, shower, downpour ..) and each comes with qualifier: light normal heavy ..)
That way I could count the rainfall, but again the conditions only change every 2 hours..
and then there are thunderstorms and none of the "rain words" .. appear in the weather condition ..
here the python code I did some 18 months ago. and you will see that was one of my first py scripts.
- Code: Select all
## karl wachs
## Sept. 2 2013
## call every 15 minutes
## checks NOAAplus device information of currentcondition
## if drizzle / rain add to raincount multiply by 1/27 (mult1)
## if light / normal / heavy multiply by 1/3/9 (mult2)
## rain constant for normal rain every 15 minutes is: normal rain per hour is 0.205/2 inches
## total add = mult1*mult2*rainperunit
inchPerRainUnit = 0.205 / (4 * 81 * 2) ## still tuning
rightNow = indigo.server.getTime()
theHour = int(rightNow.hour)
theMinute = int(rightNow.minute)
rainCount = indigo.variables
rainCountString = str(rainCount.value)
rainCountNumber = float(rainCountString)
## NoaaCondition = indigo.variables # "NOA_loveField_condition"
noaadevice = indigo.devices # "NoaPlusLoveField"
currentCondition = noaadevice.states['currentCondition']
Noaa = currentCondition.upper()
updateYesterday = 'no'
if theHour < 1 : ## it is now tomorrow, move raincount to yesterday variable
if theMinute < 15 :
rainCountYesterday = rainCountString
rainCountNumber = float(0)
rainCountString = '0'
## check what condition, if rain drizzel ligh heavy string is present
rainYN = int(Noaa.find('RAIN'))
drizzleYN = Noaa.find('DRIZZLE')
lightYN = Noaa.find('LIGHT')
heavyYN = Noaa.find('HEAVY')
mult1 = 0
if rainYN > -1 :
mult1 = 27
if drizzleYN > -1 :
mult1 = 3
mult2 = 3
if lightYN > -1 :
mult2 = 1
if heavyYN > -1 :
mult2 = 9
rainToAdd = mult1 * mult2 * inchPerRainUnit
rainCountString = str(rainCountNumber + rainToAdd)
if updateYesterday =='yes':