-->
Page 1 of 2

Scan WLAN for given IP

PostPosted: Sat Oct 13, 2018 9:46 am
by KDB
Hello, I want to test whether specific devices ( iPhones of my Family ) are logged in the WLAN in our house. Dependent of the result light and heating will be controlled. I m using ESP 8266 01.
thanks

Re: Scan WLAN for given IP

PostPosted: Sat Oct 13, 2018 11:08 am
by btidey
Normally I would so ping is a good tool for checking whether a device is available on local network. There is a ping library that allows devices to be ping'd easily.

However, some portable devices can suspend responding to ping when they sleep. For example, some 'nougat' based Android phones will stop responding to ping after a few minutes of inactivity, even if the wifi always on setting is enabled.

I don't know about iPhones, so it would be worthwhile testing these with a regular desktop ping utility before embarking on this method.

Re: Scan WLAN for given IP

PostPosted: Sat Oct 13, 2018 5:08 pm
by btidey
If ping works on iPhone that still remains a good option.

I have done a bit more playing with my Samsung phone to try to understand what is going on that makes ping not a good technique.

Ping does stop when the Samsung android goes to sleep but the router still shows the presence of a wifi signal from that device. It looks like something is suspending much of the IP stack when it is asleep.

However, I thought that the phone must still be sending out a beacon packet regularly for the router to register the signal.

I used the minisniff project https://www.hackster.io/rayburne/esp826 ... iff-f6b93a to monitor the low level traffic. This does show the phone continuing to send packets whilst it is in sleep. These are recognised by their MAC address rather than IP address but that may be better to recognise devices as it is independent of any address allocation.

So one could in principle have code based on the sniffer just monitor these packets against a list of specified MAC addresses. A packet arriving would confirm the presence of that device. One would need to assume that if a packet did not arrive within a significant period of time (say 3 normal intervals) then that device was not present. That would not be suitable for rapid response e.g. lighting but may be Ok for heating.

Re: Scan WLAN for given IP

PostPosted: Sat Oct 13, 2018 6:27 pm
by AcmeUK
If you are sniffing for MAC addresses have a look here :- http://www.hackster.io/rayburne/esp8266-mini-sniff-f6b93a