OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) HTML API differences beteen OpenSprinkler and OSPi Re: Re: HTML API differences beteen OpenSprinkler and OSPi

#25310

Dan in CA
Participant

ChrisFSB

I took a look and what was going on and made a couple of changes to the Interval program. The fixes will be in the next update but if you want to make the changes now, they are:
issues #1 an #2.
replace the set_station class (~line 642) with:


class set_station:
"""turn a station (valve/zone) on=1 or off=0 in manual mode."""
def GET(self, nst, t=None): # nst = station number, status, optional duration
nstlst = [int(i) for i in re.split('=|&t=', nst)]
if len(nstlst) == 2:
nstlst.append(0)
sid = int(nstlst[0])-1 # station index
b = sid/8 #board index
if nstlst[1] == 1 and gv.sd: # if status is on and manual mode is set
gv.rs[sid][0] = time.time() # set start time to current time
if nstlst[2]: # if an optional duration time is given
gv.rs[sid][2] = nstlst[2]
gv.rs[sid][1] = gv.rs[sid][0] + nstlst[2] # stop time = start time + duration
else:
gv.rs[sid][1] = float('inf') # stop time = infinity
gv.rs[sid][3] = 99 # set program index
gv.ps[sid][1] = nstlst[2]
gv.sd=1
time.sleep(1.5)
if nstlst[1] == 0 and gv.sd: # If status is off
gv.rs[sid][1] = time.time()
time.sleep(1.5)
raise web.seeother('/')

Issue #3:
Int the Get_Station class (~line 628), comment out or delete the following line:

status = 'n'

Modify the ine after that to change += to just =:

status = ''.join(str(x) for x in gv.srvals)

The doctype line was originally added to make the program work with webkit browsers such as Chrome. I just tested this in chrome and it is working as expected.

Dan