OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python interval program update 8/25/13

  • This topic is empty.
Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #22617

    Dan in CA
    Participant

    Hi All,
    The August 25 update of the Python Interval Program is now available.

    There are a couple of bug fixes and a couple of new features but the biggest change is an improved method for installing and updating the program.

    Note: The installation instructions on the wiki have not been edited yet. I will work on that next. It should be done by tomorrow evening.

    After getting some really excellent advice from Samer, I was able to set up a new repository on GitHub which will make installing and updateing the program much easier.
    It should be fairly painless to upgrade to this version and from now on you will only need to log in to the OSPi directory on your Pi and execute:

    git pull

    and updates will be automatically installed with no need to copy your data (config) files.

    This will also make it possible to publish bug fixes/updates much quicker.

    To update an existing installation:

    1. To get started, you will need to have git installed on your Pi. It is an easy install. In a terminal window type:

    sudo apt-get install git

    After a couple of seconds, you may be asked if you want to proceed, answer yes by typing y and the installation should finish in a minute or two.

    2. Rename your existing OSPi directory to something like OSPi-old:

    mv OSPi OSPi-old

    3. Clone the new OSPi directory from git hub:

    git clone https://github.com/Dan-in-CA/OSPi

    This will create a new directory named OSPi containing the latest program files.

    4. Copy your data (config) files from your old installation to the new one:

    cp -f ./OSPi-old/data/*.* ./OSPi/data/

    5. Reboot the Pi and you should now be running the latest update with your old settings intact.

    You can tell if you are running the latest update if you see the CPU Temp: just below Device Time: on the home page of the web interface.
    Or if you go to the Programs page, you should see a new “Run now” button below each program.

    Here is the list of changes from the README:
    * August 25 2013
    Additions, bug fixes:
    1. Implemented improved installation and update methods using GitHub.
    2. Modified the program to automatically create default config files on new installations. This also prevents existing settings from being overwritten.
    3. Added a “Run now” button to the programs page. Allows a schedule program to be started at any time. This overrides (stops) any running program.
    4. Added a readout of the Raspberry Pi’s CPU temperature to the home page.
    5. Fixed a bug that would allow a station to be stopped / started without a password using the HTML API.
    6. Fixed a bug that would display an incorrect start day for a schedule program.

    Files that were modified in this update are:
    ospi.py
    /static/scripts/java/svc1.8.3/home.js
    /static/scripts/java/svc1.8.3/viewprog.js

    #25434

    djagerif
    Participant

    Thanks, it works like a charm.

    PS.If you have any changes in ospi_addon.py then it will be overwritten, remember to copy this file back as well.

    Dan, Is there way to select between C and F for the CPU temperature and have the setting saved somewhere?

    Ingo

    #25435

    Dan in CA
    Participant

    Hi Ingo,

    I knew the question of choosing between C and F for the temperature display would come up. I have given it some thought but not come with a final solution yet. The obvious plan would be to add a switch on the Options page but that list is getting pretty long.
    Maybe we could reduce the line spacing and squeeze it in without pushing things off the bottom of the page.

    Dan

    #25436

    djagerif
    Participant

    I don’t know how the web stuff works but I would just click on F and it toggles to C and vice versa. Saving it is a different story.

    How about a cookie or something that remembers you preference?

    Ingo

    #25437

    Dan in CA
    Participant

    An interesting idea. Let me give it some thought.

    I need to update the installation instructions on the wiki before anything else.

    Dan

    #25438

    kkpwrh2o
    Member

    Dan,

    Followed your steps and code to the letter…(via SSH) worked like a charm!!! Thank you for making it so straightforward.

    My one program stayed intact and I am running it as I type this post using the new “Run Now” feature. Love the new feature.

    Now the challenge…for some reason I have yet to be able to have the very program that runs fine manually (and is running as I type this) run at the programmed time automatically. I am hoping I will wake up tomorrow AM to the sound of the sprinklers running the automatic program at the appointed time as a result of the update.

    I’ll advise with a followup post.

    Thanks again,
    Kevin

    #25439

    Dan in CA
    Participant

    Kevin,

    Things to check:
    Make sure the “Device time” shown on the home page is correct for your area.
    If not, check the time zone setting on the Options page.
    If the time zone setting is right but the Device time is not correct, you may need to set the time zone in the Raspberry Pi setup:
    Use raspi-config to open the config menu.

    If the time is correct as shown on the home page, Your program should be on schedule. You can click the “program preview” button on the home page to verify if things are set to go when you expect.

    Dan

    #25440

    kkpwrh2o
    Member

    Dan,

    Thanks for the info.

    Checked all those items after your similar advice on another post. RPi time and schedule time preview etc all match.

    Hopefully it will work ok in the AM. If not I have screen shots I will share that should shed some light on the anomaly.

    BTW, love the RPi temp feature too.

    Thanks,
    Kevin

    #25441

    kkpwrh2o
    Member

    Update

    Dan,

    My program ran last night 5 hour early automatically….(That is progress)

    Given my GMT is -5, I tried an experiment and reprogrammed the Interval timer for a start time 5 hours ahead of the current time. Wa la! The sprinklers ran at the time I set them to run.

    I went back and double checked the time settings. They all seemed fine in the Interval timer and on Samer’s web app. However knowing I was off the exact amount of my GMT differential, I went into the RPi via SSH using the following:

    sudo raspi-config

    Then selected 4 Internationalisation Options and I2 Change Timezone to set my time zone to US and then Central.

    Saved that in the RPi and programmed the sprinklers for current local time and they came on at the correct time as programmed!!

    So we have this issue fixed!
    Thanks for the help!
    Kevin

    However, ran into this issue when trying to change the GMT offset during my experimenting. See next post.

    #25442

    kkpwrh2o
    Member

    As mentioned in the previous post, I ran into this issue when I tried to change the GMT

     at /co
    '16' is not in list

    Python /home/pi/OSPi/ospi.py in GET, line 567
    Web GET http://10.0.1.21:8080/co
    Traceback (innermost first)

    /home/pi/OSPi/ospi.py in GET
    oidx = onumlst.index(key[1:]) ...
    ▶ Local vars
    /home/pi/OSPi/web/application.py in handle_class
    return tocall(*args) ...
    ▶ Local vars
    /home/pi/OSPi/web/application.py in _delegate
    return handle_class(cls) ...
    ▶ Local vars
    /home/pi/OSPi/web/application.py in handle
    return self._delegate(fn, self.fvars, args) ...
    ▶ Local vars
    /home/pi/OSPi/web/application.py in process
    return self.handle() ...
    ▶ Local vars
    Request information

    INPUT
    Variable Value
    cpw
    ''
    htp
    '80'
    loc
    '63368'
    mas
    '6'
    npw
    ''
    o1
    '32'
    o12
    '80'
    o13
    '0'
    o15
    '0'
    o16
    'on'
    o17
    '0'
    o18
    '6'
    o19
    '0'
    o20
    '0'
    o22
    'on'
    o23
    '100'
    th
    '-4'
    tq
    '00'
    COOKIES
    No data.
    META
    Variable Value
    app_stack
    []
    fullpath
    u'/co?o1=32&th=-4&tq=00&o12=80&o13=0&htp=80&o15=0&o16=on&o17=0&o18=6&mas=6&o19=0&o20=0&o22=on&o23=100&loc=63368&npw=&cpw='
    headers
    []
    home
    u'http://10.0.1.21:8080'
    homedomain
    u'http://10.0.1.21:8080'
    homepath
    u''
    host
    u'10.0.1.21:8080'
    ip
    u'10.0.1.51'
    method
    u'GET'
    output
    u''
    path
    u'/co'
    protocol
    u'http'
    query
    u'?o1=32&th=-4&tq=00&o12=80&o13=0&htp=80&o15=0&o16=on&o17=0&o18=6&mas=6&o19=0&o20=0&o22=on&o23=100&loc=63368&npw=&cpw='
    realhome
    u'http://10.0.1.21:8080'
    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'
    HTTP_CONNECTION
    'keep-alive'
    HTTP_HOST
    '10.0.1.21:8080'
    HTTP_REFERER
    'http://10.0.1.21:8080/vo'
    HTTP_USER_AGENT
    'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/536.30.1 (KHTML, like Gecko) Version/6.0.5 Safari/536.30.1'
    PATH_INFO
    '/co'
    QUERY_STRING
    'o1=32&th=-4&tq=00&o12=80&o13=0&htp=80&o15=0&o16=on&o17=0&o18=6&mas=6&o19=0&o20=0&o22=on&o23=100&loc=63368&npw=&cpw='
    REMOTE_ADDR
    '10xxxxxx
    REMOTE_PORT
    'xxxxx'
    REQUEST_METHOD
    'GET'
    REQUEST_URI
    '/co?o1=32&th=-4&tq=00&o12=80&o13=0&htp=80&o15=0&o16=on&o17=0&o18=6&mas=6&o19=0&o20=0&o22=on&o23=100&loc=63368&npw=&cpw='
    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 0xb6d5b0d0>
    wsgi.input

    wsgi.multiprocess
    False
    wsgi.multithread
    True
    wsgi.run_once
    False
    wsgi.url_scheme
    'http'
    wsgi.version
    (1, 0)
    You're seeing this error because you have web.config.debug set to True. Set that to False if you don't want to see this.

    The GMT offset of -5 is what I need, but I am wondering about the resulting error page above?

    Thanks,
    Kevin

    #25443

    Dan in CA
    Participant

    Hi Kevin,

    Glad your program is behaving better now.

    About the error message:
    Looks like you found a bug that resulted from adding the sequential/concurrent option. It looks like the options.txt file in the /data directory is out of sync with the program.

    It probably resulted when you copied the files from the older version of the program to the new data directory.
    I’ll check the code and add a fix.

    Dan

    #25444

    craigmw
    Participant

    Dan:

    This looks great! I was able to read the temps on my two OSPi units today. It peaked at about 90F here in OC today, and my OSPi in the backyard was reading about 148F! It is mounted in a weatherproof Orbit enclosure, which seems to get pretty warm. The second one mounted in our garage was running about 140, so not much cooler. I guess these can really take the heat… at least I hope so. All is fine so far, with no lockups. I guess we’ll see how things go if the temps go up much higher.

    #25446

    Dan in CA
    Participant

    Craig,

    I can’t take the credit for the temperature readout. The code was posted by doczaius:
    http://rayshobby.net/phpBB3/viewtopic.php?f=28&t=232
    He said it was his first attempt at Python programming and it works great.

    I didn’t even know the Pi could do that until I read his post.

    One of the things I love about open source programming is the exchange of ideas. I am learning a ton from working on this project.

    Dan

    #25447

    kkpwrh2o
    Member

    Craig,

    Thanks for the benchmark on your temp. My RPi is located in the previous sprinkler controller box inside a west facing garage. It was up to 154F the other day. I opened the box and it dropped to 145F.

    Regards,
    Kevin

    #25448

    Dan in CA
    Participant

    Just an FYI from the Raspberry Pi FAQ:

    What is the usable temperature range?

    The Raspberry Pi is built from commercial chips which are qualified to different temperature ranges; the LAN9512 is specified by the manufacturers being qualified from 0°C to 70°C, while the AP is qualified from -40°C to 85°C. You may well find that the board will work outside those temperatures, but we’re not qualifying the board itself to these extremes.

    70°C = 158°F
    85°C = 185°F

    Dan

    #25445

    kenbob
    Member

    Hi Dan,

    I have noticed that the interval portion of the program seems to be buggy. I have it set for 2 Days and the Starting In is set to 0, but it will show the next day and run then. If the Starting In is set for 1 day it shows that same day and runs. If I let it run so it will count down to 0 then it will show the next day as running, when that day comes. I installed it as a fresh install and followed your directions. Can you check to see if you are getting the same issue. Thank You.

    #25449

    Dan in CA
    Participant

    Kenbob,

    I have set up some test programs as you described. I’ll see how it goes and get back to you when I have some results.

    Dan

    #25450

    dennyfmn
    Participant

    Dan,

    Thanks for the update, the installation went very smoothly.

    If you have been doing logging you can copy the old log file to the new directory so you don’t loose your history. For my installation it is:


    cp -p /usr/local/OSPi-183.local/static/log/water_log.csv /usr/local/OSPi/static/log/

    Adjust the paths for your local setup.

    #25451

    dennyfmn
    Participant

    Hi Dan,

    I think that distributing the Interval program via git is a great thing. I’m trying to get my head around the process of keeping current with the master repository, but also maintaining local changes. As you know, I’ve been working on integrating garage door control/monitoring and rain sensor input into Interval.

    I have been manually generating a couple of patch files for ospi.py and home.js, the only two files I’ve changed so far.

    Do you have any suggestions about how to handle keeping current and maintaining local changes using git?

    Thanks!

    Denny

    #25452

    kkpwrh2o
    Member

    Denny,

    Now that I finally have my system running smoothly (and automatically) my next step is to add the garage door open/close/status/rain sensor mod.

    Being able to perform Interval Program updates without redoing the garage door code each time will be a welcome addition.

    Hoping Dan , you, and our forum wizards can make some more magic in this area.

    Meanwhile I’ll get started on the hardware portion of the mod.

    Regards,
    Kevin

    #25453

    kenbob
    Member

    @Dan in CA wrote:

    Kenbob,

    I have set up some test programs as you described. I’ll see how it goes and get back to you when I have some results.

    Dan

    After playing around with the time on the Pi I noticed that the change happens at 17:00 hours, it show the correct running time before 17:00 hours and then it shows the next day after 17:00 hours. It seems to be the opposite issue as last time. My watering schedule starts at 22:00 hours for a duration of 12 minutes on each station.

    It has to do with the timezone on the interval program. It looks like it is not syncing with the Pi.

    #25454

    Dan in CA
    Participant

    Kenbob,

    You are right!
    Part of the program has been using the TZ setting from the Options page and part of the program has been using the TZ setting from the Pi.

    This has caused problems for several users if the Pi’s TZ setting is not correct. You can check the setting on the Pi by running the command

    date +%Z

    This will return the 3 letter code for the time zone the Pi is set for.

    I have modified the program to use only the TZ setting from the Options page. I will push an update to GitHub latter today as soon as I make one more small tweak.

    Dan

    #25455

    kenbob
    Member

    After running date +%Z I am showing PDT (Pacific Daylight Time). I am in SoCal so it looks good.

    #25456

    Dan in CA
    Participant

    kenbob,

    The tests I ran worked as expected.

    I have posted the updated version of the program. See:
    viewtopic.php?f=28&t=329

    Let me know if you are still having a timing problem after the update.

    Dan

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

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Python interval program update 8/25/13