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
    Posts
  • #22634

    Dan in CA
    Participant

    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.

    [attachment=0:1n9x4pty]Ignore-rain.jpg[/attachment:1n9x4pty]
    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.

    EDIT:
    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 ([email protected] ~ $):

    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:
    http://rayshobby.net/mediawiki/index.php?title=Python_Interval_Program_for_OSPi#Updating_the_program

    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:
    ospi.py
    OSPi/static/scripts/java/svc1.8.3/home.js
    OSPi/static/scripts/java/svc1.8.3/progmode.js
    OSPi/static/scripts/java/svc1.8.3/viewstations.js
    sd_reference.txt
    README.md
    ospi.sh (used as /etc/init.d/ospi)

    Dan

    #25525

    declanslater
    Participant

    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:

    [email protected] ~/OSPi/OSPi $ sudo python ospi.py
    Starting main loop

    http://0.0.0.0:80/
    Traceback (most recent call last):
    File “ospi.py”, line 1008, in
    app.run()
    File “ospi.py”, line 1003, in run
    return web.httpserver.runsimple(func, (‘0.0.0.0’, port))
    File “/home/pi/demos/OpenSprinkler Pi/software/demos/interval_program/OSPi/web/httpserver.py”, line 157, in runsimple
    server.start()
    File “/home/pi/demos/OpenSprinkler Pi/software/demos/interval_program/OSPi/web/wsgiserver/__init__.py”, line 1753, in start
    raise socket.error(msg)
    socket.error: No socket could be created
    [email protected] ~/OSPi/OSPi $

    #25526

    djagerif
    Participant

    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.

    [email protected]:~/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}
    [email protected]:~/OSPi/data$

    Ingo

    #25527

    Dan in CA
    Participant

    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.

    Dan

    #25528

    declanslater
    Participant

    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/ospi.py in GET, line 700

    Web GET http://192.168.1.66:8080/cs

    Traceback (innermost first)

    /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/ospi.py in GET

    gv.sd = 0 …

    ▶ Local vars

    /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/web/application.py in handle_class

    return tocall(*args) …

    ▶ Local vars

    /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/web/application.py in _delegate

    return handle_class(cls) …

    ▶ Local vars

    /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/web/application.py in handle

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

    ▶ Local vars

    /home/pi/demos/OpenSprinkler
    Pi/software/demos/interval_program/OSPi/web/application.py in process

    return self.handle() …

    ▶ Local vars

    Request information

    INPUT

    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.

    META

    Variable Value

    app_stack [<__main__.OSPi_app instance at
    0xb887d8>]

    fullpath
    u’/cs?s0=S01&s1=S02&s2=S03&s3=S04&s4=S05&s5=S06&s6=S07&s7=S08&s8=S09&s9=S10&
    s10=S11&s11=S12&s12=S13&s13=S14&s14=S15&s15=S16&pw=opendoor&m0=&i0=14&m1=&i1
    =0′

    headers []

    home u’http://192.168.1.66:8080&#8242;

    homedomain u’http://192.168.1.66:8080&#8242;

    homepath u”

    host u’192.168.1.66:8080′

    ip u’192.168.1.196′

    method u’GET’

    output u”

    path u’/cs’

    protocol u’http’

    query
    u’?s0=S01&s1=S02&s2=S03&s3=S04&s4=S05&s5=S06&s6=S07&s7=S08&s8=S09&s9=S10&s10
    =S11&s11=S12&s12=S13&s13=S14&s14=S15&s15=S16&pw=opendoor&m0=&i0=14&m1=&i1=0′

    realhome u’http://192.168.1.66:8080&#8242;

    status ‘200 OK’

    ENVIRONMENT

    Variable Value

    ACTUAL_SERVER_PROTOCOL ‘HTTP/1.1’

    HTTP_ACCEPT
    ‘text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8’

    HTTP_ACCEPT_ENCODING ‘gzip, deflate’

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

    HTTP_CONNECTION ‘keep-alive’

    HTTP_DNT ‘1’

    HTTP_HOST ‘192.168.1.66:8080’

    HTTP_REFERER ‘http://192.168.1.66:8080/vs&#8217;

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

    PATH_INFO ‘/cs’

    QUERY_STRING
    ‘s0=S01&s1=S02&s2=S03&s3=S04&s4=S05&s5=S06&s6=S07&s7=S08&s8=S09&s9=S10&s10=S
    11&s11=S12&s12=S13&s13=S14&s14=S15&s15=S16&pw=opendoor&m0=&i0=14&m1=&i1=0′

    REMOTE_ADDR ‘192.168.1.196’

    REMOTE_PORT ‘62614’

    REQUEST_METHOD ‘GET’

    REQUEST_URI
    ‘/cs?s0=S01&s1=S02&s2=S03&s3=S04&s4=S05&s5=S06&s6=S07&s7=S08&s8=S09&s9=S10&s
    10=S11&s11=S12&s12=S13&s13=S14&s14=S15&s15=S16&pw=opendoor&m0=&i0=14&m1=&i1=
    0′

    SCRIPT_NAME ”

    SERVER_NAME ‘localhost’

    SERVER_PORT ‘8080’

    SERVER_PROTOCOL ‘HTTP/1.1’

    SERVER_SOFTWARE ‘CherryPy/3.2.0 Server’

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

    wsgi.input

    wsgi.multiprocess False

    wsgi.multithread True

    wsgi.run_once False

    wsgi.url_scheme ‘http’

    wsgi.version (1, 0)

    #25529

    Dan in CA
    Participant

    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.

    Dan

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