[SOLVED] Cell Phone State keeps going to OFF

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.

Thanks

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).

https://linux.die.net/man/8/arping

To know which interface you need:

ip link show

okay so at least im getting somehwere :slight_smile:

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?

Thanks

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ā€¦

Thanks

Hi William,

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