OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Master Valve on Zone 9-16? Reply To: Master Valve on Zone 9-16?

#36528

mark
Participant

Yes, very easy to change.  However in doing so, I believe I exposed an existing bug (Which took a lot of time to find).  Here’s how I did it.  To change the front end, replace the code inside the ‘elif name==”mas”:’ section with the following:

output += “<select name=’omas’>\n”
output += “<option ” + (“selected ” if value==0 else “”) + “value=’0′>”+_(‘None’)+”</option>\n”
for bid in range(0,gv.sd[‘nbrd’]):
for s in range(0,8):
sid=bid*8 + s;
if gv.sd[‘show’][bid]&(1<<s):
output += “<option “+(“selected ” if value==sid+1 else “”)+ “value='”+str(sid+1) +”‘>Station “+ str(sid+1).rjust(2,’0’)+”: “+snames[sid]+”</option>\n”
output += “</select>\n”

This will check to see if the option of the expansion board is present, and will only load zones marked as active.  The current code handles the upper values for the master just fine, and runs it perfect.  But I did find a bug in the display.  So even though the master value will turn on and off, the front end web page shows it as off.  To fix that, a simple change in the ospi.py file is needed.  Change line 97 gv.sbits[b] |=1 << sid  to gv.sbits[b] |=1 << s  ‘Sid’ will grow from 1 to 16, ‘s’ will will grow from 1 to 8 twice.  Since master was only on 1-8, using ‘sid’ was never an issue.