aggiunto api per eseguire la chiusura di tutte le zone e per la disabilitare tutte le schdulazioni

This commit is contained in:
lejubila
2017-09-10 02:16:01 +02:00
parent fcbfa3cd32
commit 59b27365ed
3 changed files with 84 additions and 0 deletions

View File

@@ -1,6 +1,7 @@
## 0.4.5 - xx/08/2017
- Implemented driver subsystem for interfacing with other board
- Added driver spb16ch for interfacing with "Smart Power Board 16 channel with RTC"
- Added socket server api for close all zones and disable all scheduling
- Fix problem with cron management on similar type cron
- Fix bug: in case of rain the weather data were not updated

View File

@@ -486,4 +486,78 @@ function del_cron_close {
}
#
# Disabilita tutte le schedulazioni di apertura e chiusura elettrovalvole
#
function cron_disable_all_open_close {
local a=""
local al=""
local cron=""
#
# Disabilita tutte le schedulazioni di apertura
#
for i in $(seq $EV_TOTAL)
do
a=EV"$i"_ALIAS
al=${!a}
local crons=`get_cron_open $al`
if [[ ! -z "$crons" ]]; then
del_cron_open $al
IFS=$'\n' # make newlines the only separator
for cron in $crons
do
#echo "-- $cron --"
CRON_M=`echo $cron | $CUT -d' ' -f1,1`
CRON_H=`echo $cron | $CUT -d' ' -f2,2`
CRON_DOM=`echo $cron | $CUT -d' ' -f3,3`
CRON_MON=`echo $cron | $CUT -d' ' -f4,4`
CRON_DOW=`echo $cron | $CUT -d' ' -f5,5`
if [[ ${CRON_M:0:1} == "#" ]]; then
CRON_M=${CRON_M:1:${#CRON_M}}
fi
#echo "++ $CRON_M $CRON_H $CRON_DOM $CRON_MON $CRON_DOW ++"
add_cron_open $al "$CRON_M" "$CRON_H" "$CRON_DOM" "$CRON_MON" "$CRON_DOW" "disabled"
done
fi
done
#
# Disabilita tutte le schedulazioni di chiusura
#
for i in $(seq $EV_TOTAL)
do
a=EV"$i"_ALIAS
al=${!a}
local crons=`get_cron_close $al`
if [[ ! -z "$crons" ]]; then
del_cron_close $al
IFS=$'\n' # make newlines the only separator
for cron in $crons
do
#echo "-- $cron --"
CRON_M=`echo $cron | $CUT -d' ' -f1,1`
CRON_H=`echo $cron | $CUT -d' ' -f2,2`
CRON_DOM=`echo $cron | $CUT -d' ' -f3,3`
CRON_MON=`echo $cron | $CUT -d' ' -f4,4`
CRON_DOW=`echo $cron | $CUT -d' ' -f5,5`
if [[ ${CRON_M:0:1} == "#" ]]; then
CRON_M=${CRON_M:1:${#CRON_M}}
fi
#echo "++ $CRON_M $CRON_H $CRON_DOM $CRON_MON $CRON_DOW ++"
add_cron_close $al "$CRON_M" "$CRON_H" "$CRON_DOM" "$CRON_MON" "$CRON_DOW" "disabled"
done
fi
done
}

View File

@@ -93,6 +93,15 @@ function socket_server_command {
fi
;;
close_all)
if [ "$arg2" == "disable_scheduling" ]; then
cron_disable_all_open_close &> /dev/null
fi
close_all &> /dev/null
message_write "success" "All solenoid closed"
json_status
;;
set_general_cron)
local vret=""
for i in $arg2 $arg3 $arg4 $arg5 $arg6 $arg7