Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
07a594e799 | ||
|
|
dfa68c2b83 | ||
|
|
e284bbcb25 | ||
|
|
d324faf8bb | ||
|
|
383cbc44a9 |
@@ -1,3 +1,9 @@
|
||||
# 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
|
||||
- Fix bug in single monostable solenodid management caused from wrong variable name EV_IS_MONOSTAVLE
|
||||
|
||||
# 0.5.9 - 01/11/2018
|
||||
- Added mqtt support for publishing status to broker
|
||||
|
||||
|
||||
@@ -113,8 +113,10 @@ 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
|
||||
# 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=""
|
||||
|
||||
@@ -105,8 +105,10 @@ EV4_ALIAS="Giardino_Posteriore_GPIO" #
|
||||
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="none" # Nessun servizio configurato
|
||||
|
||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||
OPENWEATHERMAP_KEY=""
|
||||
|
||||
@@ -107,8 +107,10 @@ EV4_ALIAS="Giardino_Anteriore"
|
||||
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="none" # Nessun servizio configurato
|
||||
|
||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||
OPENWEATHERMAP_KEY=""
|
||||
|
||||
@@ -477,8 +477,10 @@ EV128_ALIAS="Zona_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="none" # Nessun servizio configurato
|
||||
|
||||
# Parametri di openweathermap, definisce l'api key e il luogo per recuperare lo stato meteo online
|
||||
OPENWEATHERMAP_KEY=""
|
||||
|
||||
@@ -1,61 +1,13 @@
|
||||
#
|
||||
# Controlla se se piove tramite http://api.wunderground.com/
|
||||
#
|
||||
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/
|
||||
# Esegue controllo meteo tramite servizio online configurato in WEATHER_SERVICE
|
||||
#
|
||||
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" ""
|
||||
|
||||
local local_epoch=`drv_rain_online_get $WEATHER_SERVICE`
|
||||
|
||||
@@ -85,8 +85,8 @@ function ev_open {
|
||||
local EVNORAIN=`ev_number2norain $EVNUM`
|
||||
local EV_IS_REMOTE_VAR=EV"$EVNUM"_REMOTE
|
||||
local EV_IS_REMOTE=${!EV_IS_REMOTE_VAR}
|
||||
local EV_IS_MONOSTAVLE_VAR=EV"$EVNUM"_MONOSTABLE
|
||||
local EV_IS_MONOSTAVLE=${!EV_IS_MONOSTAVLE_VAR}
|
||||
local EV_IS_MONOSTABLE_VAR=EV"$EVNUM"_MONOSTABLE
|
||||
local EV_IS_MONOSTABLE=${!EV_IS_MONOSTABLE_VAR}
|
||||
|
||||
if [ ! "$2" = "force" ] && [ "$EVNORAIN" != "1" ]; then
|
||||
if [[ "$NOT_IRRIGATE_IF_RAIN_ONLINE" -gt 0 && -f $STATUS_DIR/last_rain_online ]]; then
|
||||
@@ -933,7 +933,7 @@ function debug2 {
|
||||
|
||||
VERSION=0
|
||||
SUB_VERSION=5
|
||||
RELEASE_VERSION=9
|
||||
RELEASE_VERSION=11
|
||||
|
||||
DIR_SCRIPT=`dirname $0`
|
||||
NAME_SCRIPT=${0##*/}
|
||||
@@ -983,7 +983,7 @@ fi
|
||||
|
||||
if [ -z $WEATHER_SERVICE ]; then
|
||||
WEATHER_SERVICE="drv:wunderground"
|
||||
else
|
||||
elif [ "$WEATHER_SERVICE" != "none" ]; then
|
||||
WEATHER_SERVICE="drv:$WEATHER_SERVICE"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user