Corretto problema che faceva chiudere le elttrovalvole in caso di pioggia anche se erano state aperte in modalità 'force'
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
## 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
|
## 0.2.1 - 22/04/2017
|
||||||
Add installation instructions in README.md file
|
Add installation instructions in README.md file
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
## piGarden
|
# piGarden
|
||||||
|
|
||||||
Bash script to manage an irrigation system built with a Raspberry Pi
|
Bash script to manage an irrigation system built with a Raspberry Pi
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ Documentation of piGarden and build system irrigation with Raspberry Pi can be f
|
|||||||
|
|
||||||
This script is open-sourced software under GNU GENERAL PUBLIC LICENSE Version 2
|
This script is open-sourced software under GNU GENERAL PUBLIC LICENSE Version 2
|
||||||
|
|
||||||
## Installagtion
|
## Installation
|
||||||
|
|
||||||
1) Installs the necessary packages on your terminal:
|
1) Installs the necessary packages on your terminal:
|
||||||
|
|
||||||
|
|||||||
26
piGarden.sh
26
piGarden.sh
@@ -89,10 +89,14 @@ function ev_open {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local state=1
|
||||||
|
if [ "$2" = "force" ]; then
|
||||||
|
state=2
|
||||||
|
fi
|
||||||
|
|
||||||
log_write "Solenoid '$1' open"
|
log_write "Solenoid '$1' open"
|
||||||
message_write "success" "Solenoid open"
|
message_write "success" "Solenoid open"
|
||||||
supply_positive
|
supply_positive
|
||||||
#gpio_alias2number $1
|
|
||||||
ev_alias2number $1
|
ev_alias2number $1
|
||||||
EVNUM=$?
|
EVNUM=$?
|
||||||
ev_number2gpio $EVNUM
|
ev_number2gpio $EVNUM
|
||||||
@@ -100,7 +104,7 @@ function ev_open {
|
|||||||
$GPIO -g write $g $RELE_GPIO_CLOSE
|
$GPIO -g write $g $RELE_GPIO_CLOSE
|
||||||
sleep 1
|
sleep 1
|
||||||
$GPIO -g write $g $RELE_GPIO_OPEN
|
$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
|
ev_status $al
|
||||||
local state=$?
|
local state=$?
|
||||||
#echo "$al = $state"
|
#echo "$al = $state"
|
||||||
if [[ "$state" = "1" || "$1" = "force" ]]; then
|
if [[ "$state" -gt "0" || "$1" = "force" ]]; then
|
||||||
ev_close $al
|
ev_close $al
|
||||||
log_write "close_all - Close solenoid '$al' for rain"
|
log_write "close_all - Close solenoid '$al' for rain"
|
||||||
fi
|
fi
|
||||||
@@ -932,6 +936,7 @@ function show_usage {
|
|||||||
echo -e "Usage:"
|
echo -e "Usage:"
|
||||||
echo -e "\t$NAME_SCRIPT init initialize supply and solenoid in closed state"
|
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 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 close alias close a solenoid"
|
||||||
echo -e "\t$NAME_SCRIPT list_alias view list of aliases solenoid"
|
echo -e "\t$NAME_SCRIPT list_alias view list of aliases solenoid"
|
||||||
echo -e "\t$NAME_SCRIPT ev_status alias show status solenoid"
|
echo -e "\t$NAME_SCRIPT ev_status alias show status solenoid"
|
||||||
@@ -1194,10 +1199,25 @@ case "$1" in
|
|||||||
open)
|
open)
|
||||||
if [ "empty$2" == "empty" ]; then
|
if [ "empty$2" == "empty" ]; then
|
||||||
echo -e "Alias solenoid not specified"
|
echo -e "Alias solenoid not specified"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
ev_open $2 $3
|
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)
|
close)
|
||||||
if [ "empty$2" == "empty" ]; then
|
if [ "empty$2" == "empty" ]; then
|
||||||
echo -e "Alias solenoid not specified"
|
echo -e "Alias solenoid not specified"
|
||||||
|
|||||||
Reference in New Issue
Block a user