From 7c998eddabe4d19c7777d73ff26454742912c31e Mon Sep 17 00:00:00 2001 From: "b.waal" Date: Tue, 12 Sep 2023 19:10:36 +0200 Subject: [PATCH] Update 'Domoticz/SmartPinger.sh' Added logging for debugging --- Domoticz/SmartPinger.sh | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Domoticz/SmartPinger.sh b/Domoticz/SmartPinger.sh index d071a70..e3f5a98 100644 --- a/Domoticz/SmartPinger.sh +++ b/Domoticz/SmartPinger.sh @@ -5,7 +5,11 @@ # @author: Branco van de Waal # ############################### -#echo $$ > /var/log/pid/Smartping-.pid +#Enable or Disable logging: +#LogFile=/tmp/pinger.log + + +echo $$ > /var/log/pid/Smartping-.pid # Set Parameters Name='' @@ -67,20 +71,20 @@ domoticzstatus=$(curl -s "http://"$domoticzserverip"/json.htm?type=command¶m CurTime=$(date '+%d/%m/%Y %H:%M'); # Compare ping result to Domoticz device status if [ "$device" = "$domoticzstatus" ] ; then -echo "$CurTime | Device: $Name | Domo: Synced | Status: $technology" +echo "$CurTime | Device: $Name | Domo: Synced | Status: $technology" | tee -a $LogFile else #Domo status sync if [ "$device" = On ] ; then -echo "$CurTime | Device: $Name | Domo: Desynced | Status: $technology" +echo "$CurTime | Device: $Name | Domo: Desynced | Status: $technology" | tee -a $LogFile curl -s "http://"$domoticzserverip"/json.htm?type=command¶m=switchlight&idx="$IDX"&switchcmd=On" 2>/dev/null 1>/dev/null else -echo "$CurTime | Device: $Name | Domo: Desynced | Status: $technology" +echo "$CurTime | Device: $Name | Domo: Desynced | Status: $technology" | tee -a $LogFile curl -s "http://"$domoticzserverip"/json.htm?type=command¶m=switchlight&idx="$IDX"&switchcmd=Off" 2>/dev/null 1>/dev/null fi fi #Waiting if Device is online if [ "$device" = On ] ; then -echo "$CurTime | Device: $Name | Status: Online, Waiting" +echo "$CurTime | Device: $Name | Status: Online, Waiting" | tee -a $LogFile sleep 60 fi