Update 'Domoticz/SmartPinger.sh'
Added logging for debugging
This commit is contained in:
parent
84eebc620a
commit
7c998eddab
@ -5,7 +5,11 @@
|
||||
# @author: Branco van de Waal #
|
||||
###############################
|
||||
|
||||
#echo $$ > /var/log/pid/Smartping-<DevName>.pid
|
||||
#Enable or Disable logging:
|
||||
#LogFile=/tmp/pinger.log
|
||||
|
||||
|
||||
echo $$ > /var/log/pid/Smartping-<DevName>.pid
|
||||
|
||||
# Set Parameters
|
||||
Name='<DevName>'
|
||||
@ -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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user