Compare commits
11 Commits
v0.5.10
...
rainsensor
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2add0c725f | ||
|
|
0b34b7010f | ||
|
|
e2eda96f2c | ||
|
|
40ab2e3b25 | ||
|
|
40eb0b2429 | ||
|
|
e26292fe36 | ||
|
|
d99566ef93 | ||
|
|
a76c797b22 | ||
|
|
07a594e799 | ||
|
|
dfa68c2b83 | ||
|
|
e284bbcb25 |
@@ -1,3 +1,6 @@
|
|||||||
|
# 0.5.11 - 11/11/2018
|
||||||
|
- Added ability to disable online weather service by defining WEATHER_SERVICE="none" in the configuration file
|
||||||
|
|
||||||
# 0.5.10 - 11/11/2018
|
# 0.5.10 - 11/11/2018
|
||||||
- Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE
|
- Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
|||||||
|
|
||||||
|
|
||||||
# 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 bistabili
|
||||||
EV_MONOSTABLE=0
|
EV_MONOSTABLE=0
|
||||||
|
|
||||||
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
|
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
|
||||||
@@ -95,7 +95,7 @@ EV_TOTAL=6
|
|||||||
EV1_ALIAS="1" #
|
EV1_ALIAS="1" #
|
||||||
EV1_GPIO=17 # Physical 11 - wPi 0
|
EV1_GPIO=17 # Physical 11 - wPi 0
|
||||||
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
|
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
|
||||||
#EV1_MONOSTAVLE=1 # L'elettrovalvola è monostabile
|
#EV1_MONOSTABLE=1 # L'elettrovalvola è monostabile
|
||||||
|
|
||||||
EV2_ALIAS="2" #
|
EV2_ALIAS="2" #
|
||||||
EV2_GPIO=27 # Physical 13 - wPi 2
|
EV2_GPIO=27 # Physical 13 - wPi 2
|
||||||
@@ -113,8 +113,10 @@ EV6_ALIAS="6" #
|
|||||||
EV6_GPIO=24 # Physical 18 - wPi 5
|
EV6_GPIO=24 # Physical 18 - wPi 5
|
||||||
|
|
||||||
|
|
||||||
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground
|
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
|
||||||
|
# Se non vuoi configurare nessun servizio imposta il vale "none"
|
||||||
WEATHER_SERVICE="openweathermap"
|
WEATHER_SERVICE="openweathermap"
|
||||||
|
#WEATHER_SERVICE="none" # Nessun servizio configurato
|
||||||
|
|
||||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
OPENWEATHERMAP_KEY=""
|
OPENWEATHERMAP_KEY=""
|
||||||
|
|||||||
160
conf/piGarden.conf.rainsensorqty.example
Normal file
160
conf/piGarden.conf.rainsensorqty.example
Normal file
@@ -0,0 +1,160 @@
|
|||||||
|
# Log file
|
||||||
|
LOG_FILE="/home/pi/piGarden/log/piGarden.log"
|
||||||
|
LOG_FILE_MAX_SIZE=1048576 # 1MB
|
||||||
|
|
||||||
|
# Log file for driver output
|
||||||
|
LOG_OUTPUT_DRV_FILE="/tmp/piGarden.drv.log"
|
||||||
|
|
||||||
|
# Status directory
|
||||||
|
STATUS_DIR="/home/pi/piGarden/state"
|
||||||
|
|
||||||
|
# Event directory
|
||||||
|
EVENT_DIR="/home/pi/piGarden/events"
|
||||||
|
|
||||||
|
# Posizione gpio
|
||||||
|
GPIO="/usr/local/bin/gpio"
|
||||||
|
|
||||||
|
# Posizione js
|
||||||
|
JQ="/usr/local/bin/jq"
|
||||||
|
|
||||||
|
# Percorso curl
|
||||||
|
CURL="/usr/bin/curl"
|
||||||
|
|
||||||
|
# Percorso wc
|
||||||
|
WC="/usr/bin/wc"
|
||||||
|
|
||||||
|
# Percorso gzip
|
||||||
|
GZIP="/bin/gzip"
|
||||||
|
|
||||||
|
# Percorso mv
|
||||||
|
MV="/bin/mv"
|
||||||
|
|
||||||
|
# Percorso di tr
|
||||||
|
TR="/usr/bin/tr"
|
||||||
|
|
||||||
|
# Percorso di cut
|
||||||
|
CUT="/usr/bin/cut"
|
||||||
|
|
||||||
|
# Percorso tcpserver
|
||||||
|
TCPSERVER="/usr/bin/tcpserver"
|
||||||
|
|
||||||
|
# Percorso cron
|
||||||
|
CRONTAB="/usr/bin/crontab"
|
||||||
|
|
||||||
|
# Percorso grep
|
||||||
|
GREP="/bin/grep"
|
||||||
|
|
||||||
|
# Percorsp sed
|
||||||
|
SED="/bin/sed"
|
||||||
|
|
||||||
|
# Percorso readlink
|
||||||
|
READLINK="/bin/readlink"
|
||||||
|
|
||||||
|
# Percorso stat
|
||||||
|
STAT="/usr/bin/stat"
|
||||||
|
|
||||||
|
# Percorso mosquito_pub
|
||||||
|
# # Installare con apt install mosquitto-clients
|
||||||
|
MOSQUITTO_PUB="/usr/bin/mosquitto_pub"
|
||||||
|
|
||||||
|
|
||||||
|
# Se impostato con il valore 1, indica che il sistema gestisce elettrovalvole monostabili,
|
||||||
|
# se impostato a 0 il sistema gestirà elettrovalvole bistabili
|
||||||
|
EV_MONOSTABLE=0
|
||||||
|
|
||||||
|
# Id gpio usati per simulare il doppio deviatore con cui eseguire l'alimentazione alle elettrovalvole
|
||||||
|
SUPPLY_GPIO_1=2 # Physical 3 - wPi 8
|
||||||
|
SUPPLY_GPIO_2=3 # Physical 5 - wPi 9
|
||||||
|
|
||||||
|
# Stato dei due gpio per impartire l'alimentazione positiva alle elettrovalvole (aperta)
|
||||||
|
SUPPLY_GPIO_POS=0
|
||||||
|
|
||||||
|
# Stato dei due gpio per impartire l'alimentazione negativa alle elettrovalvole (chiusa)
|
||||||
|
SUPPLY_GPIO_NEG=1
|
||||||
|
|
||||||
|
# Stato di ingresso da assegnare al gpio per chiudere il rele
|
||||||
|
RELE_GPIO_CLOSE=0
|
||||||
|
|
||||||
|
# Stato di ingresso da assegnare al gpio per aprire il rele
|
||||||
|
RELE_GPIO_OPEN=1
|
||||||
|
|
||||||
|
# Id del gpio usato per collegare il sensore di rilevamento pioggia
|
||||||
|
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
|
||||||
|
|
||||||
|
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
|
||||||
|
RAIN_GPIO_STATE=0
|
||||||
|
|
||||||
|
|
||||||
|
RAINSENSORQTY_LOOPSFORSETRAINING=10 # dopo 10 impulsi, 10 vaschette riempite si considera pioggia
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Numero totale di elettrovalvole
|
||||||
|
EV_TOTAL=6
|
||||||
|
|
||||||
|
# Definizione delle elettrovalvole
|
||||||
|
EV1_ALIAS="1" #
|
||||||
|
EV1_GPIO=17 # Physical 11 - wPi 0
|
||||||
|
#EV1_NORAIN=1 # Non interrompe l'irrigazione di questa zona in caso di pioggia
|
||||||
|
#EV1_MONOSTABLE=1 # L'elettrovalvola è monostabile
|
||||||
|
|
||||||
|
EV2_ALIAS="2" #
|
||||||
|
EV2_GPIO=27 # Physical 13 - wPi 2
|
||||||
|
|
||||||
|
EV3_ALIAS="3" #
|
||||||
|
EV3_GPIO=22 # Physical 15 - wPi 3
|
||||||
|
|
||||||
|
EV4_ALIAS="4" #
|
||||||
|
EV4_GPIO=18 # Physical 12 - wPi 1
|
||||||
|
|
||||||
|
EV5_ALIAS="5" #
|
||||||
|
EV5_GPIO=23 # Physical 16 - wPi 4
|
||||||
|
|
||||||
|
EV6_ALIAS="6" #
|
||||||
|
EV6_GPIO=24 # Physical 18 - wPi 5
|
||||||
|
|
||||||
|
|
||||||
|
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
|
||||||
|
# Se non vuoi configurare nessun servizio imposta il vale "none"
|
||||||
|
WEATHER_SERVICE="openweathermap"
|
||||||
|
#WEATHER_SERVICE="none" # Nessun servizio configurato
|
||||||
|
|
||||||
|
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
|
OPENWEATHERMAP_KEY=""
|
||||||
|
OPENWEATHERMAP_LOCATION="q=Pieve%20a%20Nievole,it" # https://openweathermap.org/current
|
||||||
|
OPENWEATHERMAP_TZ="Europe/Rome" # Time zone
|
||||||
|
|
||||||
|
# Parametri di wunderground, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
|
WUNDERGROUND_KEY=""
|
||||||
|
WUNDERGROUND_LOCATION="IT/Pieve%20a%20Nievole" # http://www.wunderground.com/weather/api/d/docs?d=resources/country-to-iso-matching&MR=1
|
||||||
|
|
||||||
|
|
||||||
|
# Blocca l'irrigazione se l'ultima pioggia rilevata online è avvenuta nell'ultima quantità di tempo inserita.
|
||||||
|
# Il tempo è espresso in secondi. Quindi inserendo 86400, se nelle ultime 24 ore ha piovuto viene bloccata l'irrigazione. Inserendo il valore zero non viene eseguito nessun controllo.
|
||||||
|
NOT_IRRIGATE_IF_RAIN_ONLINE=86400
|
||||||
|
|
||||||
|
# Il parametro è simile a quello precedente, il controllo però anziché essere fatto attingendo a wunderground, viene eseguito direttamente sul sensore se installato. Inserendo il valore zero non viene eseguito nessun controllo.
|
||||||
|
NOT_IRRIGATE_IF_RAIN_SENSOR=86400
|
||||||
|
|
||||||
|
# Indirizzo ip e porta di ascolto del socket server
|
||||||
|
TCPSERVER_IP="127.0.0.1"
|
||||||
|
TCPSERVER_PORT="8084"
|
||||||
|
|
||||||
|
# Utente e password che i clients devono utilizzare per stabilire una connessione tramite socket server
|
||||||
|
TCPSERVER_USER=""
|
||||||
|
TCPSERVER_PWD=""
|
||||||
|
|
||||||
|
# Con impostato il valore 1 non invia l'identificativi per statistiche di utilizzo
|
||||||
|
NO_SEND_IDENTIFIER=0
|
||||||
|
|
||||||
|
# Parametri connessione al broker mqtt
|
||||||
|
MQTT_ENABLE=0 # set 1 to enable
|
||||||
|
MQTT_HOST=you_host_mqtt
|
||||||
|
MQTT_PORT=1883
|
||||||
|
MQTT_USER=your_user_mqtt
|
||||||
|
MQTT_PWD=yout_password_mqtt
|
||||||
|
MQTT_TOPIC="pigarden/result"
|
||||||
|
MQTT_CLIENT_ID=piGarden
|
||||||
|
|
||||||
@@ -105,8 +105,10 @@ EV4_ALIAS="Giardino_Posteriore_GPIO" #
|
|||||||
EV4_GPIO="18"
|
EV4_GPIO="18"
|
||||||
|
|
||||||
|
|
||||||
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground
|
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
|
||||||
|
# Se non vuoi configurare nessun servizio imposta il vale "none"
|
||||||
WEATHER_SERVICE="openweathermap"
|
WEATHER_SERVICE="openweathermap"
|
||||||
|
#WEATHER_SERVICE="none" # Nessun servizio configurato
|
||||||
|
|
||||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
OPENWEATHERMAP_KEY=""
|
OPENWEATHERMAP_KEY=""
|
||||||
|
|||||||
@@ -107,8 +107,10 @@ EV4_ALIAS="Giardino_Anteriore"
|
|||||||
EV4_GPIO="drv:sonoff_tasmota_http:SONOFF2:Power1"
|
EV4_GPIO="drv:sonoff_tasmota_http:SONOFF2:Power1"
|
||||||
|
|
||||||
|
|
||||||
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground
|
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
|
||||||
|
# Se non vuoi configurare nessun servizio imposta il vale "none"
|
||||||
WEATHER_SERVICE="openweathermap"
|
WEATHER_SERVICE="openweathermap"
|
||||||
|
#WEATHER_SERVICE="none" # Nessun servizio configurato
|
||||||
|
|
||||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
OPENWEATHERMAP_KEY=""
|
OPENWEATHERMAP_KEY=""
|
||||||
|
|||||||
@@ -477,8 +477,10 @@ EV128_ALIAS="Zona_128" #
|
|||||||
EV128_GPIO="drv:spb16ch:128"
|
EV128_GPIO="drv:spb16ch:128"
|
||||||
|
|
||||||
|
|
||||||
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground
|
# Definisci il servizio online da utilizzare per il controllo delle condizioni meteo, puoi scegliere openweathermap oppure wunderground.
|
||||||
|
# Se non vuoi configurare nessun servizio imposta il vale "none"
|
||||||
WEATHER_SERVICE="openweathermap"
|
WEATHER_SERVICE="openweathermap"
|
||||||
|
#WEATHER_SERVICE="none" # Nessun servizio configurato
|
||||||
|
|
||||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||||
OPENWEATHERMAP_KEY=""
|
OPENWEATHERMAP_KEY=""
|
||||||
|
|||||||
107
drv/rainsensorqty/README.md
Normal file
107
drv/rainsensorqty/README.md
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file README.md
|
||||||
|
# Version: 0.2.0
|
||||||
|
# Data: 11/Aug/2019
|
||||||
|
|
||||||
|
|
||||||
|
FILE DI CONFIGURAZIONE /etc/piGarden.conf:
|
||||||
|
-----------------------------------------
|
||||||
|
NOTA: vedere nella directory conf_example il file esempio piu' aggiornato!
|
||||||
|
|
||||||
|
per attivare il driver e' necessario inserire la seguente variabile nel file di configurazion
|
||||||
|
RAIN_GPIO="drv:rainsensorqty:25" # Physical 22 - wPi 6
|
||||||
|
|
||||||
|
la variabile seguente e' impiegata anche da drv_rainsensorqty per rilevare la chiusura del contatto magnetico che, in un circuito pull-up, e' lo stato 1.
|
||||||
|
# Valore in ingresso sul gpio definito in RAIN_GPIO che indica lo stato di pioggia
|
||||||
|
RAIN_GPIO_STATE=1
|
||||||
|
le seguenti variabili controllano il driver come descritto:
|
||||||
|
RAINSENSORQTY_LOOPSFORSETRAINING=16 # dopo 16 impulsi, 16 vaschette riempite si considera pioggia
|
||||||
|
RAINSENSORQTY_SECSBETWEENRAINEVENT=10800 # =3h, significa che dopo 3 si resetta il numero di vaschette da riempire e solo dopo il riempimento del nuovo numero di vaschette si considera una nuova pioggia
|
||||||
|
infine la variabile seguente e' la quantita' di acqua espressa in mm di precipitazioni:
|
||||||
|
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details
|
||||||
|
|
||||||
|
CALIBRAZIONE SENSORE PIOGGIA
|
||||||
|
----------------------------
|
||||||
|
secondo il seguente processo da me effettuato sul mio misuratore di pioggia:
|
||||||
|
Ho erogato 18 ml di acqua nel rain gauge che hanno prodotto 10 impulsi; pertanto il riempimento di 1.8 ml ha causato un impulso, 1 ml = 1000 mmc (mm cubici),
|
||||||
|
1.8 ml sono pari a 1800 mmc
|
||||||
|
la superficie della vaschetta in mmq e' pari a 110 mm x 55 mm = 5500 mmq
|
||||||
|
volume / superficie mi da' l'altezza, quindi 1800 mmc / 5500 mmq = 0.32727273 mm
|
||||||
|
se fossero stati 1.7 ml di acqua per ogni impulso/vaschetta riempita, la variabile sarebbe stata impostata a 0.30909091 mm
|
||||||
|
|
||||||
|
COMANDI SPECIALI
|
||||||
|
----------------
|
||||||
|
nella sottodirectory command sono presenti:
|
||||||
|
commands/rainsensorqty_CHECK.sh
|
||||||
|
chiama la funzione di verifica pioggia, la medesima chiamata da check_rain_sensor
|
||||||
|
commands/rainsensorqty_HISTORY.sh
|
||||||
|
visualizza lo storico della pioggia
|
||||||
|
commands/rainsensorqty_INIT.sh
|
||||||
|
inizializza il driver eseguendo lo script di monitoring - normalmente tale processo avviene da piGarden.sh
|
||||||
|
utile quando si vuole testare dei cambiamenti o se necessario riavviare dopo il kill del comando successivo
|
||||||
|
commands/rainsensorqty_KILL.sh
|
||||||
|
killa i processi di monitoring ed eventuali figli
|
||||||
|
commands/rainsensorqty_RAINNOW.sh
|
||||||
|
simula una pioggia registrandola in $RAINSENSORQTY_LASTRAIN
|
||||||
|
commands/rainsensorqty_REMOVELASTRAIN.sh
|
||||||
|
rimuove dai file $RAINSENSORQTY_LASTRAIN $RAINSENSORQTY_HISTORY l'ultima pioggia registrata
|
||||||
|
commands/rainsensorqty_RESET.sh
|
||||||
|
invia il SIGUSR1 al processo di monitor per resettare i cicli. Viene visualizzato il reset solo dopo il successivo PULSE, questo perche' non e' possibile per lo script ricevere il trap in quanto il processo $GPIO e' attivo in attesa del PULSE
|
||||||
|
|
||||||
|
|
||||||
|
ULTERIORI VARIABILI in config.include.sh
|
||||||
|
----------------------------------------
|
||||||
|
esistono ulteriori variabili che potrebbe essere necessario variare
|
||||||
|
|
||||||
|
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
|
||||||
|
serve per ritardare la lettura di un secondo impulso falso causato dal rimbalzo del contatto magnetico
|
||||||
|
|
||||||
|
RAINSENSORQTY_verbose="yes"
|
||||||
|
aumenta il livello di verbosita' nei file di log
|
||||||
|
|
||||||
|
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
||||||
|
memorizza l'ultima pioggia
|
||||||
|
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
||||||
|
memorizza tutte le piogge permettendo di visualizzare lo storico (commands/rainsensorqty_HISTORY.sh)
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
||||||
|
log dello script di monitoring, popolato solo se RAINSENSORQTY_verbose="yes"
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
|
file che viene popolato con il pid dello script di monitoring
|
||||||
|
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
|
||||||
|
file che viene popolato con l'ultimo stato della vaschetta (formato timestamp:counter)
|
||||||
|
|
||||||
|
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
|
||||||
|
home directory del driver
|
||||||
|
|
||||||
|
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
|
||||||
|
script di monitoring
|
||||||
|
lo script eredita le variabili di ambiente da $RAINSENSORQTY_VAR ($TMPDIR/.rainsensorqty_var)
|
||||||
|
|
||||||
|
NOTA: $TMPDIR e' /tmp e lo script visualizza un warning se non e' un tmpfs
|
||||||
|
|
||||||
|
# internal gpio resistor, 3 values: pull-up, pull-down, none
|
||||||
|
# pull-up/down if rain gauge is connected directly to raspberry
|
||||||
|
# none if connected through an optocoupler circuit
|
||||||
|
GPIO_RESISTOR="none" #pull-up|pull-down|none
|
||||||
|
enable pull-up or pull-down resistor: https://raspberry-projects.com/pi/pi-hardware/raspberry-pi-model-b-plus/model-b-plus-io-pins
|
||||||
|
Pull-up is 50K min - 65K max.
|
||||||
|
Pull-down is 50K min - 60K max.
|
||||||
|
|
||||||
|
#rising means waiting for 1 status (from 0)
|
||||||
|
#falling means waiting for 0 status (from 1)
|
||||||
|
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
|
||||||
|
lo script di monitoring ascolta il cambiamento di stato da quello di riposo allo stato di impulso (chiusura del contatto reed).
|
||||||
|
dipendentemente dal circuto implementato, se lo stato di riposo e' 0, lo script attende la variazione verso 1 (rising)
|
||||||
|
se lo stato di riposo e' 1, lo script attende la variazione verso 0 (falling)
|
||||||
|
la variabile RAINSENSORQTY_PULSE viene impostata secondo il valore di RAIN_GPIO_STATE presente in /etc/piGarden.conf
|
||||||
|
cioe' il valore che ci si aspetta per registrare il riempimento della vaschetta dello stato di pioggia
|
||||||
|
|
||||||
|
|
||||||
0
drv/rainsensorqty/_version_0.2.1
Normal file
0
drv/rainsensorqty/_version_0.2.1
Normal file
0
drv/rainsensorqty/_version_0.2.3
Normal file
0
drv/rainsensorqty/_version_0.2.3
Normal file
35
drv/rainsensorqty/commands/rainsensorqty_CHECK.sh
Executable file
35
drv/rainsensorqty/commands/rainsensorqty_CHECK.sh
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_CHECK.sh"
|
||||||
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
|
# Version: 0.2.0
|
||||||
|
# Data: 11/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
# restituisce 0 se piove, e nell'output di testo il valore di "$RAIN_GPIO_STATE"
|
||||||
|
# restituisce 99 se non piove, output "norain"
|
||||||
|
# esce con 1 se non c'e' il monitoring, output "ERROR"
|
||||||
|
|
||||||
|
drv_rainsensorqty_rain_sensor_get
|
||||||
|
case $? in
|
||||||
|
0) echo "NORMAL: it's raining" ;;
|
||||||
|
99) echo "NORMAL: it's not raining" ;;
|
||||||
|
1) echo "ERROR: monitor process $DIR_SCRIPT/drv/rainsensorqty/drv_rainsensorqty_monitor.sh is not running" ;;
|
||||||
|
esac
|
||||||
|
|
||||||
28
drv/rainsensorqty/commands/rainsensorqty_HISTORY.sh
Executable file
28
drv/rainsensorqty/commands/rainsensorqty_HISTORY.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_CHECK.sh"
|
||||||
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 13/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
rain_history # update rain history file if not
|
||||||
|
|
||||||
|
echo "RAIN HISTORY"
|
||||||
|
cat $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
25
drv/rainsensorqty/commands/rainsensorqty_INIT.sh
Executable file
25
drv/rainsensorqty/commands/rainsensorqty_INIT.sh
Executable file
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_INIT.sh"
|
||||||
|
# test script for initialize driver and executing monitor process
|
||||||
|
# Version: 0.2.0
|
||||||
|
# Data: 11/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
drv_rainsensorqty_rain_sensor_init
|
||||||
|
|
||||||
|
drv_rainsensorqty_init
|
||||||
52
drv/rainsensorqty/commands/rainsensorqty_KILL.sh
Executable file
52
drv/rainsensorqty/commands/rainsensorqty_KILL.sh
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_KILL.sh"
|
||||||
|
# script for killing monitor process(es)
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 29/Aug/2019
|
||||||
|
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
# check if rain monitor process is running...
|
||||||
|
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
|
||||||
|
pid="$( < "$RAINSENSORQTY_MONPID" )"
|
||||||
|
if ps -fp $pid >/dev/null ; then
|
||||||
|
echo "process $pid pid and its child(ren)"
|
||||||
|
children_pid="$(ps -ef| awk "\$3==$pid {print \$2}")"
|
||||||
|
ps -fp $pid
|
||||||
|
ps -fp $children_pid | tail +2
|
||||||
|
echo -e "\nsending TERM signal to $pid and its child(ren)"
|
||||||
|
echo kill $children_pid
|
||||||
|
echo kill $pid
|
||||||
|
kill $children_pid
|
||||||
|
kill $pid
|
||||||
|
echo -e "\nchecking $pid pid and its child(ren) are still alive"
|
||||||
|
for process in $pid $children_pid
|
||||||
|
do
|
||||||
|
if ps -fp $process >/dev/null ; then
|
||||||
|
echo "$process is still alive"
|
||||||
|
else
|
||||||
|
echo "$process is dead"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo "no RAIN process alive"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "no RAIN process alive"
|
||||||
|
fi
|
||||||
|
|
||||||
26
drv/rainsensorqty/commands/rainsensorqty_RAINNOW.sh
Executable file
26
drv/rainsensorqty/commands/rainsensorqty_RAINNOW.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_RAINNOW.sh"
|
||||||
|
# test script for simulate rain ... now!
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 13/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
echo "RAIN now!"
|
||||||
|
echo "$(date +%s):$RAINSENSORQTY_LOOPSFORSETRAINING" > ${RAINSENSORQTY_LASTRAIN}
|
||||||
|
echo "file ${RAINSENSORQTY_LASTRAIN} updated."
|
||||||
|
echo -e "\nLAST RAIN:"
|
||||||
|
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
||||||
51
drv/rainsensorqty/commands/rainsensorqty_REMOVELASTRAIN.sh
Executable file
51
drv/rainsensorqty/commands/rainsensorqty_REMOVELASTRAIN.sh
Executable file
@@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "test_rainsensorqty_CHECK.sh"
|
||||||
|
# test script for checking rain status using drv_rainsensorqty_rain_sensor_get function
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 13/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
|
||||||
|
LOG_OUTPUT_DRV_FILE="$DIR_SCRIPT/log/$LOG_OUTPUT_DRV_FILE"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
# two variables for store rain data
|
||||||
|
# RAINSENSORQTY_LASTRAIN
|
||||||
|
# RAINSENSORQTY_HISTORY
|
||||||
|
|
||||||
|
rain_history # update rain history file if not
|
||||||
|
|
||||||
|
echo "RAIN HISTORY - last five events"
|
||||||
|
tail -5 $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
|
|
||||||
|
echo -e "\nLAST RAIN"
|
||||||
|
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
||||||
|
|
||||||
|
#exit # for test
|
||||||
|
|
||||||
|
echo -e "\nbackup to .old files"
|
||||||
|
cp -p $RAINSENSORQTY_HISTORY ${RAINSENSORQTY_HISTORY}.old
|
||||||
|
cp -p $RAINSENSORQTY_LASTRAIN ${RAINSENSORQTY_LASTRAIN}.old
|
||||||
|
|
||||||
|
echo "...removing last event"
|
||||||
|
head -n-1 ${RAINSENSORQTY_HISTORY}.old > $RAINSENSORQTY_HISTORY
|
||||||
|
tail -1 $RAINSENSORQTY_HISTORY > $RAINSENSORQTY_LASTRAIN
|
||||||
|
|
||||||
|
echo -e "\nnew RAIN HISTORY - last five events"
|
||||||
|
tail -5 $RAINSENSORQTY_HISTORY | rain_when_amount
|
||||||
|
|
||||||
|
echo -e "\nnew LAST RAIN"
|
||||||
|
cat $RAINSENSORQTY_LASTRAIN | rain_when_amount
|
||||||
35
drv/rainsensorqty/commands/rainsensorqty_RESET.sh
Executable file
35
drv/rainsensorqty/commands/rainsensorqty_RESET.sh
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensorqty_RESET.sh"
|
||||||
|
# script for reset counter in monitor script
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 29/Aug/2019
|
||||||
|
|
||||||
|
SCRIPTDIR="$(cd `dirname $0` ; pwd )"
|
||||||
|
SCRIPTNAME=${0##*/}
|
||||||
|
cd $SCRIPTDIR/.. # command is a subdirectory of driver
|
||||||
|
|
||||||
|
DIR_SCRIPT=/home/pi/piGarden # home directory of piGarden
|
||||||
|
CONFIG_ETC="/etc/piGarden.conf"
|
||||||
|
|
||||||
|
. $CONFIG_ETC
|
||||||
|
|
||||||
|
. ./config.include.sh
|
||||||
|
. ./common.include.sh
|
||||||
|
. ./init.include.sh
|
||||||
|
. ./rainsensor.include.sh
|
||||||
|
|
||||||
|
# check if rain monitor process is running...
|
||||||
|
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
|
||||||
|
pid="$( < "$RAINSENSORQTY_MONPID" )"
|
||||||
|
if ps -fp $pid >/dev/null ; then
|
||||||
|
echo "sending SIGUSR1 to $pid"
|
||||||
|
kill -SIGUSR1 $pid
|
||||||
|
echo -e "sent SIGUSR1 - reset will be shown after next cycle"
|
||||||
|
else
|
||||||
|
echo "no RAIN process alive"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "no RAIN process alive"
|
||||||
|
fi
|
||||||
90
drv/rainsensorqty/common.include.sh
Normal file
90
drv/rainsensorqty/common.include.sh
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "common.include.sh"
|
||||||
|
# common functions used by driver
|
||||||
|
# Version: 0.2.0a
|
||||||
|
# Data: 13/Aug/2019
|
||||||
|
|
||||||
|
|
||||||
|
#note:
|
||||||
|
#RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
|
#
|
||||||
|
|
||||||
|
d() # short date & time
|
||||||
|
{
|
||||||
|
date '+%X-%x'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
drv_rainsensorqty_writelog()
|
||||||
|
{
|
||||||
|
#2 variables - $1 function, $2 message
|
||||||
|
if [[ $2 =~ ERROR || $2 =~ WARNING || $2 =~ RAIN || $RAINSENSORQTY_verbose = yes ]] ; then
|
||||||
|
echo -e "$1 - `d`\t\t$2" >> "$LOG_OUTPUT_DRV_FILE"
|
||||||
|
# if [[ $($WC -c <"$LOG_OUTPUT_DRV_FILE") > $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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
drv_rainsensorqty_check()
|
||||||
|
{
|
||||||
|
local f="drv_rainsensorqty_check"
|
||||||
|
|
||||||
|
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
|
||||||
|
local pid=$( < "$RAINSENSORQTY_MONPID" )
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: checking if $pid pid is running"
|
||||||
|
if ps -fp $pid >/dev/null ; then
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: $pid pid is running"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: $pid pid monitor process NOT running - $RAINSENSORQTY_MONPID file contains $pid"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: no raining monitor process file \$RAINSENSORQTY_MONPID"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
en_echo() # enhanched echo - check verbose variable
|
||||||
|
{
|
||||||
|
[[ $RAINSENSORQTY_verbose = yes ]] && echo "$(d) $*"
|
||||||
|
}
|
||||||
|
|
||||||
|
rain_history()
|
||||||
|
{
|
||||||
|
[[ ! -f $RAINSENSORQTY_HISTORY ]] && touch $RAINSENSORQTY_HISTORY
|
||||||
|
[[ ! -f $RAINSENSORQTY_LASTRAIN ]] && return 1
|
||||||
|
if grep -q ^$(<$RAINSENSORQTY_LASTRAIN)$ $RAINSENSORQTY_HISTORY ; then
|
||||||
|
: # do nothing
|
||||||
|
return 2
|
||||||
|
else
|
||||||
|
cat $RAINSENSORQTY_LASTRAIN >> $RAINSENSORQTY_HISTORY
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
rain_when_amount()
|
||||||
|
{
|
||||||
|
# from standard input
|
||||||
|
cat - | while read line
|
||||||
|
do
|
||||||
|
set -- ${line//:/ }
|
||||||
|
when=$1
|
||||||
|
howmuch=$2
|
||||||
|
printf "RAINED on %s for %.2f mm\n" "$(date --date="@$1")" $( $JQ -n "$howmuch * $RAINSENSORQTY_MMEACH" )
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
check_TMPDIR()
|
||||||
|
{
|
||||||
|
if [[ $(df | awk '$NF=="/tmp" {print $1}') != "tmpfs" ]] ; then
|
||||||
|
echo "WARNING: /tmp isn't a tmp file system"
|
||||||
|
echo -e "\tplease add to your /etc/fstab file:\n\ttmpfs /tmp tmpfs defaults,noatime,nosuid 0 0"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# cfg file version 0.2.0
|
||||||
|
# Id del gpio usato per collegare il sensore di rilevamento pioggia
|
||||||
|
# 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
|
||||||
|
# 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
|
||||||
|
|
||||||
|
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_MMEACH=0.33 # see RAINSENSORQTY driver readme for details
|
||||||
64
drv/rainsensorqty/config.include.sh
Normal file
64
drv/rainsensorqty/config.include.sh
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "config.include.sh"
|
||||||
|
# specific driver config file
|
||||||
|
# Version: 0.2.0
|
||||||
|
# Data: 11/Aug/2019
|
||||||
|
|
||||||
|
export TMPDIR=/tmp
|
||||||
|
|
||||||
|
RAINSENSOR_DEBOUNCE=0.3 # 0.3 seconds for manage debounce of reed contact
|
||||||
|
|
||||||
|
RAINSENSORQTY_verbose="yes" # yes/no
|
||||||
|
|
||||||
|
RAINSENSORQTY_LASTRAIN="$STATUS_DIR/rainsensorqty_lastrain"
|
||||||
|
RAINSENSORQTY_HISTORY="$STATUS_DIR/rainsensorqty_history"
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONITORLOG="$DIR_SCRIPT/log/rainsensorqty_monitor.log"
|
||||||
|
|
||||||
|
RAINSENSORQTY_MONPID="$TMPDIR/rainsensorqty_monitor.pid"
|
||||||
|
RAINSENSORQTY_STATE="$TMPDIR/rainsensorqty_state"
|
||||||
|
RAINSENSORQTY_STATE_HIST="$TMPDIR/rainsensorqty_state.history"
|
||||||
|
|
||||||
|
RAINSENSORQTY_DIR="$DIR_SCRIPT/drv/rainsensorqty"
|
||||||
|
|
||||||
|
monitor_sh="$RAINSENSORQTY_DIR/drv_rainsensorqty_monitor.sh"
|
||||||
|
|
||||||
|
# internal gpio resistor, 3 values: pull-up, pull-down, none
|
||||||
|
# pull-up/down if rain gauge is connected directly to raspberry
|
||||||
|
# none if connected through an optocoupler circuit
|
||||||
|
GPIO_RESISTOR="pull-up" #pull-up|pull-down|none
|
||||||
|
|
||||||
|
#rising means waiting for 1 status (from 0)
|
||||||
|
#falling means waiting for 0 status (from 1)
|
||||||
|
#RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
#RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
(( RAIN_GPIO_STATE == 1 )) && RAINSENSORQTY_PULSE=rising # pull-down circuit (rest status is 0)
|
||||||
|
(( RAIN_GPIO_STATE == 0 )) && RAINSENSORQTY_PULSE=falling # pull-up circuit (rest status is 1)
|
||||||
|
|
||||||
|
|
||||||
|
config_check()
|
||||||
|
{
|
||||||
|
var2check="RAINSENSOR_DEBOUNCE RAINSENSORQTY_verbose RAINSENSORQTY_LASTRAIN RAINSENSORQTY_HISTORY RAINSENSORQTY_MONITORLOG RAINSENSORQTY_MONPID RAINSENSORQTY_DIR monitor_sh"
|
||||||
|
for var in $var2check
|
||||||
|
do
|
||||||
|
#${!a}
|
||||||
|
if [[ -z ${!var} ]] ; then
|
||||||
|
echo "ERROR: \$$var not set"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [[ -z $RAINSENSORQTY_PULSE ]] ; then
|
||||||
|
echo "ERROR: RAIN_GPIO_STATE not set in piGarden.conf"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
return 0
|
||||||
|
case $GPIO_RESISTOR in
|
||||||
|
pull-up|pull-down|none) return 0 ;;
|
||||||
|
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
89
drv/rainsensorqty/drv_rainsensorqty_monitor.sh
Executable file
89
drv/rainsensorqty/drv_rainsensorqty_monitor.sh
Executable file
@@ -0,0 +1,89 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "drv_rainsensorqty_monitor.sh"
|
||||||
|
# monitor script
|
||||||
|
# Version: 0.2.2
|
||||||
|
# Data: 08/Sep/2019
|
||||||
|
|
||||||
|
resetcounter()
|
||||||
|
{
|
||||||
|
(( counter = 0 ))
|
||||||
|
drv_rainsensorqty_writelog $f "SIGUSR1 received after last PULSE - counter resetted" &
|
||||||
|
echo "SIGUSR1 received after last PULSE - counter resetted"
|
||||||
|
}
|
||||||
|
|
||||||
|
###############
|
||||||
|
# MAIN #
|
||||||
|
###############
|
||||||
|
|
||||||
|
trap "resetcounter" SIGUSR1
|
||||||
|
|
||||||
|
|
||||||
|
DIRNAME="$( dirname $0 )"
|
||||||
|
f="$(basename $0)"
|
||||||
|
. $DIRNAME/common.include.sh
|
||||||
|
|
||||||
|
RAINSENSORQTY_VAR=$TMPDIR/.rainsensorqty_var
|
||||||
|
|
||||||
|
if [[ -f "$RAINSENSORQTY_VAR" ]] ; then
|
||||||
|
en_echo "NORMAL: file $RAINSENSORQTY_VAR found - getting variables"
|
||||||
|
. "$RAINSENSORQTY_VAR"
|
||||||
|
else
|
||||||
|
echo "ERROR: $RAINSENSORQTY_VAR not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#drvt="$( echo $RAIN_GPIO | $CUT -f 1 -d: )"
|
||||||
|
#drv="$( echo $RAIN_GPIO | $CUT -f 2 -d: )"
|
||||||
|
gpio_port="$( echo $RAIN_GPIO | $CUT -f 3 -d: )"
|
||||||
|
|
||||||
|
# check if no other rain monitor process running...
|
||||||
|
if [[ -f "$RAINSENSORQTY_MONPID" ]] ; then
|
||||||
|
pid="$( < "$RAINSENSORQTY_MONPID" )"
|
||||||
|
if ps -fp $pid >/dev/null ; then
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR monitor process already running\n$( ps -fp $pid )"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo $$ > $RAINSENSORQTY_MONPID
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL - $$ pid monitor process started - see $RAINSENSORQTY_MONPID"
|
||||||
|
|
||||||
|
# init variables
|
||||||
|
MMEACH="$RAINSENSORQTY_MMEACH"
|
||||||
|
(( counter=0 ))
|
||||||
|
rain_history
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
en_echo "---- NEW RUN ----"
|
||||||
|
|
||||||
|
# loop forever
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
before=`date +%s`
|
||||||
|
sleep $RAINSENSOR_DEBOUNCE
|
||||||
|
en_echo "WAITING FOR $RAINSENSORQTY_PULSE PULSE"
|
||||||
|
$GPIO -g wfi $gpio_port $RAINSENSORQTY_PULSE
|
||||||
|
now=`date +%s`
|
||||||
|
(( elapsed = now - before ))
|
||||||
|
if (( elapsed >= RAINSENSORQTY_SECSBETWEENRAINEVENT )) ; then
|
||||||
|
(( counter=0 ))
|
||||||
|
drv_rainsensorqty_writelog $f "first drops after $elapsed seconds since last rain ( greater than $RAINSENSORQTY_SECSBETWEENRAINEVENT )- new cycle - waiting for $( $JQ -n "$RAINSENSORQTY_LOOPSFORSETRAINING * $MMEACH" ) mm of rain" &
|
||||||
|
en_echo "---- NEW CYCLE ----"
|
||||||
|
rain_history &
|
||||||
|
fi
|
||||||
|
(( counter+=1 ))
|
||||||
|
en_echo "$RAINSENSORQTY_PULSE PULSE #$counter RECEIVED"
|
||||||
|
echo "$now:$counter" > ${RAINSENSORQTY_STATE} &
|
||||||
|
echo "$now:$counter" >> ${RAINSENSORQTY_STATE_HIST} &
|
||||||
|
MMWATER=$( $JQ -n "$counter*$MMEACH" )
|
||||||
|
text=$(printf "%.2f mm height (#%d pulse)" $MMWATER $counter )
|
||||||
|
if (( counter >= RAINSENSORQTY_LOOPSFORSETRAINING )) ; then
|
||||||
|
drv_rainsensorqty_writelog $f "RAINING - $text" &
|
||||||
|
echo "$now:$counter" > ${RAINSENSORQTY_LASTRAIN}
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "now is $text" &
|
||||||
|
fi
|
||||||
|
done
|
||||||
37
drv/rainsensorqty/init.include.sh
Normal file
37
drv/rainsensorqty/init.include.sh
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume
|
||||||
|
# Author: androtto
|
||||||
|
# file "init.include.sh"
|
||||||
|
# Inizializza il driver, viene richiamata nella funzione init di piGarden
|
||||||
|
# Version: 0.2.0
|
||||||
|
# Data: 11/Aug/2019
|
||||||
|
|
||||||
|
function drv_rainsensorqty_init {
|
||||||
|
local f="drv_rainsensorqty_init"
|
||||||
|
|
||||||
|
# format RAIN_GPIO="drv:rainsensorqty:25"
|
||||||
|
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: executing $monitor_sh"
|
||||||
|
|
||||||
|
# esegue rainmonitor
|
||||||
|
if [ -x "$monitor_sh" ] ; then
|
||||||
|
nohup "$monitor_sh" >> $RAINSENSORQTY_MONITORLOG 2>&1 &
|
||||||
|
sleep 1
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: $monitor_sh has pid $( < $RAINSENSORQTY_MONPID)"
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: cannot find \"\$monitor_sh \" "
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if ! config_check ; then
|
||||||
|
echo "ERROR in config_check function"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
: #echo "config_check ok"
|
||||||
|
fi
|
||||||
|
|
||||||
|
check_TMPDIR
|
||||||
|
|
||||||
|
RAINSENSORQTY_VAR=$TMPDIR/.rainsensorqty_var
|
||||||
|
|
||||||
|
set | $GREP -e ^GPIO -e ^LOG -e ^CUT -e ^JQ -e ^RAIN -e ^SCR -e ^TMP > $RAINSENSORQTY_VAR
|
||||||
104
drv/rainsensorqty/rainsensor.include.sh
Normal file
104
drv/rainsensorqty/rainsensor.include.sh
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
#
|
||||||
|
# Driver rainsensorqty - driver for measure the rain volume, for rain meter, for rain gauge
|
||||||
|
# Author: androtto
|
||||||
|
# file "rainsensor.include.sh"
|
||||||
|
# functions called by piGarden.sh
|
||||||
|
# Version: 0.1.2
|
||||||
|
# Data: 19/Mar/2019
|
||||||
|
# fixed output drv_rainsensorqty_rain_sensor_get
|
||||||
|
|
||||||
|
#
|
||||||
|
# Inizializza il sensore di rilevamento pioggia
|
||||||
|
#
|
||||||
|
# $1 identificativo gpio del sensore di pioggia
|
||||||
|
#
|
||||||
|
drv_rainsensorqty_rain_sensor_init()
|
||||||
|
{
|
||||||
|
local f=drv_rainsensorqty_rain_sensor_init
|
||||||
|
drv_rainsensorqty_writelog "launched: $f" $1
|
||||||
|
|
||||||
|
local drvt="$( echo $RAIN_GPIO | $CUT -f 1 -d: )"
|
||||||
|
local drv="$( echo $RAIN_GPIO | $CUT -f 2 -d: )"
|
||||||
|
local gpio_port="$( echo $RAIN_GPIO | $CUT -f 3 -d: )"
|
||||||
|
|
||||||
|
if $GPIO -g mode $gpio_port in ; then
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: '$GPIO -g mode $gpio_port in' set correctly"
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: '$GPIO -g mode $gpio_port in' has an error"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $GPIO_RESISTOR in
|
||||||
|
pull-up) gpio_arg=up
|
||||||
|
message="NORMAL: '$GPIO -g mode $gpio_port up' set internal pull-up resistor"
|
||||||
|
;;
|
||||||
|
pull-down) gpio_arg=down
|
||||||
|
message="NORMAL: '$GPIO -g mode $gpio_port down' set internal pull-down resistor"
|
||||||
|
;;
|
||||||
|
none) gpio_arg=tri
|
||||||
|
message="NORMAL: '$GPIO -g mode $gpio_port tri' set none to internal resistor"
|
||||||
|
;;
|
||||||
|
*) echo "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
|
||||||
|
drv_rainsensorqty_writelog "drv_rainsensorqty_rain_sensor_init" "ERROR: GPIO_RESISTOR not set correctly - values are \"pull-up|pull-down|none\" "
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if $GPIO -g mode $gpio_port $gpio_arg ; then
|
||||||
|
drv_rainsensorqty_writelog $f "$message"
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: '$GPIO -g mode $gpio_port $gpio_arg' command"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# Ritorna in output lo stato del sensore di rilevamento pioggia
|
||||||
|
#
|
||||||
|
# $1 identificativo gpio del sensore di pioggia
|
||||||
|
#
|
||||||
|
# restituisce 0 se piove, e nell'output di testo il valore di "$RAIN_GPIO_STATE"
|
||||||
|
# restituisce 99 se non piove, output "norain"
|
||||||
|
# esce con 1 se non c'e' il monitoring, output "ERROR"
|
||||||
|
drv_rainsensorqty_rain_sensor_get()
|
||||||
|
{
|
||||||
|
local now=$(date +%s)
|
||||||
|
local interval=60 # because check_rain_sensor is scheduled once a minute ... to changed if schedule is modified, from crontab:
|
||||||
|
#* * * * * /home/pi/piGarden/piGarden.sh check_rain_sensor 2> /tmp/check_rain_sensor.err
|
||||||
|
|
||||||
|
local f="drv_rainsensorqty_check"
|
||||||
|
|
||||||
|
# script called with:
|
||||||
|
#drv_rainsensorqty_writelog $f $1
|
||||||
|
# ignora il parametro di $1, lo recupera dal file di configurazione
|
||||||
|
|
||||||
|
# verifica se lo script di monitoring e' attivo
|
||||||
|
if drv_rainsensorqty_check ; then
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL - drv_rainsensorqty_check ok, monitor process running"
|
||||||
|
if [ -f "$RAINSENSORQTY_LASTRAIN" ] ; then
|
||||||
|
local lastrain="$( cat "$RAINSENSORQTY_LASTRAIN" | $CUT -f 1 -d: )"
|
||||||
|
local counter="$( cat "$RAINSENSORQTY_LASTRAIN" | $CUT -f 2 -d: )"
|
||||||
|
LEVEL=$( $JQ -n "$counter/$RAINSENSORQTY_LOOPSFORSETRAINING" | $JQ 'floor' )
|
||||||
|
(( diff = now - lastrain ))
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: last rain $( date --date="@$lastrain" ) - LEVEL $LEVEL rain"
|
||||||
|
drv_rainsensorqty_writelog $f "NORMAL: check rain $( date --date="@$now" ) "
|
||||||
|
if (( diff <= interval )) ; then
|
||||||
|
drv_rainsensorqty_writelog $f "RAIN - return \$RAIN_GPIO_STATE = $RAIN_GPIO_STATE as output"
|
||||||
|
drv_rainsensorqty_writelog $f "DEBUG : check rain - diff $diff < $interval - return $RAIN_GPIO_STATE"
|
||||||
|
msg="$RAIN_GPIO_STATE"
|
||||||
|
echo $msg
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "NO_RAIN - return \"norain\" as output"
|
||||||
|
drv_rainsensorqty_writelog $f "DEBUG : check rain - diff $diff < $interval - return 99"
|
||||||
|
msg="norain"
|
||||||
|
echo $msg
|
||||||
|
return 99
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
drv_rainsensorqty_writelog $f "ERROR: drv_rainsensorqty_check failed, no monitor process running ($monitor_sh)"
|
||||||
|
msg="ERROR"
|
||||||
|
echo $msg
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#
|
#
|
||||||
# Funzione di esempio
|
# Funzione di esempio
|
||||||
#
|
#
|
||||||
function sample_foo {
|
function drv_sample_foo {
|
||||||
|
|
||||||
echo "bar"
|
echo "bar"
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
declare -a list_drv
|
declare -a list_drv
|
||||||
|
|
||||||
|
#
|
||||||
|
# Funzione eseguita ad ogni avvio di piGarden.sh, si occupa includere tutti i file dei driver utilizzati e di lanciare
|
||||||
|
# la funzione di setup di ogni driver se esistente
|
||||||
|
#
|
||||||
function setup_drv {
|
function setup_drv {
|
||||||
|
|
||||||
#declare -a list_drv
|
#declare -a list_drv
|
||||||
list_drv=()
|
list_drv=()
|
||||||
|
|
||||||
# Inizializza i driver per le elettrovalvole
|
# Raccoglie i nomi dei driver utilizzati per le elettrovalvole
|
||||||
for i in $(seq $EV_TOTAL)
|
for i in $(seq $EV_TOTAL)
|
||||||
do
|
do
|
||||||
local a=EV"$i"_GPIO
|
local a=EV"$i"_GPIO
|
||||||
@@ -18,7 +22,7 @@ function setup_drv {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Inizializza i driver per gli altri gpio
|
# Raccoglie i nomi dei driver utilizzati per gli altri gpio
|
||||||
for gpio in "$SUPPLY_GPIO_1" "$SUPPLY_GPIO_2" "$RAIN_GPIO" "$WEATHER_SERVICE"
|
for gpio in "$SUPPLY_GPIO_1" "$SUPPLY_GPIO_2" "$RAIN_GPIO" "$WEATHER_SERVICE"
|
||||||
do
|
do
|
||||||
if [[ "$gpio" == drv:* ]]; then
|
if [[ "$gpio" == drv:* ]]; then
|
||||||
@@ -29,6 +33,9 @@ function setup_drv {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#
|
||||||
|
# Esegue l'unclusione dei file dei driver e per ognuno lancia l'eventuale funzione di setup
|
||||||
|
#
|
||||||
local file_drv
|
local file_drv
|
||||||
for drv in "${list_drv[@]}"
|
for drv in "${list_drv[@]}"
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -1,61 +1,13 @@
|
|||||||
#
|
#
|
||||||
# Controlla se se piove tramite http://api.wunderground.com/
|
# Esegue controllo meteo tramite servizio online configurato in WEATHER_SERVICE
|
||||||
#
|
|
||||||
function check_rain_online_old {
|
|
||||||
|
|
||||||
trigger_event "check_rain_online_before" ""
|
|
||||||
|
|
||||||
# http://www.wunderground.com/weather/api/d/docs?d=resources/phrase-glossary&MR=1
|
|
||||||
$CURL http://api.wunderground.com/api/$WUNDERGROUND_KEY/conditions/q/$WUNDERGROUND_LOCATION.json > $TMP_PATH/check_rain_online.json
|
|
||||||
local weather=`cat $TMP_PATH/check_rain_online.json | $JQ -M ".current_observation.weather"`
|
|
||||||
local current_observation=`cat $TMP_PATH/check_rain_online.json | $JQ -M ".current_observation"`
|
|
||||||
local local_epoch=`cat $TMP_PATH/check_rain_online.json | $JQ -M -r ".current_observation.local_epoch"`
|
|
||||||
local current_state_rain_online=""
|
|
||||||
local last_state_rain_online=`cat "$STATUS_DIR/last_state_rain_online" 2> /dev/null`
|
|
||||||
#echo $weather
|
|
||||||
#weather="[Light/Heavy] Drizzle"
|
|
||||||
if [ "$weather" = "null" ]; then
|
|
||||||
log_write "check_rain_online - failed read online data"
|
|
||||||
else
|
|
||||||
log_write "check_rain_online - weather=$weather, local_epoch=$local_epoch"
|
|
||||||
#if [[ "$weather" == *"Clear"* ]]; then
|
|
||||||
#if [[ "$weather" == *"Rain"* ]]; then
|
|
||||||
if [[ "$weather" == *"Rain"* ]] ||
|
|
||||||
[[ "$weather" == *"Snow"* ]] ||
|
|
||||||
[[ "$weather" == *"Hail"* ]] ||
|
|
||||||
[[ "$weather" == *"Ice"* ]] ||
|
|
||||||
[[ "$weather" == *"Thunderstorm"* ]] ||
|
|
||||||
[[ "$weather" == *"Drizzle"* ]];
|
|
||||||
then
|
|
||||||
current_state_rain_online='rain'
|
|
||||||
echo $local_epoch > "$STATUS_DIR/last_rain_online"
|
|
||||||
else
|
|
||||||
current_state_rain_online='norain'
|
|
||||||
fi
|
|
||||||
echo "$current_observation" > "$STATUS_DIR/last_weather_online"
|
|
||||||
if [ "$current_state_rain_online" != "$last_state_rain_online" ]; then
|
|
||||||
echo "$current_state_rain_online" > "$STATUS_DIR/last_state_rain_online"
|
|
||||||
trigger_event "check_rain_online_change" "$current_state_rain_online" "$weather"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
trigger_event "check_rain_online_after" "$current_state_rain_online" "$weather"
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Controlla se se piove tramite http://api.wunderground.com/
|
|
||||||
#
|
#
|
||||||
function check_rain_online {
|
function check_rain_online {
|
||||||
|
|
||||||
|
if [ "$WEATHER_SERVICE" == "none" ]; then
|
||||||
|
log_write "check_rain_online - online service is disable"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
trigger_event "check_rain_online_before" ""
|
trigger_event "check_rain_online_before" ""
|
||||||
|
|
||||||
local local_epoch=`drv_rain_online_get $WEATHER_SERVICE`
|
local local_epoch=`drv_rain_online_get $WEATHER_SERVICE`
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ function ev_open {
|
|||||||
local EV_IS_REMOTE_VAR=EV"$EVNUM"_REMOTE
|
local EV_IS_REMOTE_VAR=EV"$EVNUM"_REMOTE
|
||||||
local EV_IS_REMOTE=${!EV_IS_REMOTE_VAR}
|
local EV_IS_REMOTE=${!EV_IS_REMOTE_VAR}
|
||||||
local EV_IS_MONOSTABLE_VAR=EV"$EVNUM"_MONOSTABLE
|
local EV_IS_MONOSTABLE_VAR=EV"$EVNUM"_MONOSTABLE
|
||||||
local EV_IS_MONOSTABLE=${!EV_IS_MONOSTAVLE_VAR}
|
local EV_IS_MONOSTABLE=${!EV_IS_MONOSTABLE_VAR}
|
||||||
|
|
||||||
if [ ! "$2" = "force" ] && [ "$EVNORAIN" != "1" ]; then
|
if [ ! "$2" = "force" ] && [ "$EVNORAIN" != "1" ]; then
|
||||||
if [[ "$NOT_IRRIGATE_IF_RAIN_ONLINE" -gt 0 && -f $STATUS_DIR/last_rain_online ]]; then
|
if [[ "$NOT_IRRIGATE_IF_RAIN_ONLINE" -gt 0 && -f $STATUS_DIR/last_rain_online ]]; then
|
||||||
@@ -933,7 +933,7 @@ function debug2 {
|
|||||||
|
|
||||||
VERSION=0
|
VERSION=0
|
||||||
SUB_VERSION=5
|
SUB_VERSION=5
|
||||||
RELEASE_VERSION=10
|
RELEASE_VERSION=11
|
||||||
|
|
||||||
DIR_SCRIPT=`dirname $0`
|
DIR_SCRIPT=`dirname $0`
|
||||||
NAME_SCRIPT=${0##*/}
|
NAME_SCRIPT=${0##*/}
|
||||||
@@ -983,7 +983,7 @@ fi
|
|||||||
|
|
||||||
if [ -z $WEATHER_SERVICE ]; then
|
if [ -z $WEATHER_SERVICE ]; then
|
||||||
WEATHER_SERVICE="drv:wunderground"
|
WEATHER_SERVICE="drv:wunderground"
|
||||||
else
|
elif [ "$WEATHER_SERVICE" != "none" ]; then
|
||||||
WEATHER_SERVICE="drv:$WEATHER_SERVICE"
|
WEATHER_SERVICE="drv:$WEATHER_SERVICE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user