OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Interval plugin: Auto-Program – v2 release now available! Re: Re: Interval plugin: Auto-Program – v2 release now available

#27025

fbret
Member

So I did a little instrumentation of the python code:
print “ap zone”, str(z),” needs “, water_needed, ” – duration “, duration,”s”
if duration < MIN_DURATION: continue # don't water too little
duration *= gv.sd/100 # modify duration by water level if set
if gv.sd: # sequential mode
gv.rs[z][RS_STARTTIME] = accumulate_time
gv.rs[z][RS_DURATION] = int(duration) # store duration scaled by water level
accumulate_time += int(duration)
gv.rs[z][RS_STOPTIME] = accumulate_time
accumulate_time += gv.sd # add station delay
gv.rs[z][RS_PROGID] = autoPid # store program number for scheduling
gv.ps[z][PS_PROGID] = autoPid # store program number for display
gv.ps[z][PS_DURATION] = int(duration)
print “ap zone”, str(z),” starting “,gv.rs[z][RS_STARTTIME], ” – duration “, duration,”s – end itme:”,accumulate_time

The output is then:
pi@sprinkler ~/OSPi $ sudo python ospi.py
sudo: unable to resolve host sprinkler
Setting water level to 90%
2014-08-11 Getting rainfall history…
auto_program: job scheduled runAutoProgram (trigger: cron[hour=’5′, minute=’0′], next run at: 2014-08-12 05:00:00)
plugins loaded:

Starting timing loop

http://0.0.0.0:8080/
192.168.1.20:59181 – – [11/Aug/2014 16:16:49] “HTTP/1.1 GET /auto” – 200 OK
auto_program starting automatic program loop
ap zone 0 needs 0.5 – duration 1200.0 s
ap zone 0 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 1 needs 0.5 – duration 1200.0 s
ap zone 1 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 2 needs 0.5 – duration 1200.0 s
ap zone 2 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 3 needs 0.5 – duration 1200.0 s
ap zone 3 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 4 needs 0.5 – duration 1200.0 s
ap zone 4 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 5 needs 0.5 – duration 1200.0 s
ap zone 5 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 6 needs 0.5 – duration 1200.0 s
ap zone 6 starting 1407774056 – duration 0.0 s – end itme: 1407774056
ap zone 7 needs 0.5 – duration 1200.0 s
ap zone 7 starting 1407774056 – duration 0.0 s – end itme: 1407774056

Why is duration set to 0? It seems

duration *= gv.sd/100                     # modify duration by water level if set

Further debugging shows water level = 90…
so I changed the line to:

duration *= 1.0*gv.sd/100 

issue looks fixed now… 🙂