Do you have multiple network interfaces - ie ethernet and WiFi? If so, you will need to use the -I option in addition, to specify which network interface to use.
I do have wired and wireless, but with the same router. So do I just add the -I or -I etho, which I believe is the name of the interface? I have only seen one interface listed so not sure on this.
so instead of this --> arping -c 5 192.168.1.10
I would do this -->? arping -I etho -c 5 192.168.1.10
Sorry I’m not at home so I cannot try this right now it will have to wait until tonight.
he’s referring to the network interface of the device where you issue the command. In this case, where your OH is running. If your OH device has more than network interface, you need to use the one that OH is using (basically the same gateway as the device you’re trying to ping).
To know which interface you need:
ip link show
okay so at least im getting somehwere
I got this response:
[19:48:08] openhabian@openHABianPi:~$ arping -I eth0 -c 5 192.168.1.10 ARPING 192.168.1.10 from 192.168.1.22 eth0 Unicast reply from 192.168.1.10 [my phone MAC address] 45.494ms Unicast reply from 192.168.1.10 [my phone MAC address] 73.369ms Unicast reply from 192.168.1.10 [my phone MAC address] 200.381ms Unicast reply from 192.168.1.10 [my phone MAC address] 18.723ms Unicast reply from 192.168.1.10 [my phone MAC address] 54.717ms Sent 5 probes (1 broadcast(s)) Received 5 response(s)
So that means arp is working and can see the iPhone, so how do I get OH so use it?
The iPhone is still going to sleep and disconnecting from the network and OH is not finding it.
Within about 10 or 15 seconds of the phone screen going off the living room lights turn off. I guess because its disconnected from the network and OH thinks I left.
So if arping is working how do I get OH to use it?
So I changed the retry intervals to 5 instead of 1 in the setting of my iPhone binding.
I also changed /arp to /arpd in the network binding. So far it seems to be working I check it periodically and it says the phone is on, the last seen is a few minutes old but I can live with that.
Hope it keeps working, I’ll update as needed…
I’ve been working for quite some time (months) on detection of iPhone / Andriod mobiles on the local network. At the end I switched to IFTTT with location based detection, setting an OH Item status. Reason is that iPhone will fall into deep-sleep mode and doesn’t respond to arp requests. It doesn’t matter if you ping, hping3 or other methods as they will all fail if the iPhone doesn’t answer to the arp request. Had lots of false positives telling I’m not home, resulting in the alarm system being turned on while I was in the house.
Android did answers better, iPhone not due to deep-sleep mode.
This does not match my experience. I use the hping3 method primarily because the Docker image doesn’t come with arping and I’ve yet to have the iPhone not be reported as present when it was present. I do use some timers to prevent flapping so maybe that is hiding some switching between ON and OFF that I haven’t looked for in the logs, but even an undisturbed iPhone left alone for 12 hours, in my experience, still is detected.
In other threads, there are reports of getting very rock steady detection with proper arping settings. What those settings are I can’t say, I don’t use arping, but many have been very successful with both hping3 and arping.
There is also the iCloud binding which based on what I’ve read, works better than IFTTT or OwnTracks for geolocation tracking on iPhones.
Good to hear that it works for you Rich. In my approach I had a check every minute, with a 25 times in a row failure in case a single hping3 was missed. Even then the iPhone didn’t respond to hping3 to UDP port 5353 for 25 minutes.
The success/failure might be caused by having an AppleTV, AirPort or other device on the network that supports Bonjour Sleep Proxy functionality and the firmware version on the iPhone. (https://en.wikipedia.org/wiki/Bonjour_Sleep_Proxy). This will allow the iPhone to go into deep sleep and by that ignore the hping3 checks. Do a sniff on the network and see if there are “sleepy” dns requests from the iPhone.
Hope this helps for the ones that do experience the same I had.
Android Pie update fixes the sleep ARP issue. FYI