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

This commit is contained in:
lejubila
2021-08-10 23:39:38 +02:00
parent 5152252653
commit 7242b1c2ab
4 changed files with 72 additions and 1 deletions

View File

@@ -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

View File

@@ -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"
}

View File

@@ -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"
;;

View File

@@ -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
;;