Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2fc1c04f3d | ||
|
|
ff608dc8d9 | ||
|
|
8b55f1526a |
@@ -1,3 +1,9 @@
|
||||
## 0.2.2 - 25/04/2017
|
||||
Fix bug: if it's reining, the solenoid valves were also closed even if they were pushed open in "force" mode
|
||||
|
||||
## 0.2.1 - 22/04/2017
|
||||
Add installation instructions in README.md file
|
||||
|
||||
## 0.2 (Easter egg) - 17/04/2017
|
||||
Implementation of socket server for communicate with piGardenWeb
|
||||
Implementation of messages (error, warning, success) passed to piGardenWeb
|
||||
|
||||
61
README.md
61
README.md
@@ -1,4 +1,4 @@
|
||||
## piGarden
|
||||
# piGarden
|
||||
|
||||
Bash script to manage an irrigation system built with a Raspberry Pi
|
||||
|
||||
@@ -9,3 +9,62 @@ Documentation of piGarden and build system irrigation with Raspberry Pi can be f
|
||||
## License
|
||||
|
||||
This script is open-sourced software under GNU GENERAL PUBLIC LICENSE Version 2
|
||||
|
||||
## Installation
|
||||
|
||||
1) Installs the necessary packages on your terminal:
|
||||
|
||||
``` bash
|
||||
sudo apt-get install git curl gzip grep sed ucspi-tcp
|
||||
```
|
||||
|
||||
2) Compile and install Jq (commandline JSON processor):
|
||||
|
||||
``` bash
|
||||
cd
|
||||
sudo apt-get install flex -y
|
||||
sudo apt-get install bison -y
|
||||
sudo apt-get install gcc -y
|
||||
sudo apt-get install make -y
|
||||
sudo apt-get install autotools -y
|
||||
sudo apt-get install dh-autoreconf -y
|
||||
wget https://github.com/stedolan/jq/releases/download/jq-1.5/jq-1.5.tar.gz
|
||||
tar xfvz jq-1.5.tar.gz
|
||||
cd jq-1.5
|
||||
autoreconf -i
|
||||
./configure --disable-maintainer-mode
|
||||
make
|
||||
sudo make install
|
||||
```
|
||||
|
||||
3) Compile and install gpio program from WiringPi package:
|
||||
|
||||
``` bash
|
||||
cd
|
||||
git clone git://git.drogon.net/wiringPi
|
||||
cd wiringPi
|
||||
git pull origin
|
||||
./build
|
||||
```
|
||||
|
||||
4) Download and install piGarden in your home
|
||||
|
||||
``` bash
|
||||
cd
|
||||
git clone https://github.com/lejubila/piGarden.git
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Copy configuration file in /etc
|
||||
|
||||
```bash
|
||||
cd
|
||||
sudo cp piGarden/conf/piGarden.conf.example /etc/piGarden.conf
|
||||
```
|
||||
|
||||
Customize the configuration file.
|
||||
For more information see
|
||||
[www.lejubila.net/2015/12/impianto-di-irrigazione-con-raspberry-pi-pigarden-lo-script-di-gestione-quinta-parte/](https://www.lejubila.net/2015/12/impianto-di-irrigazione-con-raspberry-pi-pigarden-lo-script-di-gestione-quinta-parte/)
|
||||
and
|
||||
[www.lejubila.net/2017/04/pigarden-0-2-easter-egg/](https://www.lejubila.net/2017/04/pigarden-0-2-easter-egg/)
|
||||
|
||||
26
piGarden.sh
26
piGarden.sh
@@ -89,10 +89,14 @@ function ev_open {
|
||||
fi
|
||||
fi
|
||||
|
||||
local state=1
|
||||
if [ "$2" = "force" ]; then
|
||||
state=2
|
||||
fi
|
||||
|
||||
log_write "Solenoid '$1' open"
|
||||
message_write "success" "Solenoid open"
|
||||
supply_positive
|
||||
#gpio_alias2number $1
|
||||
ev_alias2number $1
|
||||
EVNUM=$?
|
||||
ev_number2gpio $EVNUM
|
||||
@@ -100,7 +104,7 @@ function ev_open {
|
||||
$GPIO -g write $g $RELE_GPIO_CLOSE
|
||||
sleep 1
|
||||
$GPIO -g write $g $RELE_GPIO_OPEN
|
||||
ev_set_state $EVNUM 1
|
||||
ev_set_state $EVNUM $state
|
||||
}
|
||||
|
||||
#
|
||||
@@ -393,7 +397,7 @@ function close_all {
|
||||
ev_status $al
|
||||
local state=$?
|
||||
#echo "$al = $state"
|
||||
if [[ "$state" = "1" || "$1" = "force" ]]; then
|
||||
if [[ "$state" -gt "0" || "$1" = "force" ]]; then
|
||||
ev_close $al
|
||||
log_write "close_all - Close solenoid '$al' for rain"
|
||||
fi
|
||||
@@ -932,6 +936,7 @@ function show_usage {
|
||||
echo -e "Usage:"
|
||||
echo -e "\t$NAME_SCRIPT init initialize supply and solenoid in closed state"
|
||||
echo -e "\t$NAME_SCRIPT open alias [force] open a solenoid"
|
||||
#echo -e "\t$NAME_SCRIPT open_for time alias [force] open a solenoid for specified time (in minute)"
|
||||
echo -e "\t$NAME_SCRIPT close alias close a solenoid"
|
||||
echo -e "\t$NAME_SCRIPT list_alias view list of aliases solenoid"
|
||||
echo -e "\t$NAME_SCRIPT ev_status alias show status solenoid"
|
||||
@@ -1194,10 +1199,25 @@ case "$1" in
|
||||
open)
|
||||
if [ "empty$2" == "empty" ]; then
|
||||
echo -e "Alias solenoid not specified"
|
||||
exit 1
|
||||
fi
|
||||
ev_open $2 $3
|
||||
;;
|
||||
|
||||
open_for)
|
||||
re='^[0-9]+$'
|
||||
if ! [[ $2 =~ $re ]] ; then
|
||||
echo -e "Time of irrigation is wrong or not specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "empty$3" == "empty" ]; then
|
||||
echo -e "Alias solenoid not specified"
|
||||
exit 1
|
||||
fi
|
||||
ev_open $3 $4
|
||||
;;
|
||||
|
||||
close)
|
||||
if [ "empty$2" == "empty" ]; then
|
||||
echo -e "Alias solenoid not specified"
|
||||
|
||||
Reference in New Issue
Block a user