Allow users not using Zimmerman method to use California restriction
This commit is contained in:
@@ -166,7 +166,7 @@ def application(environ, start_response):
|
|||||||
except:
|
except:
|
||||||
toffset=-1
|
toffset=-1
|
||||||
|
|
||||||
if (uwt > 0):
|
if (key != ''):
|
||||||
try:
|
try:
|
||||||
req = urllib2.urlopen('http://api.wunderground.com/api/'+key+'/yesterday/conditions/q/'+urllib.quote(loc)+'.json')
|
req = urllib2.urlopen('http://api.wunderground.com/api/'+key+'/yesterday/conditions/q/'+urllib.quote(loc)+'.json')
|
||||||
dat = json.load(req)
|
dat = json.load(req)
|
||||||
@@ -195,26 +195,27 @@ def application(environ, start_response):
|
|||||||
if v:
|
if v:
|
||||||
h_today = safe_float(v, h_today)
|
h_today = safe_float(v, h_today)
|
||||||
|
|
||||||
# calculate water time scale, per https://github.com/rszimm/sprinklers_pi/blob/master/Weather.cpp
|
if (uwt === 1):
|
||||||
hf = 0
|
# calculate water time scale, per https://github.com/rszimm/sprinklers_pi/blob/master/Weather.cpp
|
||||||
if (maxh>=0) and (minh>=0):
|
hf = 0
|
||||||
hf = 30 - (maxh+minh)/2
|
if (maxh>=0) and (minh>=0):
|
||||||
#elif (h_today>=0):
|
hf = 30 - (maxh+minh)/2
|
||||||
# hf = 30 - h_today
|
#elif (h_today>=0):
|
||||||
tf = 0
|
# hf = 30 - h_today
|
||||||
if (meant > -500):
|
tf = 0
|
||||||
tf = (meant - 70) * 4
|
if (meant > -500):
|
||||||
rf = 0
|
tf = (meant - 70) * 4
|
||||||
if (pre>=0):
|
rf = 0
|
||||||
rf -= pre * 200
|
if (pre>=0):
|
||||||
if (pre_today>=0):
|
rf -= pre * 200
|
||||||
rf -= pre_today * 200
|
if (pre_today>=0):
|
||||||
scale = (int)(100 + hf + tf + rf)
|
rf -= pre_today * 200
|
||||||
|
scale = (int)(100 + hf + tf + rf)
|
||||||
|
|
||||||
if (scale<0):
|
if (scale<0):
|
||||||
scale = 0
|
scale = 0
|
||||||
if (scale>200):
|
if (scale>200):
|
||||||
scale = 200
|
scale = 200
|
||||||
|
|
||||||
# Check weather modifier bits and apply scale modification
|
# Check weather modifier bits and apply scale modification
|
||||||
if ((uwt>>7) & 1):
|
if ((uwt>>7) & 1):
|
||||||
|
|||||||
Reference in New Issue
Block a user