diff --git a/CHANGELOG.md b/CHANGELOG.md index fe3a83d..6104b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.6.3 - 10/08/2021 +- Add command last_rain_sensor_timestamp, last_rain_online_timestamp, reset_last_rain_sensor_timestamp, reset_last_rain_online_timestamp +- Add socket server api for reset_last_rain_sensor_timestamp, reset_last_rain_online_timestamp + # 0.6.2 - 24/04/2021 - Update rainsensorqty driver to version 0.2.5c diff --git a/include/rain.include.sh b/include/rain.include.sh index 1e151d3..24a83e3 100644 --- a/include/rain.include.sh +++ b/include/rain.include.sh @@ -120,4 +120,38 @@ function close_all_for_rain { } +# +# Mostra il timestamp dell'ultima pioggia rilevato dal sensore +# +function last_rain_sensor_timestamp { + cat "$STATUS_DIR/last_rain_sensor" 2> /dev/null +} + +# +# Mostra il timestamp dell'ultima pioggia rilevato dal servizio online +# +function last_rain_online_timestamp { + cat "$STATUS_DIR/last_rain_online" 2> /dev/null +} + +# +# Resetta il timestamp dell'ultima pioggia rilevato dal sensore +# +function reset_last_rain_sensor_timestamp { + trigger_event "reset_last_rain_sensor_timestamp_before" "" + rm "$STATUS_DIR/last_rain_sensor" 2> /dev/null + trigger_event "reset_last_rain_sensor_timestamp_after" "" + log_write "rain" "info" "reset_last_rain_sensor_timestamp" +} + +# +# Resetta mostra il timestamp dell'ultima pioggia rilevato dal servizio online +# +function reset_last_rain_online_timestamp { + trigger_event "reset_last_rain_online_timestamp_before" "" + rm "$STATUS_DIR/last_rain_online" 2> /dev/null + trigger_event "reset_last_rain_online_timestamp_before" "" + log_write "rain" "info" "reset_last_rain_online_timestamp" +} + diff --git a/include/socket.include.sh b/include/socket.include.sh index 040b4e7..8193e41 100644 --- a/include/socket.include.sh +++ b/include/socket.include.sh @@ -240,6 +240,19 @@ function socket_server_command { nohup $PATH_SCRIPT poweroff > /dev/null 2>&1 & ;; + reset_last_rain_sensor_timestamp) + reset_last_rain_sensor_timestamp + message_write "success" "Timestamp of last sensor rain successfull reset" + json_status + ;; + + reset_last_rain_online_timestamp) + reset_last_rain_online_timestamp + message_write "success" "Timestamp of last online rain successfull reset" + json_status + ;; + + *) json_error 0 "invalid command" ;; diff --git a/piGarden.sh b/piGarden.sh index 6269f7a..6ba0283 100755 --- a/piGarden.sh +++ b/piGarden.sh @@ -727,6 +727,10 @@ function show_usage { 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_all show status solenoids" + echo -e "\t$NAME_SCRIPT last_rain_sensor_timestamp show timestamp of last rain sensor" + echo -e "\t$NAME_SCRIPT last_rain_online_timestamp show timestamp of last rain online" + echo -e "\t$NAME_SCRIPT reset_last_rain_sensor_timestamp show timestamp of last rain sensor" + echo -e "\t$NAME_SCRIPT reset_last_rain_online_timestamp show timestamp of last rain online" 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 check_rain_online check rain from http://api.wunderground.com/" @@ -1004,7 +1008,7 @@ function debug2 { VERSION=0 SUB_VERSION=6 -RELEASE_VERSION=2 +RELEASE_VERSION=3 DIR_SCRIPT=`dirname $0` NAME_SCRIPT=${0##*/} @@ -1119,6 +1123,22 @@ case "$1" in mqtt_status $2 ;; + last_rain_sensor_timestamp) + last_rain_sensor_timestamp + ;; + + last_rain_online_timestamp) + last_rain_online_timestamp + ;; + + reset_last_rain_sensor_timestamp) + reset_last_rain_sensor_timestamp + ;; + + reset_last_rain_online_timestamp) + reset_last_rain_online_timestamp + ;; + check_rain_online) check_rain_online ;;