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 #
|
# @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
|
# Set Parameters
|
||||||
Name='<DevName>'
|
Name='<DevName>'
|
||||||
@ -67,20 +71,20 @@ domoticzstatus=$(curl -s "http://"$domoticzserverip"/json.htm?type=command¶m
|
|||||||
CurTime=$(date '+%d/%m/%Y %H:%M');
|
CurTime=$(date '+%d/%m/%Y %H:%M');
|
||||||
# Compare ping result to Domoticz device status
|
# Compare ping result to Domoticz device status
|
||||||
if [ "$device" = "$domoticzstatus" ] ; then
|
if [ "$device" = "$domoticzstatus" ] ; then
|
||||||
echo "$CurTime | Device: $Name | Domo: Synced | Status: $technology"
|
echo "$CurTime | Device: $Name | Domo: Synced | Status: $technology" | tee -a $LogFile
|
||||||
else
|
else
|
||||||
#Domo status sync
|
#Domo status sync
|
||||||
if [ "$device" = On ] ; then
|
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
|
curl -s "http://"$domoticzserverip"/json.htm?type=command¶m=switchlight&idx="$IDX"&switchcmd=On" 2>/dev/null 1>/dev/null
|
||||||
else
|
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
|
curl -s "http://"$domoticzserverip"/json.htm?type=command¶m=switchlight&idx="$IDX"&switchcmd=Off" 2>/dev/null 1>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
#Waiting if Device is online
|
#Waiting if Device is online
|
||||||
if [ "$device" = On ] ; then
|
if [ "$device" = On ] ; then
|
||||||
echo "$CurTime | Device: $Name | Status: Online, Waiting"
|
echo "$CurTime | Device: $Name | Status: Online, Waiting" | tee -a $LogFile
|
||||||
sleep 60
|
sleep 60
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user