@@ -165,6 +165,31 @@ std::string format_mac_addr(const uint8_t mac[6]) {
165
165
166
166
void WiFiComponent::start_connecting (const WiFiAP &ap, bool two) {
167
167
ESP_LOGI (TAG, " WiFi Connecting to '%s'..." , ap.get_ssid ().c_str ());
168
+ #ifdef ESPHOME_LOG_HAS_VERBOSE
169
+ ESP_LOGV (TAG, " Connection Params:" );
170
+ ESP_LOGV (TAG, " SSID: '%s'" , ap.get_ssid ().c_str ());
171
+ if (ap.get_bssid ().has_value ()) {
172
+ bssid_t b = *ap.get_bssid ();
173
+ ESP_LOGV (TAG, " BSSID: %02X:%02X:%02X:%02X:%02X:%02X" , b[0 ], b[1 ], b[2 ], b[3 ], b[4 ], b[5 ]);
174
+ } else {
175
+ ESP_LOGV (TAG, " BSSID: Not Set" );
176
+ }
177
+ ESP_LOGV (TAG, " Password: " LOG_SECRET (" '%s'" ), ap.get_password ());
178
+ if (ap.get_channel ().has_value ()) {
179
+ ESP_LOGV (TAG, " Channel: %u" , *ap.get_channel ());
180
+ } else {
181
+ ESP_LOGV (TAG, " Channel: Not Set" );
182
+ }
183
+ if (ap.get_manual_ip ().has_value ()) {
184
+ ManualIP m = *ap.get_manual_ip ();
185
+ ESP_LOGV (TAG, " Manual IP: Static IP=%s Gateway=%s Subnet=%s DNS1=%s DNS2=%s" , m.static_ip .toString ().c_str (),
186
+ m.gateway .toString ().c_str (), m.subnet .toString ().c_str (), m.dns1 .toString ().c_str (),
187
+ m.dns2 .toString ().c_str ());
188
+ } else {
189
+ ESP_LOGV (TAG, " Using DHCP IP" );
190
+ }
191
+ ESP_LOGV (TAG, " Hidden: %s" , YESNO (ap.get_hidden ()));
192
+ #endif
168
193
169
194
if (!this ->wifi_sta_connect_ (ap)) {
170
195
ESP_LOGE (TAG, " wifi_sta_connect_ failed!" );
@@ -308,16 +333,21 @@ void WiFiComponent::check_scanning_finished() {
308
333
309
334
WiFiAP ap;
310
335
WiFiScanResult scan_res = this ->scan_result_ [0 ];
311
- ap.set_ssid (scan_res.get_ssid ());
312
- ap.set_bssid (scan_res.get_bssid ());
313
- ap.set_channel (scan_res.get_channel ());
314
336
for (auto &ap2 : this ->sta_ ) {
315
337
if (scan_res.matches (ap2)) {
316
- if (ap.get_ssid ().empty ()) {
338
+ if (ap2.get_hidden ()) {
339
+ // selected network is hidden
340
+ ap.set_hidden (true );
341
+ ap.set_ssid (scan_res.get_ssid ());
342
+ } else {
343
+ // selected network is visible
344
+ ap.set_hidden (false );
317
345
ap.set_ssid (ap2.get_ssid ());
346
+ ap.set_channel (scan_res.get_channel ());
347
+ ap.set_bssid (scan_res.get_bssid ());
318
348
}
319
- ap.set_password (ap2.get_password ());
320
349
ap.set_manual_ip (ap2.get_manual_ip ());
350
+ ap.set_password (ap2.get_password ());
321
351
break ;
322
352
}
323
353
}
0 commit comments