[Network Binding] Detection of Android device fails when it sleeps

I have trouble detecting my phone (Moto G5) with the network binding for a presence rule. Detection works when I am using the phone, but fails when the phone is sleeping for a few minutes. When waking the device up it is detected immediately (and not after the defined ping interval time, might be important).

I read that there are also problems with iPhones.

Is there an easy solution to this or should I use a different method to detect presence?

This would be my guess:

I own a Moto G5, but there is the same setting. Unfortunately it is already set to “yes”, so this is not the reason.

I am having similar trouble with a Nexus 6 too, and iphones are even more stubborn as they go into a deep sleep very frequently.
There are quite a few threads on this forum (search for presence detection) and most people seem to only get a reasonable success rate if more than one presence detection mechanism is employed (network, owntracks, bluetooth, icloud, etc etc)
But in any case make sure you read the threads on using icloud, hping3 and arp for iphone detection and owntracks etc for all. One of them may work also for your phone.

Thanks for your answer. All of the solutions seem to require some work, right? So it is not possible to just install a binding and set it up or change something in the network binding?

If that is the case, I will look into a different presence detection for now, as I don’t want to have much overload just because of that.

All require work, correct. Reliable presence detection appears to be one of the most challenging things in home automation, at least if it is desired to be setup to deal with all edge cases. Again, I can only recommend to read the forum, lots has been written, some good ideas have been presented. As indicated most have put several services together to make it work (cell phone presence detection, motion detectors, etc). From what I read, this can work like a charm, but you will need to invest considerable (at the very least time) to make it work. Good luck.

The network binding will soon get the ability to use arp ping (works for android all the time) and does the same thing as hping3 (udp port knock + arp ping). So hopefully the binding can be of more use in the future.

Cheers, David

5 Likes

I already did some research after starting this topic and saw your PR on GitHub. Nice to hear that this will probably fix my problem.

can you publish the link to the PR here so we can track it

thanks

There you go: https://github.com/openhab/openhab2-addons/pull/2380

I know this is old, this is now resolved with Android Pie update. Previously my device fall asleep it would go offline in openhab, since PIE update my device shows online whenever I’m within my router regardless of sleep or not.

But that’s exactly what we want to accomplish with arping and all that complex detection methods that are integrated?!

I’m just stating that latest android version fixes previous energy saving issues.

Ok, so by

you probably meant

this is now resolved

However, by using arping it should have been detected also with previous Android versions, at least for me that worked. So actually this has been resolved long ago already.

correct on both my wife’s note 8 and my note 9, after device would go to sleep ARP no longer worked. However with latest PIE update, we’re both functioning.

Ah ok, so arping did not work for you in the past and now they are working with arping? Because for me arping always worked.

I started a thread here:

But, since I see recent activty here I thought I’d ask…

When going from OH 1.x to 2.x I now have network binding 2.5.

Before I had set up a ting for my phone and it was using ping. Never worked when the phone when to sleep.

I’m guessing update to 2.5 in the binding didn’t change it to using arping…but, I con’t figure out if I can change the existing thing from ping to arping.

As I noted in the other thread, arping from the comandline does find the phone in sleep mode, but, not 100% of the times it is arped. For example:

sudo arping -W 10 -c 10 -I eth0 192.168.xx.251
[sudo] password for openhabian:
ARPING 192.168.xx.251
60 bytes from fc:db:b3:75:c3:8d (192.168.xx.251): index=0 time=4.618 sec
60 bytes from fc:db:b3:75:c3:8d (192.168.xx.251): index=1 time=12.758 msec
Timeout
Timeout
Timeout
Timeout
Timeout
60 bytes from fc:db:b3:75:c3:8d (192.168.xx.251): index=2 time=101.627 msec
Timeout
Timeout

--- 192.168.xx.251 statistics ---
10 packets transmitted, 3 packets received,  70% unanswered (0 extra)
rtt min/avg/max/std-dev = 12.758/1577.564/4618.306/2150.436 ms

Although I did not understand your request completely it seems that you recently changed to openHAB 2 and have now problems setting up arping correctly for the network binding?

Additionally you seem to have questions about the detection with arping since somtimes the ping from terminal results in Timeouts?

So regarding the setup I would like to forward you to the openHAB docs where you will hopefully find enough information to setup arping correctly for your thing. If not, please create a seperate thread.

I cannot help regarding the Timeouts, just that it might not be relevant, so just test after you set up your thing properly.