7 Commits

6 changed files with 40 additions and 10 deletions

View File

@@ -1,3 +1,13 @@
# 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
- Added ability to disable online weather service by defining WEATHER_SERVICE="none" in the configuration file

View File

@@ -79,15 +79,18 @@ RELE_GPIO_CLOSE=0
RELE_GPIO_OPEN=1
# 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
# 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_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
RAINSENSORQTY_MMEACH=0.33 # see RAINSENSORQTY driver readme for details

View File

@@ -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_tz_long": "$OPENWEATHERMAP_TZ",
"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")%",
"wind_dir": "$(deg2dir $wind_deg)",
"wind_degrees": $wind_deg,
"wind_kph": $wind_speed,
"wind_degrees": "$wind_deg",
"wind_kph": "$wind_speed",
"wind_gust_kph": "--",
"pressure_mb": "$(cat $TMP_PATH/check_rain_online.openweathermap.json | $JQ -r -M ".main.pressure")",
"dewpoint_c": "--",

4
drv/rainsensorqty/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Ignore everything in this directory
.set_var
# Except this file
!.gitignore

View File

@@ -94,10 +94,12 @@ function trigger_event {
local ec=$?
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
CURRENT_EVENT="$EVENT"
mqtt_status &
#CURRENT_EVENT="$EVENT"
#mqtt_status &
if [ $ec -ne 0 ]; then
CURRENT_EVENT="$EVENT"
mqtt_status &
log_write "Stop events chain for exit code $ec in $current_event_dir/$f"
return $ec
fi
@@ -106,6 +108,9 @@ function trigger_event {
fi
CURRENT_EVENT="$EVENT"
mqtt_status &
}

View File

@@ -299,6 +299,14 @@ function log_write {
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
}
@@ -933,7 +941,7 @@ function debug2 {
VERSION=0
SUB_VERSION=5
RELEASE_VERSION=11
RELEASE_VERSION=13
DIR_SCRIPT=`dirname $0`
NAME_SCRIPT=${0##*/}