Could the ESP8266 be left with an open AP even after a reboot?
It seems that even if the ESP is reset after establishing a connection to a local network, the ESP8266 leaves the AP open. This has been verified with a network scan, showing open AI_THINKER modules.
Related https://arduino.stackexchange.com/questions/54372/how-to-turn-off-or-stop-access-point-network-in-esp8266
Summary of Testing – Open AP Issue on ESP8266 (AI_THINKER)
Background
We initially suspected the ESP8266 modules used in the SmartCitizen Kits were broadcasting open access points (AI-THINKER_XXXXXX) due to scheduled sanity reboots (e.g. daily at 4 AM). This was causing intermittent open APs visible on the network.
Configuration Changes Tested
Applied the following commands to two sensor units:
config -sanity off
config -pubint 60
power -sleep 0
offline -retryint 60
Observation Method
Used a Wi-Fi scanner running continuously over 24+ hours to log SSID "First Seen" and "Last Seen" timestamps.
Results
- No correlation with specific time (e.g. 4 AM).
- APs appear randomly and remain open for varying durations.
- Behavior did not improve after the config changes.
- Additional change: one device was set to WLAN Fallback Only Mode , but the issue persisted.
Visual Log
Attached are screenshots showing intermittent AP activity with timestamps across May 19–20, 2025.
How do you know that these networks are related to the SmartCitizen devices? I'm surprised by the name of these APs as AI Thinker is a hardware manufacturer but none used in current SmartCitizen hardware. Are the strings after the AI-THINKER part substrings of your SmartCitizen devices MAC addresses? Is it possible that other hardware (from AI Thinker) is opening those APs? Which SmartCitizen device generation(s) do you use?
Hi @pylonsoft,
The ESP8266 is manufactured by AI Thinker: https://en.ai-thinker.com/pro_view-59.html
The MAC address last 4 digits are shown after the AI-THINKER. @tonyrosset 's SCKs are 2.2s, which have the same Data Board (and ESP WiFi antennas) as the 2.3.
I think the issue is somewhere outside of our control. These SSIDs don't seem to appear anywhere though, I assume it'd be somewhere on the arduino core for the esp8266, but after some time looking I couldn't find anything...
First, I had difficulties to reproduce the problem. I change my scanning script to continuously scanning for APs and then I found those AI-THINKER networks. But for me they appear for a few seconds only and immediately disappear again. I guess that the problem is the time frame between powering up the ESP and configuring it's network. It seam that it opens it's default AP network in that time frame. The default network is named after the original manufacturer of the ESP module and that seems to be AI Thinker in our case. I compiled a new version of the firmware which deactivates WiFi at startup. This version is in test now, I will provide test results within the next days.
Thanks @pylonsoft Could you maybe share your script here to replicate? I had no success while doing it myself.
@oscgonfer: That's a quick hack in shell quite specific to my situation here. It's more or less a "iwlist scan 2> /dev/null | grep ESSID" with a few greps to remove the known networks, done in an endless loop. Theoretically we can grep directly for AI-THINKER as that's what we are interested in.
My patch works so far, I only see the outside node's network popping up but not the one of the patched node.
I was doing something similar: while true; do iwlist wlan0 scan | grep ESSID; sleep 0.1; done
If your patch works, we can link to an issue on power consumption on boot (which drains too much power when the SEN5X is connected). In any case, if you have a small test code that you can put in a branch, I can dig a bit on it as well.
So we do about the same, but it's very important that you run this as root as otherwise the actual scan is done only about every 5 minutes or so and all other calls simply return the cached data.
The patched node runs for almost a day now and I registered no network from that device. I still see the network from the other device (not patched) almost every other minute.
I'll make a pull request if I don't get a problem in the next few hours.
Solved by #97