Open Sprinkler Python
OSPy is a free Raspberry Pi based Python 2.7 (no support for python 3 yet) program for controlling irrigation systems (sprinkler, drip, IoT, etc). This is my fork from Rimco/OSPy and Dan-in-CA/SIP with My modifications.
More information visit
Operating system (Debian >= 9) for Raspberry Pi
- Install latest operating system: "Raspbian Buster or next new version - with desktop and recommended software" https://www.raspberrypi.org/downloads/raspbian/
- Change password for acces from "raspberry" to own
- Enabling in raspi-config SSH, I²C
- Install OSPy using Git
A setup file has been provided to help you setting up your environment to contain all required packages. This setup also helps you in case you want to run the program as a service (on Raspbian). Go to the folder where the setup.py file is located (cd OSPy)
sudo apt-get update
and follow the procedures
sudo apt-get upgrade
and follow the procedures
sudo python setup.py install
and follow the procedures of the script
Preferred option (using Git)
(This option does support automatic updating.) Ensure git is installed (and the git executable is in your path) Use git to clone:
git clone -b master https://github.com/martinpihrt/OSPy
Next use step "Setup"
Manual OSPy-system update
Uusing Git, without system update plugin if plugin not work. Go to the folder where the run.py file is located (cd OSPy)
sudo git config core.filemode false
sudo git reset --hard
sudo git pull
Second option (without Git)
(This option does not support automatic updating.)
- Download a copy of the program from Github
- Extract the contents to a location of your choice
For enable SSL access in options (for HTTPS connections)
sudo apt-get install certbot
sudo certbot certonly --standalone -d your_domain_name
sudo certbot renew
sudo cp /etc/letsencrypt/live/your.domain.com/fullchain.pem /home/pi/OSPy/ssl
sudo cp /etc/letsencrypt/live/your.domain.com/privkey.pem /home/pi/OSPy/ssl
sudo service ospy restart
Notice: Before starting the certification service, make sure that you have correctly configured your NAT network router (redirecting external port 443 to Raspberry Pi's internal IP address 80 for certification service.) After the certificate is generated, it is necessary to route your port to the OSPy port in the router (the default OSPy port is 8080). The certification service is trying to use a connection using IP version 6. If we do not use IPV6 (we do not have a router set for IPV6, or do not want to use IPV6 for any other reason), we must disable the use of IPV6 addreses in Raspberry Pi!
sudo nano /etc/modprobe.d/ipv6.conf
Add to file.
alias net-pf-10 off options ipv6 disable_ipv6=1 blacklist ipv6
And next restart.
If "Use Own HTTPS access" is selected in OSPy options, file: fullchain.pem and privkey.pem must You insert to folder ssl in OSPy location. For manual generating certificate example:
sudo openssl req -new -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes -out fullchain.pem -keyout privkey.pem
Warning: OSPy must be next restarted.
For enable I²C device (I²C LCD plugin and more I²C plugins)
and follow enabling I²C bus
and reboot OS system
For translate OSPy to other language
The OSPy system is currently in three languages: English, Czech, Slovak. For other languages and step by step, how to use is typed in MD file Any user who joins the "OSPy" project is welcome! Translation of strings into other languages is not demanding (using the Poedit)
Changelog and Issues
Help with to user web Interfaces
Communication with other systems
OSPy can be controlled and monitored using HTTP GET commands. With the addition of available plugins OSPy can communicate with other systems via MQTT. OSPy can also issue Linux shell commands when a station is turned on or off. This is useful for controlling wireless remote devices and for I²C relay hats and boards. The Blinker package that is shipped with OSPy sends messages to other Python modules such as plugins to report changes in status. See the signaling examples file in OSPy's plugins folder for examples.
OSPy allows to read data from wireless sensors (ESP32, ESP8266...) Docs
Remote Controller for OSPy based on M5stick-C
This controller allows you to select a program stored in the OSPy on the LCD display and start it with the button. The controller is connected to the home Wi-Fi network. We do not even need a mobile phone or a computer to quickly select programs. We will use this miniature controller. Docs
OpenSprinkler Py (OSPy) Interval Program Creative Commons Attribution-ShareAlike 3.0 license
The program makes use of
- Webpy for the web interface.
- Python markdown2 to render the help and readme pages written in markdown.
- Pygments to provide syntax highlighting in the help pages.
- OpenStreetMap to convert locations into coordinates.
- Dark Sky API for weather information.
- Blinker package that is shipped with OSPy sends messages to other Python modules such as plugins to report changes in status.
- Arduino ESP32, Atmega328 and more HW boards pro OSPy aditional sensors, water tank monitor...