diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c8911bad..4e938070f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. - Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs (#10196) - Support for FTC532 8-button touch controller by Peter Franck (#10222) - Support character `#` to be replaced by `space`-character in command ``Publish`` topic (#10258) +- BSSID and Signal Strength Indicator to GUI wifi scan result (#10253) ### Changed - Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM diff --git a/RELEASENOTES.md b/RELEASENOTES.md index 04a07fa85..b3c8ada89 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -64,6 +64,7 @@ The attached binaries can also be downloaded from http://ota.tasmota.com/tasmota - Gpio ``Option_a1`` enabling PWM2 high impedance if powered off as used by Wyze bulbs [#10196](https://github.com/arendst/Tasmota/issues/10196) - Support for FTC532 8-button touch controller by Peter Franck [#10222](https://github.com/arendst/Tasmota/issues/10222) - Support character `#` to be replaced by `space`-character in command ``Publish`` topic [#10258](https://github.com/arendst/Tasmota/issues/10258) +- BSSID and Signal Strength Indicator to GUI wifi scan result [#10253](https://github.com/arendst/Tasmota/issues/10253) ### Changed - Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index e75f54ee5..f649f3664 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -415,6 +415,7 @@ #define WEB_PORT 80 // Web server Port for User and Admin mode #define WEB_USERNAME "admin" // Web server Admin mode user name // #define USE_JAVASCRIPT_ES6 // Enable ECMAScript6 syntax using less JavaScript code bytes (fails on IE11) + #define USE_ENHANCED_GUI_WIFI_SCAN // Enable wifi scan output with BSSID (+0k5 code) // #define USE_WEBSEND_RESPONSE // Enable command WebSend response message (+1k code) #define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common) #define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common) diff --git a/tasmota/tasmota_configurations.h b/tasmota/tasmota_configurations.h index 7b5e63372..52bd19c58 100644 --- a/tasmota/tasmota_configurations.h +++ b/tasmota/tasmota_configurations.h @@ -472,6 +472,7 @@ #undef USE_KNX // Disable KNX IP Protocol Support //#undef USE_WEBSERVER // Disable Webserver +#undef USE_ENHANCED_GUI_WIFI_SCAN // Disable wifi scan output with BSSID (+0k5 code) //#undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code) #define USE_EMULATION // Enable Hue emulation #define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common) @@ -607,6 +608,7 @@ #undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set #undef USE_KNX // Disable KNX IP Protocol Support //#undef USE_WEBSERVER // Disable Webserver +#undef USE_ENHANCED_GUI_WIFI_SCAN // Disable wifi scan output with BSSID (+0k5 code) #undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code) //#undef USE_EMULATION // Disable Wemo or Hue emulation //#undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common) @@ -739,6 +741,7 @@ //#undef USE_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set #undef USE_KNX // Disable KNX IP Protocol Support //#undef USE_WEBSERVER // Disable Webserver +#undef USE_ENHANCED_GUI_WIFI_SCAN // Disable wifi scan output with BSSID (+0k5 code) #undef USE_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code) #undef USE_EMULATION // Disable Wemo or Hue emulation #undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common) diff --git a/tasmota/xdrv_01_webserver.ino b/tasmota/xdrv_01_webserver.ino index 243ab46d5..82dd3b182 100644 --- a/tasmota/xdrv_01_webserver.ino +++ b/tasmota/xdrv_01_webserver.ino @@ -651,6 +651,12 @@ const char HTTP_HEAD_STYLE_ZIGBEE[] PROGMEM = #endif // USE_UNISHOX_COMPRESSION #endif // USE_ZIGBEE +const char HTTP_HEAD_STYLE_SSI[] PROGMEM = + // Signal Strength Indicator + ".si{display:inline-flex;align-items:flex-end;height:15px;padding:0}" + ".si i{width:3px;margin-right:1px;border-radius:3px;background-color:#%06x}" + ".si .b0{height:25%%}.si .b1{height:50%%}.si .b2{height:75%%}.si .b3{height:100%%}.o30{opacity:.3}"; + const char HTTP_HEAD_STYLE3[] PROGMEM = "" @@ -2084,7 +2090,11 @@ void HandleWifiConfiguration(void) WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode()); WSContentSend_P(HTTP_SCRIPT_WIFI); +#ifdef USE_ENHANCED_GUI_WIFI_SCAN + WSContentSendStyle_P(HTTP_HEAD_STYLE_SSI, WebColor(COL_TEXT)); +#else WSContentSendStyle(); +#endif // USE_ENHANCED_GUI_WIFI_SCAN if (HTTP_MANAGER_RESET_ONLY != Web.state) { if (Webserver->hasArg("scan")) { @@ -2105,6 +2115,7 @@ void HandleWifiConfiguration(void) indices[i] = i; } + // RSSI SORT for (uint32_t i = 0; i < n; i++) { for (uint32_t j = i + 1; j < n; j++) { @@ -2114,6 +2125,47 @@ void HandleWifiConfiguration(void) } } +#ifdef USE_ENHANCED_GUI_WIFI_SCAN + //display networks in page + for (uint32_t i = 0; i < n; i++) { + if (indices[i] < n) { + int32_t rssi = WiFi.RSSI(indices[i]); + String ssid = WiFi.SSID(indices[i]); + DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), + ssid.c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi); + + // Print SSID + WSContentSend_P(PSTR("
%s
"), HtmlEscape(ssid).c_str()); + + String nextSSID = ""; + // Handle all APs with the same SSID + for (uint32_t j = 0; j < n; j++) { + if ((indices[j] < n) && ((nextSSID = WiFi.SSID(indices[j])) == ssid)) { + // Update RSSI / quality + rssi = WiFi.RSSI(indices[j]); + uint32_t rssi_as_quality = WifiGetRssiAsQuality(rssi); + uint32_t num_bars = changeUIntScale(rssi_as_quality, 0, 100, 0, 4); + + // Print item + WSContentSend_P(PSTR("
%s(%d)
"), + rssi, rssi_as_quality, + WiFi.BSSIDstr(indices[j]).c_str(), + WiFi.channel(indices[j]) + ); + // Print signal strength indicator + for (uint32_t k = 0; k < 4; ++k) { + WSContentSend_P(PSTR(""), k, (num_bars < k) ? PSTR(" o30") : PSTR("")); + } + WSContentSend_P(PSTR("
")); + + indices[j] = n; + } + delay(0); + } + WSContentSend_P(PSTR("
")); + } + } +#else // No USE_ENHANCED_GUI_WIFI_SCAN // remove duplicates ( must be RSSI sorted ) String cssid; for (uint32_t i = 0; i < n; i++) { @@ -2135,6 +2187,7 @@ void HandleWifiConfiguration(void) DEBUG_CORE_LOG(PSTR(D_LOG_WIFI D_SSID " %s, " D_BSSID " %s, " D_CHANNEL " %d, " D_RSSI " %d"), WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi); int quality = WifiGetRssiAsQuality(rssi); +/* int auth = WiFi.encryptionType(indices[i]); char encryption[20]; WSContentSend_P(PSTR("
%s (%d) %s %d%% (%d dBm)
"), @@ -2143,9 +2196,17 @@ void HandleWifiConfiguration(void) GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType), quality, rssi ); - delay(0); +*/ + WSContentSend_P(PSTR("
%s (%d) %d%% (%d dBm)
"), + HtmlEscape(WiFi.SSID(indices[i])).c_str(), + WiFi.channel(indices[i]), + quality, rssi + ); + delay(0); } +#endif // USE_ENHANCED_GUI_WIFI_SCAN + WSContentSend_P(PSTR("
")); } } else {