[wifi] Add "blind_connect" and "bulk_connect" to avoid a network scan and speedup connection/reduce energy footprint #3257
Replies: 4 comments 2 replies
-
🏷️ I've automatically added the |
Beta Was this translation helpful? Give feedback.
-
Thinking back about it I'm wondering how a blind connect or bulk connect could work without even telling which WiFi channel and frequency have to be used... |
Beta Was this translation helpful? Give feedback.
-
Gemini flash 2.5 confirms that while not strictly needed, to get the best speedup specifying the bssid and the WiFi channel would be preferred. Without them (ok, providing the bssid is already possible in esphome) a shorter scan for the network specified would be automatically performed by the framework. |
Beta Was this translation helpful? Give feedback.
-
I'm not sure I get the difference between |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Component name
wifi
Link to component documentation on our website
https://esphome.io/components/wifi
Describe the enhancement
Disclaimer Analysis and proposal down below obtained with thelp of Gemini 2.5 Pro and chatGPT o3.
Previous discussion in esphome/esphome#9947
Currently, when fast_connect is not enabled, ESPHome will perform a full Wi-Fi scan before attempting to connect to any of the known networks (single or multiple, depending on settings).
Start Connection: The process begins in the WiFiComponent::start() function. After some initial setup, it checks if fast_connect_ is enabled.
Initiate Scan: Since fast_connect_ is false, the code proceeds to the else block, which immediately calls this->start_scanning(). This function initiates a scan for all available Wi-Fi networks in the vicinity.
Process Scan Results: Once the scan is complete, the check_scanning_finished() function is executed. This function does the following:
It iterates through all the networks discovered during the scan.
It compares each discovered network against the list of networks provided in the configuration to find matches.
The matching networks are then sorted. The primary sorting criterion is the network's priority (if set), and the secondary criterion is the signal strength (RSSI). The network with the highest priority and/or best signal is placed at the top of the list.
Attempt Connection: The device then attempts to connect to the best-matching network from the sorted scan results. It uses the specific details from the scan (like the BSSID and channel) combined with the credentials (like the password) from your configuration.
I tested it personally and I can confirm it takes a long time to connect to one of the known network, even if I know for sure they are available. This adds a significant delay in connection time.
I asked chatgpt o4-mini-high for:
and I got:
init.py:
wifi_component.h:
wifi_component.cpp:
Its remarks:
Use cases
blind_connect allows to reduce connection time as much as possible while maintaining the preset priorities, assuming the networks provided are known to be available. This also reduces energy consumption as much as possible.
bulk_connect trades the maintaining of the priorities set in exchange for tolerance to missing networks.
Anything else?
No response
Beta Was this translation helpful? Give feedback.
All reactions