mirror of https://github.com/arendst/Tasmota.git
Add BSSID and Signal Strength Indicator to GUI wifi scan result (#10253)
Add BSSID and Signal Strength Indicator to GUI wifi scan result (#10253)
This commit is contained in:
parent
31fedcb000
commit
83b3aa576d
|
@ -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)
|
- 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 for FTC532 8-button touch controller by Peter Franck (#10222)
|
||||||
- Support character `#` to be replaced by `space`-character in command ``Publish`` topic (#10258)
|
- 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
|
### Changed
|
||||||
- Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM
|
- Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM
|
||||||
|
|
|
@ -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)
|
- 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 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)
|
- 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
|
### Changed
|
||||||
- Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM
|
- Logging from fixed global memory buffer to stack buffer freeing 700 bytes RAM
|
||||||
|
|
|
@ -415,6 +415,7 @@
|
||||||
#define WEB_PORT 80 // Web server Port for User and Admin mode
|
#define WEB_PORT 80 // Web server Port for User and Admin mode
|
||||||
#define WEB_USERNAME "admin" // Web server Admin mode user name
|
#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_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_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_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)
|
#define USE_EMULATION_WEMO // Enable Belkin WeMo emulation for Alexa (+6k code, +2k mem common)
|
||||||
|
|
|
@ -472,6 +472,7 @@
|
||||||
|
|
||||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||||
//#undef USE_WEBSERVER // Disable Webserver
|
//#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_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
|
||||||
#define USE_EMULATION // Enable Hue emulation
|
#define USE_EMULATION // Enable Hue emulation
|
||||||
#define USE_EMULATION_HUE // Enable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
#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_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
|
||||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||||
//#undef USE_WEBSERVER // Disable Webserver
|
//#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_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
|
||||||
//#undef USE_EMULATION // Disable Wemo or Hue emulation
|
//#undef USE_EMULATION // Disable Wemo or Hue emulation
|
||||||
//#undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
//#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_MQTT_TLS // Disable TLS support won't work as the MQTTHost is not set
|
||||||
#undef USE_KNX // Disable KNX IP Protocol Support
|
#undef USE_KNX // Disable KNX IP Protocol Support
|
||||||
//#undef USE_WEBSERVER // Disable Webserver
|
//#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_WEBSEND_RESPONSE // Disable command WebSend response message (+1k code)
|
||||||
#undef USE_EMULATION // Disable Wemo or Hue emulation
|
#undef USE_EMULATION // Disable Wemo or Hue emulation
|
||||||
#undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
#undef USE_EMULATION_HUE // Disable Hue Bridge emulation for Alexa (+14k code, +2k mem common)
|
||||||
|
|
|
@ -651,6 +651,12 @@ const char HTTP_HEAD_STYLE_ZIGBEE[] PROGMEM =
|
||||||
#endif // USE_UNISHOX_COMPRESSION
|
#endif // USE_UNISHOX_COMPRESSION
|
||||||
#endif // USE_ZIGBEE
|
#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 =
|
const char HTTP_HEAD_STYLE3[] PROGMEM =
|
||||||
"</style>"
|
"</style>"
|
||||||
|
|
||||||
|
@ -2084,7 +2090,11 @@ void HandleWifiConfiguration(void)
|
||||||
|
|
||||||
WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode());
|
WSContentStart_P(PSTR(D_CONFIGURE_WIFI), !WifiIsInManagerMode());
|
||||||
WSContentSend_P(HTTP_SCRIPT_WIFI);
|
WSContentSend_P(HTTP_SCRIPT_WIFI);
|
||||||
|
#ifdef USE_ENHANCED_GUI_WIFI_SCAN
|
||||||
|
WSContentSendStyle_P(HTTP_HEAD_STYLE_SSI, WebColor(COL_TEXT));
|
||||||
|
#else
|
||||||
WSContentSendStyle();
|
WSContentSendStyle();
|
||||||
|
#endif // USE_ENHANCED_GUI_WIFI_SCAN
|
||||||
|
|
||||||
if (HTTP_MANAGER_RESET_ONLY != Web.state) {
|
if (HTTP_MANAGER_RESET_ONLY != Web.state) {
|
||||||
if (Webserver->hasArg("scan")) {
|
if (Webserver->hasArg("scan")) {
|
||||||
|
@ -2105,6 +2115,7 @@ void HandleWifiConfiguration(void)
|
||||||
indices[i] = i;
|
indices[i] = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// RSSI SORT
|
// RSSI SORT
|
||||||
for (uint32_t i = 0; i < n; i++) {
|
for (uint32_t i = 0; i < n; i++) {
|
||||||
for (uint32_t j = i + 1; j < n; j++) {
|
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("<div><a href='#p' onclick='c(this)'>%s</a><br>"), 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("<div title='%d dBm (%d%%)'>%s<span class='q'>(%d) <div class='si'>"),
|
||||||
|
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("<i class='b%d%s'></i>"), k, (num_bars < k) ? PSTR(" o30") : PSTR(""));
|
||||||
|
}
|
||||||
|
WSContentSend_P(PSTR("</span></div></div>"));
|
||||||
|
|
||||||
|
indices[j] = n;
|
||||||
|
}
|
||||||
|
delay(0);
|
||||||
|
}
|
||||||
|
WSContentSend_P(PSTR("</div>"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else // No USE_ENHANCED_GUI_WIFI_SCAN
|
||||||
// remove duplicates ( must be RSSI sorted )
|
// remove duplicates ( must be RSSI sorted )
|
||||||
String cssid;
|
String cssid;
|
||||||
for (uint32_t i = 0; i < n; i++) {
|
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"),
|
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);
|
WiFi.SSID(indices[i]).c_str(), WiFi.BSSIDstr(indices[i]).c_str(), WiFi.channel(indices[i]), rssi);
|
||||||
int quality = WifiGetRssiAsQuality(rssi);
|
int quality = WifiGetRssiAsQuality(rssi);
|
||||||
|
/*
|
||||||
int auth = WiFi.encryptionType(indices[i]);
|
int auth = WiFi.encryptionType(indices[i]);
|
||||||
char encryption[20];
|
char encryption[20];
|
||||||
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a> (%d) <span class='q'>%s %d%% (%d dBm)</span></div>"),
|
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a> (%d) <span class='q'>%s %d%% (%d dBm)</span></div>"),
|
||||||
|
@ -2143,9 +2196,17 @@ void HandleWifiConfiguration(void)
|
||||||
GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType),
|
GetTextIndexed(encryption, sizeof(encryption), auth +1, kEncryptionType),
|
||||||
quality, rssi
|
quality, rssi
|
||||||
);
|
);
|
||||||
delay(0);
|
*/
|
||||||
|
WSContentSend_P(PSTR("<div><a href='#p' onclick='c(this)'>%s</a> (%d) <span class='q'>%d%% (%d dBm)</span></div>"),
|
||||||
|
HtmlEscape(WiFi.SSID(indices[i])).c_str(),
|
||||||
|
WiFi.channel(indices[i]),
|
||||||
|
quality, rssi
|
||||||
|
);
|
||||||
|
|
||||||
|
delay(0);
|
||||||
}
|
}
|
||||||
|
#endif // USE_ENHANCED_GUI_WIFI_SCAN
|
||||||
|
|
||||||
WSContentSend_P(PSTR("<br>"));
|
WSContentSend_P(PSTR("<br>"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue