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

Viewing 10 posts - 26 through 35 (of 35 total)
  • Author
    Posts
  • #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… 🙂

    #27026

    scottsh
    Participant

    Oh wow thanks – obviously that bug is caused by interaction between the other plug-in that I haven’t touched in a while. I kept having a problem where the Monthly Adjust plug-in was resetting itself so I quit using it. I didn’t get back to it post 2.0.

    Obviously there is a type problem there with float/int. All part of the fun with weakly-typed languages :).

    Fixed and committed.

    Thanks a lot for helping get to the bottom of this!

    Scott

    #27027

    scottsh
    Participant

    I realized this morning in the shower how to fix the implementation of the Monthly Adjust to Auto-Program that was previously bogus. It is fixed now – pull a new copy if you want these two plug-ins to work properly together.

    For those who want to know what was up: the previous implementation modified the duration of the watering schedule by the monthly adjustment similar to how the manual program mode works. However, Auto-Program is “smarter” than manual mode, and as a result would automatically compensate back the other way, removing the adjustment! Why? Because Auto-Program recalculates the amount needed every day based on the actual watering time + any rainfall. This allows the code to include any manual mode watering, regular programs that you still want to run, etc. in the calculations for the next watering cycle. Subtle, I know, but it shows the power of this method of automation.

    But enough about all of that, its fixed now so all is good.

    Scott

    #27028

    richpuch
    Participant

    Prior to you fixing the Monthly Audustment, my setting where all at 100% and now are:

    [39, 50, 66, 82, 95, 96, 100, 93, 77, 53, 38, 33]

    I don’t quite understand how this plugin works, are the values calculated automatically from wunderground or are these setting we need to adjust according to our environment? I do see during the ‘git pull’ the data/levels.json gets coppied down, so I assume these are your setting.

    Thanks
    Rich

    #27029

    scottsh
    Participant

    Yeah those are my settings, if you copy over the data file from your previous install it will copy your old data if you have it.

    My .json file shouldn’t really be in the repo, I’ll figure out a way to use his (initial, blank) copy.

    #33633

    eecyclone
    Participant

    Scottsh, have you updated this plugin at all or done any testing with the new 2.1.2 software?

    #35149

    scottsh
    Participant

    No, I have not. The number of changes required was significant and I just honestly didn’t have the motivation to make time to do it.  But, I’m getting fired up about it again.

    I’m going to pull down Dan’s latest code and see how much work it really is.

    #35158

    Dan in CA
    Participant

    Scott,

    Glad to see you are still involved!

    I am planning to push an update in the next couple of days. It includes support for multiple languages and a new signalling system which allows events in the core program to trigger functions in plugins without polling (no looping required).

    At this point I expect the code to remain fairly stable for the foreseeable future except for feature updates such as the ability to schedule multiple zones in each program.

    Dan

    #35164

    Rudolph Terblanche
    Participant

    +1 on the multiple zones in each program.

    #35165

    scottsh
    Participant

    Thanks for the note Dan – I’ll hold off until you release that update.  I pulled down the current code and started reviewing it so I could understand where the changes will be.

    Scott

Viewing 10 posts - 26 through 35 (of 35 total)
  • You must be logged in to reply to this topic.

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