OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python Interval Program now has "Ignore rain" option

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

    Dan in CA

    Hi All,

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

    The big news is that a new option has been added to the Stations page which allows selected stations to continue operating during a rain delay or when a rain sensor would stop scheduled programs. This is useful in situations where a zone irrigates plants in sheltered areas or if the station is used for another purpose such as controlling lights a garage door etc.

    Note: The program also now uses the HTTP port setting from the Options page of the native web interface. New installations will default to port 8080.

    If you are running another server on your pi that is using port 80, for example if you are using Samer’s mobile web ap with Apache, you will need to edit the file OSPi/data/sd.json.
    From a terminal window and in the Pi home directory (pi@raspberrypi ~ $):

    sudo nano OSPi/data/sd.json

    Use the cursor keys (arrow keys) to move to “htp”: 80 and change 80 to the port number you have been using for the program, e.g. 8080.
    Then use control+o to save the file and control+x to exit the editor.
    Restart the pi with:

    sudo reboot

    and things should be working again.
    This is due to an old default of port 80 which is stored in the file /data/sd.json as “htp”: 80,.
    This new setting overrides any setting you may have in an rc.local or init.d start up script so you can leave your script as is.

    See the Wiki for update instructions:

    From the README:
    Additions, bug fixes:

    1. Added a per-station “Ignore rain” option that allows a station to operate during rain delay or if a rain sensor detects rain.
    2. Modified the program to use the HTTP port setting from the Options page.
    3. Improved the way the program tracks current time. This simplified the code and should eliminate some timing bugs.
    4. Edited Denny’s init.d start up script to remove IP address and port settings no longer needed.

    Files that were changed or added in this update:
    sd_reference.txt (used as /etc/init.d/ospi)




    Fantastic! Thanks for doing that!!

    One little thing I’m running into, I was already running on 8080 for OSPi. The git update said something about dependencies so I did a git stash then git pull. Now the OSPi webpage is not availible, and Samer’s program says system disabled.. help?

    Here is what I get:

    pi@opensprinkler ~/OSPi/OSPi $ sudo python
    Starting main loop
    Traceback (most recent call last):
    File “”, line 1008, in
    File “”, line 1003, in run
    return web.httpserver.runsimple(func, (‘’, port))
    File “/home/pi/demos/OpenSprinkler Pi/software/demos/interval_program/OSPi/web/”, line 157, in runsimple
    File “/home/pi/demos/OpenSprinkler Pi/software/demos/interval_program/OSPi/web/wsgiserver/”, line 1753, in start
    raise socket.error(msg)
    socket.error: No socket could be created
    pi@opensprinkler ~/OSPi/OSPi $



    Look in /data/sd.json and check to see if “htp” is what you intend it to be. Mine pointed to the wrong port and once I set it manually it worked. I run mine on 8080.

    pi@raspberrypi:~/OSPi/data$ cat sd.json
    {“en”: 1, “seq”: 0, “mnp”: 32, “rsn”: 0, “htp”: 8080, “nst”: 32, “rdst”: 0, “loc”: “Irene,ZA”, “tz”: 56, “rs”: 0, “tu”: “C”, “rd”: 0, “mton”: 0, “lr”: “100”, “sdt”: 0, “mas”: 8, “bsy”: 1, “lg”: “checked”, “wl”: 100, “nopts”: 13, “pwd”: “b3BlbmRvb3I=”, “ipas”: 0, “urs”: 1, “rst”: 1, “mm”: 0, “mo”: [255, 255, 255, 255], “rbt”: 0, “mtoff”: 0, “nprogs”: 4, “nbrd”: 4}



    Dan in CA

    I was hoping the change in the port setting wouldn’t cause too many progamems.

    @ declanslater
    The “socket.error: No socket could be created” line in the error message indicates that something is already running on port 80. If you are using Samer’s mobile web app and have a server like Apache running that would produce that result.

    You will need to manually edit the /data/sd.json file as suggested by Ingo in the previous post*.

    *I have edited the instructions in the original post to include instructions for this.

    I tested things here but I don’t have Apache running on my test system so I missed that possibility. Sorry about that.

    I will be adding Apache and Samer’s app to my test system to avoid this sort of problem in the future.




    Thanks for all the help. That got it fixed…

    Sorry to be a bother, but whenever I tick one of the boxes to enable the skip rain thing, I get this…
    It does leave the boxes checked when I go back into the page, I haven’t checked it yet to see if works, just wanted to run it by you. Thanks!

    at /cs

    list assignment index out of range

    Python /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/ in GET, line 700

    Web GET

    Traceback (innermost first)

    Pi/software/demos/interval_program/OSPi/ in GET = 0 …

    ▶ Local vars

    Pi/software/demos/interval_program/OSPi/web/ in handle_class

    return tocall(*args) …

    ▶ Local vars

    Pi/software/demos/interval_program/OSPi/web/ in _delegate

    return handle_class(cls) …

    ▶ Local vars

    Pi/software/demos/interval_program/OSPi/web/ in handle

    return self._delegate(fn, self.fvars, args) …

    ▶ Local vars

    Pi/software/demos/interval_program/OSPi/web/ in process

    return self.handle() …

    ▶ Local vars

    Request information


    Variable Value

    i0 ’14’

    i1 ‘0’

    m0 ”

    m1 ”

    pw ‘opendoor’

    s0 ‘S01’

    s1 ‘S02’

    s10 ‘S11’

    s11 ‘S12’

    s12 ‘S13’

    s13 ‘S14’

    s14 ‘S15’

    s15 ‘S16’

    s2 ‘S03’

    s3 ‘S04’

    s4 ‘S05’

    s5 ‘S06’

    s6 ‘S07’

    s7 ‘S08’

    s8 ‘S09’

    s9 ‘S10’

    COOKIES No data.


    Variable Value

    app_stack [<__main__.OSPi_app instance at


    headers []

    home u’;

    homedomain u’;

    homepath u”

    host u’′

    ip u’′

    method u’GET’

    output u”

    path u’/cs’

    protocol u’http’


    realhome u’;

    status ‘200 OK’


    Variable Value



    HTTP_ACCEPT_ENCODING ‘gzip, deflate’

    HTTP_ACCEPT_LANGUAGE ‘en-US,en;q=0.5’

    HTTP_CONNECTION ‘keep-alive’

    HTTP_DNT ‘1’

    HTTP_HOST ‘’


    HTTP_USER_AGENT ‘Mozilla/5.0 (Windows NT 6.1; WOW64;
    rv:23.0) Gecko/20100101 Firefox/23.0′

    PATH_INFO ‘/cs’



    REMOTE_PORT ‘62614’




    SERVER_NAME ‘localhost’

    SERVER_PORT ‘8080’


    SERVER_SOFTWARE ‘CherryPy/3.2.0 Server’

    wsgi.errors ‘,
    mode ‘w’ at 0xb6c940d0>


    wsgi.multiprocess False

    wsgi.multithread True

    wsgi.run_once False

    wsgi.url_scheme ‘http’

    wsgi.version (1, 0)


    Dan in CA

    No bother.
    If there is a problem, please let me know.

    I just pushed a fix to GitHub.
    If you run the update now the problem should be taken care of.

    The Ignore rain feature didn’t properly take into account expansion boards.


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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python Interval Program now has "Ignore rain" option