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