OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python interval program update 9/23/13

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
  • #22651

    Dan in CA

    The September 23 2013 update to the Python Interval Program is now available on GitHub.

    This is mostly a bug fix release, especially in the area of concurrent operation.

    Added a new “revision” page to the native web interface.
    Pointing your browser to [URL of the program]/rev will bring up a page with revision and date information.
    for example on my test system it would be:

    Up till now any running station would be stopped and scheduled stations would be cleared when the number of expansion boards was changed on the Options page.
    This has been fixed and expansion boards can be added “on the fly” without interrupting a running program.

    See the Wiki for update instructions:

    From the README:
    Additions, bug fixes:
    1. Added a new revisions page to the native web interface.
    2. Modified the home.js file to show time zone info in the last run log near the bottom of the page.
    3. Fixed a bug in concurrent mode that kept a station running after it’s duration had expired.
    4. Fixed a bug that would cause an exception (freeze the program) after the number of expansion boards was changed.
    5. Fixed a bug that would stop a running station and clear scheduled stations when the number of expansion boards was changed in Options.

    Files that were changed in this update:




    Hi Dan,

    Thanks so much for adding the per station rain sensor option. That’s great! Plus all the other fixes and updates.

    It took me a while to feel confident to do the “git pull” to bring in your commits and merge them with my local changes for the garage door and rain sensor. I’m new to git. I’ve been reading a really good on-line free book,, which has helped me quite a bit. also helped with understanding what I needed to do to fix the conflicts I had in and home.js.

    Since the rain sensor is functional now, I wonder if you would consider adding code to to define the pin, set up the gpio, read the pin, and poll it.

    Here’s the way I’ve done it, adding to the appropriate sections:

    def getRainState():
    if GPIO.input(pin_rain_sense):
    res2 = 0
    res2 = 1
    return res2

    pin_rain_sense = 25

    GPIO.setup(pin_rain_sense, GPIO.IN, pull_up_down=GPIO.PUD_UP)

    And inserting a call to get the rain sensor state in the main loop:

    def main_loop(): # Runs in a seperate thread
    """ ***** Main algorithm.***** """
    print 'Starting main loop n'
    last_min = 0
    while True: # infinite loop = time.time()+((*3600 # Current time based on UTC time from the Pi adjusted by the Time Zone setting from options. updated once per second.

    Other folks might choose a different input pin for the rain sensor, but the rest of the code would be there.



    Thanks again!




    How about making the pin selection a menu option?



    Dan in CA

    Just when I was thinking the program was getting stable and I could concentrate on some evapotranspiration calculations (weather based irrigation stuff…).

    These suggestions are definitely interesting. I will give it some thought.

    Thanks for the link to the Git book.
    I’m new to Git also and that looks like a great resource. As a Windows user I have found TortoiseGit:
    to be extremely helpful, especially since I’ve been using TortoiseSVN as my internal version control system throughout this project.

    What sort of menu option would you suggest for the rain sensor pin define? An addition to the Options page comes to mind but your suggestion for the CPU temp. toggle was excellent and didn’t add to the already long Options page.





    Dan, I’ve been looking into ET myself. I started a thread called Weather algorithms to discuss how to use weather data to water smarter.




    There are two schools of thought here. The one is to add the setting to the Options page just like the HTTP port to be an integer number between X and Y. This way is simple and without any fuss. The second is to make the part of the config file that you need to edit manually. With this option you save on the Options Page space but then it’s a manual thing to edit. Fortunately it’s a static variable and once set then it will probably not change for the life of the Pi.

    So, both have advantages and disadvantages. I would say stick it in the Options page and see what the reaction is from the community. My suggestion is to put it next to the ‘Use RS’ checkbox. If checked, then enable/make it visible, if unchecked then either disable it or hide it.

    And… You could use either a textbox or a dropdownlist for GPIO pins.




    I had my first error this AM. I was trying to run a program one-time manually. I tried it first from the web app and then from the interval program. From the Web App, there was an error message saying it could not communicate with the sprinkler. On the interval program, it threw the error noted at the bottom of my post here.

    To try to help with troubleshooting, I tried to see if I could get it to run manually and it did fine (running right now, in fact).

    This is only in the run-once program setting.

    I hope this helps.

    Thanks, Mike

    at /cr
    schedule_stations() takes exactly 1 argument (0 given)
    /home/pi/OSPi/ in GET, line 810
    Traceback (innermost first)
    /home/pi/OSPi/ in GET
    schedule_stations() …
    ▶ Local vars
    /home/pi/OSPi/web/ in handle_class
    return tocall(*args) …
    ▶ Local vars
    /home/pi/OSPi/web/ in _delegate
    return handle_class(cls) …
    ▶ Local vars
    /home/pi/OSPi/web/ in handle
    return self._delegate(fn, self.fvars, args) …
    ▶ Local vars
    /home/pi/OSPi/web/ in process
    return self.handle() …
    ▶ Local vars



    Dan in CA

    Hi Mike,

    There was an update just before the 9/23 one which had that problem.

    If you try to check the rev page by adding /rev to the URL of the program you should get a page with a few lines of text that should include revision: 135

    If it says revision 134 or you get a not found error, you just need to update to the latest version.

    If you are running revision 135 and are still getting the error, please let me know.





    Thanks, Dan!

    That did the trick. I think I must have updated just prior to you uploading the new version.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python interval program update 9/23/13