An improved Python port of the Arduino based OpenSprinkler firmware, originally based on V 1.8.3. This is an updated version of OpenSprinkler Pi started by Dan Kimberling making better use of the power of Python.
OpenSprinkler Pi (ospi) Interval Program Demo
GNU GPL License
July 2014
(Dan)
- Added Plugin Manager plugin
- Updated System Updater plugin
- Added help button linked to repository wiki
- Moved plugins to new repository
- Includes Spanish and French translations and related bug fixes
(Dan)
- Added multiple language support
- Updated timezone handling
- Added software RESTART button under System Restart on Options page
(Dan)
Incorporated changes that had taken place on Rimnco's GitHub fork into Dan's OSPi repository.
(Rimco, Martin Pihrt)
Changes:
- Added new functions in helpers.py: reboot, poweroff, restart, uptime and getIP.
- Added new plugins:
- System update (Rimco: Checked, tested and improved.)
- Email (Rimco: Checked, tested and improved.)
- SMS (Rimco: Globally checked and reformatted, not tested.)
- LCD (Rimco: Globally checked and reformatted, not tested.)
- Pressure Monitor (Rimco: Globally checked and reformatted, not tested.)
- PCF8591 A/D converter read-out (Rimco: Globally checked and reformatted, not tested.)
- System update (Rimco: Checked, tested and improved.)
- Added pylcd2 library in /plugins for LCD plug-in.
(Rimco, Dan, Samer Albahra and Andrew Radke)
Changes:
- Fixed plugin executable bits
- Removed all old txt reading functions
- Improved mobile app interface
- Fixed timeline display errors.
- Improved version numbering (partially automatic)
- Added @media CSS extension
(Rimco and Dan)
Changes:
- Improved weather level adjustment robustness, error logging and data removal.
- Added on-off buttons to program page
- Moved station names to JSON file
- Moved options section to gv.py
(Rimco)
Changes:
- Split contents of the original ospi.py file into blocks that are more logical. (Should be improved even more.)
- Removed numerous bugs regarding undeclared variables, unreachable code and misinterpretation of python classes. Tried to use python standards as much as possible.
- Improved the way that plug-ins can adjust the water level. Each plug-in can now provide a water level adjustment which are combined by the main program.
- Introduced template inheritance to solve many web-page inconsistencies and code duplication.
- Fixed security issues where login-credentials were not checked. Introduced a ProtectedPage class as base class to be used for each page that should only be reachable if logged in.
- Removed unused code, reduced code duplication.
- Removed gv class (was not used at all) and put all global variables in the gv module itself.
- Improved exception handling.
- Because of the introduced template inheritance, plug-ins are now also using the same base template and are integrated better.
- Improved page load speeds.
- Added new weather-based water level adjustment plug-in that can change the water level depending on the history+forecast. This plug-in caches the queries made to WUnderground to reduce the number of queries, but a clean-up action needs to be added.
- Removed files that should not committed to GitHub.
- Removed APScheduler dependency.
(Dan)
Changes:
- Fixed reported bugs in the Home page irrigation timeline.
- Fixed a bug that caused a momentary power pulse to stations during a cold boot.
- Added error checking to Programs page to try and fix "server error".
(Dan)
Changes:
- A fix for the irrigation timeline on the Home page
- The addidion of a "Plugins" button to the Home page
(Dan)
Changes:
Software version 2.0
Jonathan Marsh's UI is now default under the master branch.
A version based on the original UI derived from OpenSprinkler firmware 1.8.3 is still available under the branch named "firmware_based.
This revision also includes several bug fixes.
(Dan)
Changes, bug fixes:
- Program now explicitly sets all valves to off at startup. Fixes a bug that sometimes valves were on at program load.
- Fixed a bug that could freeze the program under certain conditions if a station name was blank.
- Changing station names would not be updated properly - Fixed.
- Changed how ospi.py handles time and date. Changes such as to or from daylight time are now automatic. Time zone setting it options no longer has an effect.
- Plugins must now have group permission set to executable in order to load. Allows plugins to be selectively enabled/disabled.
- Removed deprecated "ospi_addon.py" file from program directory.
(Dan)
New plugin architecture including a plugin to support Samer's new JavaScript app
(Dan)
Added support for Rain sensor and partial support for relay on OSPi Rev. 1.3.
(Dan)
Modified program to run on either OSPi or OSBo
(Dan)
Additions, bug fixes:
- Fixed a bug that would cause an error in program preview when a master was enabled.
- Changing to manual mode would clear rain delay setting, Setting rain delay in manual mode would switch to program mode - fixed.
(Dan)
Additions, bug fixes:
- Fixed a bug that would cause an error when a master was enabled and making changes to station settings.
- added approve_pwd function and removed redundant code.
- removed write_options function and added options.txt file to distribution.
(jonathanmarsh)
Additions, bug fixes:
- Improved options handling and passing logic
- Added a "System Name" option to help users distinguish between multiple systems
- Configurable station name length (increased default to 32)
- Added logging options to options page
(Dan)
Additions, bug fixes:
- Moved RasPi specific code into try-except blocks allowing program to run on multiple platforms
- Added "write_options" function to create/update new style options.txt file in data directory.
- Fixed a bug in new options code that prevented master station from being selected.
- Fixed a bug that caused an exception when the number of expansion boards was reduced.
Changes:
- Changed the pin numbering option in the RPi.GPIO module from BCM to BOARD.
Additions, bug fixes:
- Added a new revisions page to the native web interface.
- Modified the home.js file to show time zone info in the last run log near the bottom of the page.
- Fixed a bug in concurrent mode that kept a station running after it's duration had expired.
- Fixed a bug that would cause an exception (freeze the program) after the number of expansion boards was changed in Options.
- Fixed a bug that would stop a running station and clear scheduled stations when the number of expansion boards was changed in Options.
Additions, bug fixes:
- Added a per-station "Ignore rain" option that allows a station to operate during rain delay or if a rain sensor detects rain.
- Modified the program to use the HTTP port setting from the Options page.
- Improved the way the program tracks current time. This simplified the code and should eliminate some timing bugs.
- Edited Denny's init.d startup script to remove IP address and port settings no longer needed.
Additions, bug fixes:
- Modified the program to use only the time zone setting from the Options page and not the tz setting from the py.
- Made the CPU temperature readout on the home page clickable to toggle between C and F.
- Added a copy of Denny Fox's init.d auto startup script
Additions, bug fixes:
- Implemented improved installation and update methods using GitHub.
- Modified the program to automatically create default config files on new installations. This also prevents existing settings from being overwritten.
- 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.
- Added a readout of the Raspberry Pi's CPU temperature to the home page.
- Fixed a bug that would allow a station to be stopped / started without a password ueing the HTML API.
- Fixed a bug that would display an incorrect start day for a schedule program.
Now supports concurrent operation.
Additions, bug fixes:
- Added Sequential/Concurrent option.
- Added a function to detect Pi board rev and auto-configure GPIO pins for rev 1 boards.
- Fixed a bug in manual mode that would cause any zone with a master association to stop the master when turned off, even if another station with a master association was still running.
- Changed how ospi.py handles master zone associations. The program should now work with more than 3 expansion boards (untested in hardware but at least 5 expansion boards, 64 stations work in software).
Bug fixes:
- Fixed a bug that kept an in progress program running after it was disabled.
- Added error checking to prevent an 'lg' KeyError
- When a new program was added, it became program 1 instead of being added at the end of the list. - fixed.
- When Rain Delay was set, running stations did not stop. - Fixed.
- Added a 1.5s delay in the screen refresh of manual Mode to allow active stations and last run log time to update.
Code re-factored:
- Eliminated over 100 lines of redundant code. The code is now much closer to the micro-controller version. Manual Mode and Run-once now rely on the main loop algorithm. This eliminates potential conflicts and makes the code easier to maintain. The program should now be more stable and have fewer bugs although the UI is a little slower.
- Changed bit-wise operations to make them more reliable.
- Station names now accept Unicode characters allowing names to be entered in any language.
- Faveicon now appears on all pages.
- A small bug in the display of Master valve off time in the program preview has been fixed. The off time was 1 minute short.
- A file named 'sd_reference.txt' has been added to the OSPi directory. It contains a list with descriptions of the values contained in the global settings dictionary variable (gv.sd) which holds most settings for the program. These values are kept in memory and also stored in the file OSPi/data/sd.json to persist across system restarts. This is for the benefit of anyone who wishes to tinker with the code.
It is recommended to re-install the entire OSPi directory from GitHub. You can keep your current settings by saving the contents of the OSPi/data directory to another location before installation, then replace the contents of the newly installed directory with your saved files.
Bug fixes and additions:
- Fixed a bug that prevented zones 9+ from running.
- The Run once program was not observing the station delay setting - Fixed
- Made the sd variable an attribute of the gv module. All references to sd... are now gv.sd... This should potentially fix several bugs, Specifically the Rain delay seems to be working properly now.
- The Graph Programs time marker was not recognizing the time zone setting from the Options page - fixed.
- Time displayed on the last run line of the main page was not correct - fixed.
- Added a faveicon which will help distinguish the OpenSprinkler tabs on the browser.
- Added an import statement and file which provide a stub for adding user written custom functions to the interval program without modifying the program itself.
- Last run logging is now working for manual mode when an optional time value is selected, even if more that one station is started.
- Fixed a bug that prevented the home page display from updating when running irrigation programs.
- Includes a fix from Samer that allows the program preview time marker to update properly.
This update includes:
- Changed the way ospi.py handles time. It now uses the time zone setting from the OS options page. It also eliminates the auto daylight savings time adjustment that was causing problems for some users.
- Fixes a bug mentioned on the forum that caused Samer's app to not update in program mode.
- Fixes a bug that caused a program to re-start after the "Stop all stations" button was clicked.
- A partial fix for the "last run" problems. Still need to get manual mode with an optional time setting working.
- Added a docstring at the top of the ospi.py file with the date for version tracking.
Applied Samer Albahra's patch so that the program will work with Samer's mobile web app.
Per forum discussion: http://rayshobby.net/phpBB3/viewtopic.php?f=2&t=154&start=40#p781
This folder contains a fork of OpenSprinkler Pi written by Dan Kimberling using Python as it should be used. It is largly compatible with the microcontroller-based OpenSprinkler firmware 1.8, the instructions of which can be found at:
http://rayshobby.net/?page_id=730
The program makes use of web.py (http://webpy.org/) for the web interface.
Full credit goes to Dan for his generous contributions in porting the microcontroller firmware to Python.
================================================================
Installation and set up
For complete and up-to-date installation and set up instructions, see the Rays Hobby wiki page at: http://rayshobby.net/mediawiki/index.php?title=Python_Interval_Program_for_OSPi