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