Compare commits
17 Commits
rainsensor
...
v0.5.14
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a125ff31d8 | ||
|
|
bb435f0ee6 | ||
|
|
b8daa7acab | ||
|
|
dd289f8b31 | ||
|
|
c527702c72 | ||
|
|
b6de96debe | ||
|
|
ea681816fe | ||
|
|
8ca698d4ee | ||
|
|
70943c5f5e | ||
|
|
aa9799cdaf | ||
|
|
6d4f522f21 | ||
|
|
51e4391237 | ||
|
|
aa12f5a8a5 | ||
|
|
9d9ef42679 | ||
|
|
70c4e063f8 | ||
|
|
4d4b35c3cc | ||
|
|
71e91cc861 |
14
CHANGELOG.md
14
CHANGELOG.md
@@ -1,3 +1,17 @@
|
|||||||
|
# 0.5.14 - 24/09/2019
|
||||||
|
- Updated rainsensorqty driver to version 0.2.3
|
||||||
|
- Added api and command for manage piGardenSched scheduling
|
||||||
|
|
||||||
|
# 0.5.13 - 12/08/2019
|
||||||
|
- Added driver rainsensorqty for menage rainfall detection based on quantity
|
||||||
|
|
||||||
|
# 0.5.12.1 - 23/06/2019
|
||||||
|
- Added zip log drver file when exceeding the size limit
|
||||||
|
|
||||||
|
# 0.5.12 - 13/11/2018
|
||||||
|
- Fixed a bug that prevented the publication of the mqtt topic for each event
|
||||||
|
- Fixed a bug on openweathermap driver which in some cases causes a malformation of the json status and prevented communication with piGardenWeb
|
||||||
|
|
||||||
# 0.5.11 - 11/11/2018
|
# 0.5.11 - 11/11/2018
|
||||||
- Added ability to disable online weather service by defining WEATHER_SERVICE="none" in the configuration file
|
- Added ability to disable online weather service by defining WEATHER_SERVICE="none" in the configuration file
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ STAT="/usr/bin/stat"
|
|||||||
# # Installare con apt install mosquitto-clients
|
# # Installare con apt install mosquitto-clients
|
||||||
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
|
||||||
|
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
|
||||||
|
|
||||||
|
|
||||||
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
|
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ STAT="/usr/bin/stat"
|
|||||||
# # Installare con apt install mosquitto-clients
|
# # Installare con apt install mosquitto-clients
|
||||||
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
|
||||||
|
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
|
||||||
|
|
||||||
|
|
||||||
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
|
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
|
||||||
@@ -79,15 +82,18 @@ RELE_GPIO_CLOSE=0
|
|||||||
RELE_GPIO_OPEN=1
|
RELE_GPIO_OPEN=1
|
||||||
|
|
||||||
# Id del gpio usato per collegare il sensore di rilevamento pioggia
|
# Id del gpio usato per collegare il sensore di rilevamento pioggia
|
||||||
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
|
# attraverso il driver rainsensorqty
|
||||||
|
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
|
||||||
|
|
||||||
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
|
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
|
||||||
|
# variabile usata anche da drv:rainsensorqty, se e' a 1, significa che il reed contact e' collegato ad un circuito pull-down, vuol dire che attende l'impulso a 1 per contare le vaschette, normalmente e' a 0.
|
||||||
|
# se e' a 0, significa che il reed contact e' collegato ad un circuito pull-up, vuol dire che attende l'impulso a 0 per contare le vaschette, normalmente e' a 0.
|
||||||
RAIN_GPIO_STATE=0
|
RAIN_GPIO_STATE=0
|
||||||
|
|
||||||
|
RAINSENSORQTY_LOOPSFORSETRAINING=16 # dopo 16 impulsi, 16 vaschette riempite si considera pioggia
|
||||||
|
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 ore si resetta il numero di vaschette riempire e solo dopo un nuovo ciclo di riempimento si considera una nuova pioggia
|
||||||
|
|
||||||
RAINSENSORQTY_LOOPSFORSETRAINING=10 # dopo 10 impulsi, 10 vaschette riempite si considera pioggia
|
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details
|
||||||
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 si resetta il numero di vaschette da riempire e solo dopo il riempimento del numero di vaschette si considera una nuova pioggia
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ STAT="/usr/bin/stat"
|
|||||||
# Installare con apt install mosquitto-clients
|
# Installare con apt install mosquitto-clients
|
||||||
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
|
||||||
|
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
|
||||||
|
|
||||||
|
|
||||||
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ STAT="/usr/bin/stat"
|
|||||||
# # Installare con apt install mosquitto-clients
|
# # Installare con apt install mosquitto-clients
|
||||||
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
|
||||||
|
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
|
||||||
|
|
||||||
|
|
||||||
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
||||||
|
|||||||
@@ -57,6 +57,9 @@ STAT="/usr/bin/stat"
|
|||||||
# Installare con apt install mosquitto-clients
|
# Installare con apt install mosquitto-clients
|
||||||
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
# Percorso di piGardenSched, se non definito non verranno gestire le schedulazioni di piGardenSched tramite api
|
||||||
|
#PIGARDENSCHED_PATH="/home/pi/piGardenSched/piGardenSched.sh"
|
||||||
|
|
||||||
|
|
||||||
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
# se impostato a 0 il sistema gestirà elettrovalvole bisstabili
|
||||||
|
|||||||
@@ -34,11 +34,11 @@ function drv_openweathermap_rain_online_get {
|
|||||||
"local_epoch": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".dt")",
|
"local_epoch": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".dt")",
|
||||||
"local_tz_long": "$OPENWEATHERMAP_TZ",
|
"local_tz_long": "$OPENWEATHERMAP_TZ",
|
||||||
"weather": "$weather",
|
"weather": "$weather",
|
||||||
"temp_c": $(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.temp"),
|
"temp_c": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.temp")",
|
||||||
"relative_humidity": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.humidity")%",
|
"relative_humidity": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.humidity")%",
|
||||||
"wind_dir": "$(deg2dir $wind_deg)",
|
"wind_dir": "$(deg2dir $wind_deg)",
|
||||||
"wind_degrees": $wind_deg,
|
"wind_degrees": "$wind_deg",
|
||||||
"wind_kph": $wind_speed,
|
"wind_kph": "$wind_speed",
|
||||||
"wind_gust_kph": "--",
|
"wind_gust_kph": "--",
|
||||||
"pressure_mb": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.pressure")",
|
"pressure_mb": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.pressure")",
|
||||||
"dewpoint_c": "--",
|
"dewpoint_c": "--",
|
||||||
|
|||||||
4
drv/rainsensorqty/.gitignore
vendored
Normal file
4
drv/rainsensorqty/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Ignore everything in this directory
|
||||||
|
.set_var
|
||||||
|
# Except this file
|
||||||
|
!.gitignore
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
# Driver rainsensorqty - driver for measure the rain volume
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
# Author: androtto
|
# Author: androtto
|
||||||
# file README.md
|
# file README.md
|
||||||
# Version: 0.2.0
|
# Version: 0.2.30
|
||||||
# Data: 11/Aug/2019
|
# Data: 21/Sep/2019
|
||||||
|
|
||||||
|
|
||||||
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
|
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
|
||||||
|
|||||||
@@ -94,10 +94,12 @@ function trigger_event {
|
|||||||
local ec=$?
|
local ec=$?
|
||||||
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
|
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
|
||||||
|
|
||||||
CURRENT_EVENT="$EVENT"
|
#CURRENT_EVENT="$EVENT"
|
||||||
mqtt_status &
|
#mqtt_status &
|
||||||
|
|
||||||
if [ $ec -ne 0 ]; then
|
if [ $ec -ne 0 ]; then
|
||||||
|
CURRENT_EVENT="$EVENT"
|
||||||
|
mqtt_status &
|
||||||
log_write "Stop events chain for exit code $ec in $current_event_dir/$f"
|
log_write "Stop events chain for exit code $ec in $current_event_dir/$f"
|
||||||
return $ec
|
return $ec
|
||||||
fi
|
fi
|
||||||
@@ -106,6 +108,9 @@ function trigger_event {
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CURRENT_EVENT="$EVENT"
|
||||||
|
mqtt_status &
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -205,6 +205,21 @@ function socket_server_command {
|
|||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
cmd_pigardensched)
|
||||||
|
local vret=""
|
||||||
|
|
||||||
|
vret=`cmd_pigardensched $arg2 $arg3 $arg4 $arg5 $arg6`
|
||||||
|
|
||||||
|
if [[ ! -z $vret ]]; then
|
||||||
|
json_error 0 "piGardenSched command failed"
|
||||||
|
log_write "piGardenSched command failed: $vret"
|
||||||
|
else
|
||||||
|
message_write "success" "Schedule set successfull"
|
||||||
|
json_status
|
||||||
|
fi
|
||||||
|
|
||||||
|
;;
|
||||||
|
|
||||||
reboot)
|
reboot)
|
||||||
message_write "warning" "System reboot is started"
|
message_write "warning" "System reboot is started"
|
||||||
json_status
|
json_status
|
||||||
|
|||||||
99
piGarden.sh
99
piGarden.sh
@@ -223,9 +223,6 @@ function ev_open_in {
|
|||||||
|
|
||||||
trigger_event "ev_open_in_after" "$3" "$4" "$cron_start" "$cron_stop"
|
trigger_event "ev_open_in_after" "$3" "$4" "$cron_start" "$cron_stop"
|
||||||
|
|
||||||
#echo $cron_start
|
|
||||||
#echo $cron_stop
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -299,6 +296,14 @@ function log_write {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -e "$LOG_OUTPUT_DRV_FILE" ]; then
|
||||||
|
local actualsize=$($WC -c <"$LOG_OUTPUT_DRV_FILE")
|
||||||
|
if [ $actualsize -ge $LOG_FILE_MAX_SIZE ]; then
|
||||||
|
$GZIP $LOG_OUTPUT_DRV_FILE
|
||||||
|
$MV $LOG_OUTPUT_DRV_FILE.gz $LOG_OUTPUT_DRV_FILE.`date +%Y%m%d%H%M`.gz
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "`date`\t\t$1" >> $LOG_FILE
|
echo -e "`date`\t\t$1" >> $LOG_FILE
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -498,8 +503,9 @@ function list_alias {
|
|||||||
#
|
#
|
||||||
# Stampa un json contanente lo status della centralina
|
# Stampa un json contanente lo status della centralina
|
||||||
# $1 .. $6 parametri opzionali
|
# $1 .. $6 parametri opzionali
|
||||||
# - get_cron: aggiunge i dati relativi ai crontab delle scehdulazioni di apertura/chisura delle elettrovalvole
|
# - get_cron: aggiunge i dati relativi ai crontab delle scehdulazioni di apertura/chisura
|
||||||
# - get_cron_open_in: aggiunge i dati relativi ai crontab degli avvii ritardati eseguiti con il comando open_in
|
# - get_cron_open_in: aggiunge i dati relativi ai crontab degli avvii ritardati eseguiti con il comando open_in
|
||||||
|
# - get_schedule: aggiunge i dati relativi alle schedulazioni di piGardenSched
|
||||||
#
|
#
|
||||||
function json_status {
|
function json_status {
|
||||||
local json=""
|
local json=""
|
||||||
@@ -513,6 +519,7 @@ function json_status {
|
|||||||
local last_success=""
|
local last_success=""
|
||||||
local with_get_cron="0"
|
local with_get_cron="0"
|
||||||
local with_get_cron_open_in="0"
|
local with_get_cron_open_in="0"
|
||||||
|
local with_get_schedule="0"
|
||||||
local current_pid=$!
|
local current_pid=$!
|
||||||
local json_event="\"event\": {\"event\": \"$CURRENT_EVENT\", \"alias\": \"$CURRENT_EVENT_ALIAS\"}"
|
local json_event="\"event\": {\"event\": \"$CURRENT_EVENT\", \"alias\": \"$CURRENT_EVENT_ALIAS\"}"
|
||||||
|
|
||||||
@@ -531,9 +538,12 @@ function json_status {
|
|||||||
with_get_cron_open_in="1"
|
with_get_cron_open_in="1"
|
||||||
elif [[ "$i" == get_cron_open_in:* ]]; then
|
elif [[ "$i" == get_cron_open_in:* ]]; then
|
||||||
with_get_cron_open_in="${i#get_cron_open_in:}"
|
with_get_cron_open_in="${i#get_cron_open_in:}"
|
||||||
|
elif [ $i = "get_schedule" ] && [[ $PIGARDENSCHED == "1" ]]; then
|
||||||
|
with_get_schedule="1"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
local json_ev=""
|
||||||
for i in $(seq $EV_TOTAL)
|
for i in $(seq $EV_TOTAL)
|
||||||
do
|
do
|
||||||
local a=EV"$i"_ALIAS
|
local a=EV"$i"_ALIAS
|
||||||
@@ -543,10 +553,14 @@ function json_status {
|
|||||||
if [ -n "$json" ]; then
|
if [ -n "$json" ]; then
|
||||||
json="$json,"
|
json="$json,"
|
||||||
fi
|
fi
|
||||||
#json="$json\"$i\":{\"name\":\"$av\",\"state\":$sv}"
|
|
||||||
json="$json\"$av\":{\"name\":\"$av\",\"state\":$sv}"
|
json="$json\"$av\":{\"name\":\"$av\",\"state\":$sv}"
|
||||||
|
|
||||||
|
if [ -n "$json_ev" ]; then
|
||||||
|
json_ev="$json_ev,"
|
||||||
|
fi
|
||||||
|
json_ev="$json_ev\"$a\":{\"alias\":\"$av\"}"
|
||||||
done
|
done
|
||||||
json="\"zones\":{$json}"
|
json="\"zones\":{$json},\"ev\":{$json_ev}"
|
||||||
|
|
||||||
local last_rain_sensor=`cat "$STATUS_DIR/last_rain_sensor" 2> /dev/null`
|
local last_rain_sensor=`cat "$STATUS_DIR/last_rain_sensor" 2> /dev/null`
|
||||||
local last_rain_online=`cat "$STATUS_DIR/last_rain_online" 2> /dev/null`
|
local last_rain_online=`cat "$STATUS_DIR/last_rain_online" 2> /dev/null`
|
||||||
@@ -555,15 +569,7 @@ function json_status {
|
|||||||
if [[ ! -z "$last_weather_online" ]]; then
|
if [[ ! -z "$last_weather_online" ]]; then
|
||||||
json_last_weather_online=$last_weather_online
|
json_last_weather_online=$last_weather_online
|
||||||
fi
|
fi
|
||||||
#if [ -f "$LAST_INFO_FILE.$current_pid" ]; then
|
|
||||||
# last_info=`cat "$LAST_INFO_FILE.$current_pid"`
|
|
||||||
#fi
|
|
||||||
#if [ -f "$LAST_WARNING_FILE.$current_pid" ]; then
|
|
||||||
# last_warning=`cat "$LAST_WARNING_FILE.$current_pid"`
|
|
||||||
#fi
|
|
||||||
#if [ -f "$LAST_SUCCESS_FILE.$current_pid" ]; then
|
|
||||||
# last_success=`cat "$LAST_SUCCESS_FILE.$current_pid"`
|
|
||||||
#fi
|
|
||||||
last_info="$MESSAGE_INFO"
|
last_info="$MESSAGE_INFO"
|
||||||
last_warning="$MESSAGE_WARNING"
|
last_warning="$MESSAGE_WARNING"
|
||||||
last_success="$MESSAGE_SUCCESS"
|
last_success="$MESSAGE_SUCCESS"
|
||||||
@@ -607,6 +613,24 @@ function json_status {
|
|||||||
fi
|
fi
|
||||||
local json_cron="\"cron\":{$json_get_cron}"
|
local json_cron="\"cron\":{$json_get_cron}"
|
||||||
|
|
||||||
|
local json_get_schedule=""
|
||||||
|
local json_schedule=""
|
||||||
|
if [ $with_get_schedule != "0" ]; then
|
||||||
|
json_get_schedule=""
|
||||||
|
for scheduled in `$PIGARDENSCHED_PATH sched`
|
||||||
|
do
|
||||||
|
local ev=$(echo $scheduled|$CUT -f1 -d";")
|
||||||
|
local evcomplete="$ev"_ALIAS
|
||||||
|
local al=${!evcomplete}
|
||||||
|
local json_get_schedule="\"$ev\": {\"alias\": \"$al\", \"entry\": \"$scheduled\"}, $json_get_schedule"
|
||||||
|
done
|
||||||
|
if [[ ! -z $json_get_schedule ]]; then
|
||||||
|
json_get_schedule="${json_get_schedule::-2}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
local json_schedule=", \"schedule\":{$json_get_schedule}"
|
||||||
|
fi
|
||||||
|
|
||||||
local json_get_cron_open_in=""
|
local json_get_cron_open_in=""
|
||||||
if [ $with_get_cron_open_in != "0" ]; then
|
if [ $with_get_cron_open_in != "0" ]; then
|
||||||
local values_open_in=""
|
local values_open_in=""
|
||||||
@@ -641,7 +665,7 @@ function json_status {
|
|||||||
local json_cron_open_in="\"cron_open_in\":{$json_get_cron_open_in}"
|
local json_cron_open_in="\"cron_open_in\":{$json_get_cron_open_in}"
|
||||||
local json_timestamp="\"timestamp\": $(date +%s)"
|
local json_timestamp="\"timestamp\": $(date +%s)"
|
||||||
|
|
||||||
json="{$json_version,$json_timestamp,$json_event,$json,$json_last_weather_online,$json_error,$json_last_info,$json_last_warning,$json_last_success,$json_last_rain_online,$json_last_rain_sensor,$json_cron,$json_cron_open_in}"
|
json="{$json_version,$json_timestamp,$json_event,$json,$json_last_weather_online,$json_error,$json_last_info,$json_last_warning,$json_last_success,$json_last_rain_online,$json_last_rain_sensor,$json_cron,$json_cron_open_in $json_schedule}"
|
||||||
|
|
||||||
echo "$json"
|
echo "$json"
|
||||||
|
|
||||||
@@ -683,7 +707,7 @@ function show_usage {
|
|||||||
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"
|
||||||
echo -e "\t$NAME_SCRIPT ev_status_all show status solenoids"
|
echo -e "\t$NAME_SCRIPT ev_status_all show status solenoids"
|
||||||
echo -e "\t$NAME_SCRIPT json_status [get_cron|get_cron_open_in] show status in json format"
|
echo -e "\t$NAME_SCRIPT json_status [get_cron|get_cron_open_in|get_schedule] show status in json format"
|
||||||
echo -e "\t$NAME_SCRIPT mqtt_status send status in json format to mqtt broker"
|
echo -e "\t$NAME_SCRIPT mqtt_status send status in json format to mqtt broker"
|
||||||
echo -e "\t$NAME_SCRIPT check_rain_online check rain from http://api.wunderground.com/"
|
echo -e "\t$NAME_SCRIPT check_rain_online check rain from http://api.wunderground.com/"
|
||||||
echo -e "\t$NAME_SCRIPT check_rain_sensor check rain from hardware sensor"
|
echo -e "\t$NAME_SCRIPT check_rain_sensor check rain from hardware sensor"
|
||||||
@@ -715,6 +739,8 @@ function show_usage {
|
|||||||
echo -e "\t$NAME_SCRIPT del_cron_close alias remove all crontab for close a solenoid"
|
echo -e "\t$NAME_SCRIPT del_cron_close alias remove all crontab for close a solenoid"
|
||||||
echo -e "\t$NAME_SCRIPT get_cron_close alias get all crontab for close a solenoid"
|
echo -e "\t$NAME_SCRIPT get_cron_close alias get all crontab for close a solenoid"
|
||||||
echo -e "\n"
|
echo -e "\n"
|
||||||
|
echo -e "\t$NAME_SCRIPT cmd_pigardensched [prm1 [prm2 [prm3]...]] performs a pigardensched command"
|
||||||
|
echo -e "\n"
|
||||||
echo -e "\t$NAME_SCRIPT debug1 [parameter]|[parameter]|..] Run debug code 1"
|
echo -e "\t$NAME_SCRIPT debug1 [parameter]|[parameter]|..] Run debug code 1"
|
||||||
echo -e "\t$NAME_SCRIPT debug2 [parameter]|[parameter]|..] Run debug code 2"
|
echo -e "\t$NAME_SCRIPT debug2 [parameter]|[parameter]|..] Run debug code 2"
|
||||||
}
|
}
|
||||||
@@ -835,6 +861,31 @@ function exec_reboot {
|
|||||||
trigger_event "exec_reboot_after"
|
trigger_event "exec_reboot_after"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Esegue un comando con piGardenSched
|
||||||
|
#
|
||||||
|
# $1 parametro 1
|
||||||
|
# $2 parametro 2
|
||||||
|
# $3 parametro 3
|
||||||
|
# $4 parametro 4
|
||||||
|
# $5 parametro 5
|
||||||
|
|
||||||
|
function cmd_pigardensched {
|
||||||
|
local foo="bar"
|
||||||
|
|
||||||
|
if [ $PIGARDENSCHED == 0 ]; then
|
||||||
|
echo "piGardenSched not configured in piGarden" >&2
|
||||||
|
log_write "piGardenSched not configured in piGarden"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
$PIGARDENSCHED_PATH $1 $2 $3 $4 $5
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "piGardenSched command failed"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Converte da gradi a direzione
|
# Converte da gradi a direzione
|
||||||
@@ -933,7 +984,7 @@ function debug2 {
|
|||||||
|
|
||||||
VERSION=0
|
VERSION=0
|
||||||
SUB_VERSION=5
|
SUB_VERSION=5
|
||||||
RELEASE_VERSION=11
|
RELEASE_VERSION=14
|
||||||
|
|
||||||
DIR_SCRIPT=`dirname $0`
|
DIR_SCRIPT=`dirname $0`
|
||||||
NAME_SCRIPT=${0##*/}
|
NAME_SCRIPT=${0##*/}
|
||||||
@@ -961,9 +1012,6 @@ fi
|
|||||||
. "$DIR_SCRIPT/include/rain.include.sh"
|
. "$DIR_SCRIPT/include/rain.include.sh"
|
||||||
. "$DIR_SCRIPT/include/events.include.sh"
|
. "$DIR_SCRIPT/include/events.include.sh"
|
||||||
|
|
||||||
#LAST_INFO_FILE="$STATUS_DIR/last_info"
|
|
||||||
#LAST_WARNING_FILE="$STATUS_DIR/last_warning"
|
|
||||||
#LAST_SUCCESS_FILE="$STATUS_DIR/last_success"
|
|
||||||
MESSAGE_INFO=""
|
MESSAGE_INFO=""
|
||||||
MESSAGE_WARNING=""
|
MESSAGE_WARNING=""
|
||||||
MESSAGE_SUCCESS=""
|
MESSAGE_SUCCESS=""
|
||||||
@@ -987,6 +1035,11 @@ elif [ "$WEATHER_SERVICE" != "none" ]; then
|
|||||||
WEATHER_SERVICE="drv:$WEATHER_SERVICE"
|
WEATHER_SERVICE="drv:$WEATHER_SERVICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PIGARDENSCHED="0"
|
||||||
|
if [[ -x "$PIGARDENSCHED_PATH" ]]; then
|
||||||
|
PIGARDENSCHED="1"
|
||||||
|
fi
|
||||||
|
|
||||||
# Elimina il file di lock se più vecchio di 11 secondi
|
# Elimina il file di lock se più vecchio di 11 secondi
|
||||||
if [ -f "$LOCK_FILE" ]; then
|
if [ -f "$LOCK_FILE" ]; then
|
||||||
max_age_lock_file=11
|
max_age_lock_file=11
|
||||||
@@ -1160,6 +1213,10 @@ case "$1" in
|
|||||||
get_cron_close $2
|
get_cron_close $2
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
cmd_pigardensched)
|
||||||
|
cmd_pigardensched $2 $3 $4 $5
|
||||||
|
;;
|
||||||
|
|
||||||
reboot)
|
reboot)
|
||||||
exec_reboot
|
exec_reboot
|
||||||
;;
|
;;
|
||||||
|
|||||||
Reference in New Issue
Block a user