Aggiunto nel json_status il tipo di evento attualmente triggerato
This commit is contained in:
@@ -17,12 +17,14 @@ function trigger_event {
|
|||||||
case "$EVENT" in
|
case "$EVENT" in
|
||||||
"ev_open_before" | "ev_open_after")
|
"ev_open_before" | "ev_open_after")
|
||||||
ALIAS="$2"
|
ALIAS="$2"
|
||||||
|
CURRENT_EVENT_ALIAS="$ALIAS"
|
||||||
FORCE="$3"
|
FORCE="$3"
|
||||||
$f "$EVENT" "$ALIAS" "$FORCE" `date +%s` &> /dev/null
|
$f "$EVENT" "$ALIAS" "$FORCE" `date +%s` &> /dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
"ev_open_in_before")
|
"ev_open_in_before")
|
||||||
ALIAS="$2"
|
ALIAS="$2"
|
||||||
|
CURRENT_EVENT_ALIAS="$ALIAS"
|
||||||
FORCE="$3"
|
FORCE="$3"
|
||||||
local MINUTE_START="$4"
|
local MINUTE_START="$4"
|
||||||
local MINUTE_STOP="$5"
|
local MINUTE_STOP="$5"
|
||||||
@@ -31,6 +33,7 @@ function trigger_event {
|
|||||||
|
|
||||||
"ev_open_in_after")
|
"ev_open_in_after")
|
||||||
ALIAS="$2"
|
ALIAS="$2"
|
||||||
|
CURRENT_EVENT_ALIAS="$ALIAS"
|
||||||
FORCE="$3"
|
FORCE="$3"
|
||||||
local CRON_START="$4"
|
local CRON_START="$4"
|
||||||
local CRON_STOP="$5"
|
local CRON_STOP="$5"
|
||||||
@@ -39,6 +42,7 @@ function trigger_event {
|
|||||||
|
|
||||||
"ev_close_before" | "ev_close_after")
|
"ev_close_before" | "ev_close_after")
|
||||||
ALIAS="$2"
|
ALIAS="$2"
|
||||||
|
CURRENT_EVENT_ALIAS="$ALIAS"
|
||||||
$f "$EVENT" "$ALIAS" `date +%s` &> /dev/null
|
$f "$EVENT" "$ALIAS" `date +%s` &> /dev/null
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -90,6 +94,7 @@ function trigger_event {
|
|||||||
local ec=$?
|
local ec=$?
|
||||||
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
|
#echo "$EVENT ec=$ec" >> /tmp/piGarden.testevent
|
||||||
|
|
||||||
|
CURRENT_EVENT="$EVENT"
|
||||||
mqtt_status &
|
mqtt_status &
|
||||||
|
|
||||||
if [ $ec -ne 0 ]; then
|
if [ $ec -ne 0 ]; then
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ function json_status {
|
|||||||
local with_get_cron="0"
|
local with_get_cron="0"
|
||||||
local with_get_cron_open_in="0"
|
local with_get_cron_open_in="0"
|
||||||
local current_pid=$!
|
local current_pid=$!
|
||||||
|
local json_event="\"event\": {\"event\": \"$CURRENT_EVENT\", \"alias\": \"$CURRENT_EVENT_ALIAS\"}"
|
||||||
|
|
||||||
if [ "$PARENT_PID" -gt "0" ]; then
|
if [ "$PARENT_PID" -gt "0" ]; then
|
||||||
current_pid=$PARENT_PID
|
current_pid=$PARENT_PID
|
||||||
@@ -615,7 +616,7 @@ function json_status {
|
|||||||
fi
|
fi
|
||||||
local json_cron_open_in="\"cron_open_in\":{$json_get_cron_open_in}"
|
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"
|
echo "$json"
|
||||||
|
|
||||||
@@ -939,6 +940,9 @@ LAST_INFO_FILE="$STATUS_DIR/last_info"
|
|||||||
LAST_WARNING_FILE="$STATUS_DIR/last_warning"
|
LAST_WARNING_FILE="$STATUS_DIR/last_warning"
|
||||||
LAST_SUCCESS_FILE="$STATUS_DIR/last_success"
|
LAST_SUCCESS_FILE="$STATUS_DIR/last_success"
|
||||||
|
|
||||||
|
CURRENT_EVENT=""
|
||||||
|
CURRENT_EVENT_ALIAS=""
|
||||||
|
|
||||||
PARENT_PID=0
|
PARENT_PID=0
|
||||||
|
|
||||||
if [ -z $LOG_OUTPUT_DRV_FILE ]; then
|
if [ -z $LOG_OUTPUT_DRV_FILE ]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user