-->
Page 1 of 1

wifi.eventmon.AP_STADISCONNECTED problem

PostPosted: Fri Sep 02, 2016 3:44 am
by morski_bg
Hello!
As usual - I'm quite new to Lua and esp8266.
The goal is to create some sort of proximity switch.
The idea is to use esp8266 in SoftAP mode and when my phone (with proper password data) is connected, esp8266 to toggle one GPIO pin, and toggle again when disconnected.
The realization so far - using "wifi.eventmon.AP_STACONNECTED"( and its T.MAC == my_pnone MAC) to detect when my phone is connected , and respectively "wifi.eventmon.AP_STADISCONNECTED" to detect disconnection.
So, everything is working as expected if I disconnect the phone manually by pressing its "WiFi off" button or by choosing another nearby wifi. But if I just walk away from esp8266 with the phone "wifi.eventmon.AP_STADISCONNECTED" fails to detect disconnection, even my phone is already connect to another wifi.
Is this normal behavior of "wifi.eventmon.AP_STADISCONNECTED" or I'm missing something?
Thnaks!

Re: wifi.eventmon.AP_STADISCONNECTED problem

PostPosted: Fri Sep 02, 2016 10:19 am
by marcelstoer
First up, I don't know the answer, I can only speculate. But...the behavior doesn't strike me as illogical.

Your client doesn't really disconnect, does it? It just leaves the AP WiFi range - and may bounce back, or not. To properly detect such cases the AP would have to probe all connected clients for reachability (-> lots of WiFi noise).

Re: wifi.eventmon.AP_STADISCONNECTED problem

PostPosted: Fri Sep 02, 2016 11:18 am
by morski_bg
Hi, thanks for your response.
I can confirm that when I walked away from esp8266 with the phone, it connects to another wifi (my home router), but there isn't any AP_DISCONNCTED event. I presume that SDK function responsible for this is wifi_softap_get_station_info(). After quick googling found some similar complains.
Regards

Re: wifi.eventmon.AP_STADISCONNECTED problem

PostPosted: Mon Sep 10, 2018 11:05 am
by cmstephan
Hi- did you find a solution for your problem. I am facing the same situation and need to know when a client is out of range of the esp. Thx