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!