Text item=Test_Presence valuecolor=[YES="green",NO="blue"]
iphonedetect.sh:
#!/bin/bash
declare -a DEVICES
sudo hping3 -2 -c 10 -p 5353 -i u1 xxx.xxx.xxx.xxx -q >/dev/null 2>&1
DEVICES=`arp -an | awk '{print $4}'`
CHECK="yy:yy:yy:yy:yy:yy"
if [[ ${DEVICES[*]} =~ $CHECK ]]
then
echo "YES"
else
echo "NO"
fi
where xxx.xxx.xxx.xxx is my Iphone’s IP address and yy:yy:yy:yy:yy:yy is my Iphone’s MAC address.
However, it can not run properly, the status of the string “At Home” is always NO, so i check the command:
I received a message told me that the connection was 100% lost, did I do something wrong? Please show me how to fix it, I want whenever I log in my home wifi network, the string At Home must change accordingly.
As far as I know, there is another way of presence detection system using owntracks, I’ll dig into it, but first, can anyone please could show me what did I do wrong?
Hello,
I´ve made the experience that detecting the iPhone is not really working well for me, as it often drops out from the WLAN network when going to sleep. Maybe trying with Bluetooth would help.
OwnTracks may be worth a try, depending on GPS accuracy this works well and has the advantage that if you are working e.g. in the garage or garden it does not show you as not at home.
Regards,
Oggerschummer
when I use the normal ping (sudo ping xxx.xxx.xxx.xxx) , it was totally ok! I sended and received all the packets, however if I use sudo hping3, 100% lost packet,
Oh, this is my router problem, I figured out that my router can not recognize my Iphone’s MAC address, so I try another router, everything works now, thanks jaydee very much