OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Raspi as Wifi Bridge, Logger and Web Server

This topic contains 3 replies, has 0 voices, and was last updated by  Dan in CA 6 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22474

    kenbob
    Member

    I have been using my Raspberry Pi with my Opensprinkler V1.2U for over a month now and it has been working out very nicely.

    Since I had no network connection in my garage I bridged the LAN to the USB wifi adapter on the Pi and it acts as a wireless adapter. Both my Opensprinkler and Pi are configured with static IP addresses.

    I modified the code on the Opensprinkler to point to the Raspi that hosts the Javascript files (Thanks to Ray for the Mint Linux Image with the Arduino software). Now I do not need to be connected to the internet to use the web interface.

    I also installed the logging python scripts zonecheck.py. I had to make a few changes and do some error catching to get it not to crash, because it would only run for a short period of time and then hang up. I found out that once it would lose connection with the Opensprinkler that is when it would lock up the script.

    I love this product, the price and the flexibility. It sure beats my old Orbit POS controller.

    #24482

    Ray
    Keymaster

    Cool, thanks for sharing. At the Maker Faire this year we used the same setup: OpenSprinkler with RPi to serve javascripts. There is no reliable Internet connection at the Maker Faire, so this worked out very nicely and I was able to demonstrate all the features of the firmware.

    #24483

    Dan in CA
    Participant

    That’s really cool!

    I was wondering if you could share the changes you made to the zonecheck.py scripts. I wrote that a while back when I was just getting started with Python programming and did not include any error checking. I’m sure your updates would be useful for other users as well.

    Dan

    #24484

    kenbob
    Member

    I do not have much programming experience, but just enough to get the job done. So please don’t laugh. 😀

    I added a timeout when it opens the URL for the opensprinkler and an exception in case it cannot connect with it at all. If it errors out it goes directly to the top of Main() after 1 second. I spent days trying to figure out why it would lock up, until I started debugging it. I also removed most everything under (if __name__ == “__main__”:), because I was getting errors. Otherwise it gets the job done.

    When I go to the Raspi URL it automatically redirects to the Sprinklers.php and shows me the logs. I love the fact that it shows me the entire schedule for the week.

    from urllib2 import Request, urlopen, URLError
    req = Request (“http://10.0.0.11/sn0”)

    try:
    state = urlopen(req, timeout = 2).read()
    except Exception:
    time.sleep(1)
    pass
    main()

    #24485

    Dan in CA
    Participant

    Thanks for sharing Kenbob.

    No need to apologize for your programming experience. You are figuring things out, tweaking the code to make it do what you want and hopefully having some fun along the way. That’s what counts.

    I have downloaded the zonecheck.zip file and will check it out. The Sprinklers.php was written by David B. Gustovson and I am not that familiar with PHP.

    I’m sure your efforts on this will be helpful to others.

    Thanks again.

    Dan

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

OpenSprinkler Forums Hardware Questions OpenSprinkler Pi (OSPi) Raspi as Wifi Bridge, Logger and Web Server