'Bash/Pinger/BTPing.sh.examp' updaten

This commit is contained in:
2020-02-20 10:32:12 +00:00
parent 7ed3746f04
commit 975121e31c

View File

@@ -14,7 +14,7 @@ do
bt1=$(l2ping -c5 -s32 -t1000 "$bluetoothmac" > /dev/null 2>&1 && echo "On" || echo "Off")
if [[ $bt1 == 'On' ]]; then
device="On"
technology="Online using: Bluetooth 1"
technology="Online, Bluetooth 1"
success="yes"
fi
@@ -28,7 +28,7 @@ if [[ $success != 'yes' ]]; then
bt2=$(l2ping -c5 -s32 -t1000 "$bluetoothmac" > /dev/null 2>&1 && echo "On" || echo "Off")
if [[ $bt2 == 'On' ]]; then
device="On"
technology="Online using: Bluetooth 2"
technology="Online, Bluetooth 2"
success="yes"
fi
fi
@@ -47,10 +47,10 @@ echo "Current status: $technology"
else
echo "Status desynchronized, resynchronizing..."
if [ "$device" = On ] ; then
echo "$Name" "set Online"
echo "$CurTime | Device: $Name | Sync: Online"
curl -s "http://"$domoticzserverip"/json.htm?type=command&param=switchlight&idx="$IDX"&switchcmd=On" 2>/dev/null 1>/dev/null
else
echo "$Name" "set Offline"
echo "$CurTime | Device: $Name | Sync: Offline"
curl -s "http://"$domoticzserverip"/json.htm?type=command&param=switchlight&idx="$IDX"&switchcmd=Off" 2>/dev/null 1>/dev/null
fi
fi
@@ -60,4 +60,9 @@ if [[ $success != 'yes' ]]; then
sleep 10
fi
#Waiting if Device is online
if [ "$device" = On ] ; then
echo "$CurTime | Device: $Name | Status: Online, Waiting"
sleep 60
done