Aggiunto nel json_status il tipo di evento attualmente triggerato

This commit is contained in:
lejubila
2018-09-22 08:20:54 +02:00
parent e9a676188f
commit c145171306
2 changed files with 10 additions and 1 deletions

View File

@@ -17,12 +17,14 @@ function trigger_event {
case "$EVENT" in
"ev_open_before" | "ev_open_after")
ALIAS="$2"
CURRENT_EVENT_ALIAS="$ALIAS"
FORCE="$3"
$f "$EVENT" "$ALIAS" "$FORCE" `date +%s` &> /dev/null
;;
"ev_open_in_before")
ALIAS="$2"
CURRENT_EVENT_ALIAS="$ALIAS"
FORCE="$3"
local MINUTE_START="$4"
local MINUTE_STOP="$5"
@@ -31,6 +33,7 @@ function trigger_event {
"ev_open_in_after")
ALIAS="$2"
CURRENT_EVENT_ALIAS="$ALIAS"
FORCE="$3"
local CRON_START="$4"
local CRON_STOP="$5"
@@ -39,6 +42,7 @@ function trigger_event {
"ev_close_before" | "ev_close_after")
ALIAS="$2"
CURRENT_EVENT_ALIAS="$ALIAS"
$f "$EVENT" "$ALIAS" `date +%s` &> /dev/null
;;
@@ -90,6 +94,7 @@ function trigger_event {
local ec=$?
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
CURRENT_EVENT="$EVENT"
mqtt_status &
if [ $ec -ne 0 ]; then

View File

@@ -493,6 +493,7 @@ function json_status {
local with_get_cron="0"
local with_get_cron_open_in="0"
local current_pid=$!
local json_event="\"event\": {\"event\": \"$CURRENT_EVENT\", \"alias\": \"$CURRENT_EVENT_ALIAS\"}"
if [ "$PARENT_PID" -gt "0" ]; then
current_pid=$PARENT_PID
@@ -615,7 +616,7 @@ function json_status {
fi
local json_cron_open_in="\"cron_open_in\":{$json_get_cron_open_in}"
json="{$json_version,$json,$json_last_weather_online,$json_error,$json_last_info,$json_last_warning,$json_last_success,$json_last_rain_online,$json_last_rain_sensor,$json_cron,$json_cron_open_in}"
json="{$json_version,$json_event,$json,$json_last_weather_online,$json_error,$json_last_info,$json_last_warning,$json_last_success,$json_last_rain_online,$json_last_rain_sensor,$json_cron,$json_cron_open_in}"
echo "$json"
@@ -939,6 +940,9 @@ LAST_INFO_FILE="$STATUS_DIR/last_info"
LAST_WARNING_FILE="$STATUS_DIR/last_warning"
LAST_SUCCESS_FILE="$STATUS_DIR/last_success"
CURRENT_EVENT=""
CURRENT_EVENT_ALIAS=""
PARENT_PID=0
if [ -z $LOG_OUTPUT_DRV_FILE ]; then