From 58e608b38387ed94b3d84021f0148a5485d40e10 Mon Sep 17 00:00:00 2001 From: SteWers <42718143+SteWers@users.noreply.github.com> Date: Sat, 6 Dec 2025 11:44:37 +0100 Subject: [PATCH] Update BLE MI and TRV (#24188) - Changed RSSI display format to 'xx% (-yy dBm)' in EQ3 TRV and MI BLE sensor WebUI - Show BLE data in WebUI only when BLE is enabled - Disable BLE when device is in boot loop --- tasmota/tasmota.ino | 1 + tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino | 9 +++++++++ .../tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino | 8 ++++++-- tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino | 11 ++++++++--- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/tasmota/tasmota.ino b/tasmota/tasmota.ino index c9f31b76c..c1f911f3b 100644 --- a/tasmota/tasmota.ino +++ b/tasmota/tasmota.ino @@ -634,6 +634,7 @@ void setup(void) { Settings->rule_enabled = 0; // Disable all rules Settings->flag3.shutter_mode = 0; // disable shutter support TasmotaGlobal.no_autoexec = true; + Settings->flag5.mi32_enable = false; // disable BLE } if (RtcReboot.fast_reboot_count > Settings->param[P_BOOT_LOOP_OFFSET] +3) { // Restarted 5 times for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) { diff --git a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino index 369a34d95..22ce22687 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino @@ -158,6 +158,15 @@ i.e. the Bluetooth of the ESP can be shared without conflict. #include "NimBLEEddystoneTLM.h" #include "NimBLEBeacon.h" +// The LOG_LEVEL macros are used to set the log level for the NimBLE stack, but they pollute the global namespace and would override the loglevel enum of Tasmota. +// So we undefine them here to avoid conflicts. +#undef LOG_LEVEL_DEBUG +#undef LOG_LEVEL_INFO +#undef LOG_LEVEL_WARN +#undef LOG_LEVEL_ERROR +#undef LOG_LEVEL_CRITICAL +#undef LOG_LEVEL_NONE + // assume this hack is still valid. #define DEPENDSONNIMBLEARDUINO 1 #ifdef DEPENDSONNIMBLEARDUINO diff --git a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino index 105b29b36..5be3c5cea 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino @@ -19,6 +19,8 @@ -------------------------------------------------------------------------------------------- Version yyyymmdd Action Description -------------------------------------------------------------------------------------------- + 1.0.1.1 20251204 changed - display RSSI in general format "xx% (-yy dBm)" + view on UI only when BLE enabled 1.0.1.0 20240113 publish - Add some values to WebUI; code cleanup 1.0.0.0 20210910 publish - renamed to xdrv_85, and checked with TAS latest dev branch 0.0.0.0 20201213 created - initial version @@ -991,13 +993,15 @@ int EQ3SendResult(char *requested, const char *result){ #ifdef USE_WEBSERVER const char HTTP_EQ3_TYPE[] PROGMEM = "{s}%s " D_NEOPOOL_TYPE "{m}EQ3{e}"; const char HTTP_EQ3_MAC[] PROGMEM = "{s}%s " D_MAC_ADDRESS "{m}%s{e}"; -const char HTTP_EQ3_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}"; +const char HTTP_EQ3_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d%% (%d dBm){e}"; const char HTTP_EQ3_TEMPERATURE[] PROGMEM = "{s}%s " D_THERMOSTAT_SET_POINT "{m}%*_f " D_UNIT_DEGREE "%c{e}"; const char HTTP_EQ3_DUTY_CYCLE[] PROGMEM = "{s}%s " D_THERMOSTAT_VALVE_POSITION "{m}%d " D_UNIT_PERCENT "{e}"; const char HTTP_EQ3_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%s{e}"; void EQ3Show(void) { + if (!Settings->flag5.mi32_enable) return; + char c_unit = D_UNIT_CELSIUS[0]; // ToDo: Check if fahrenheit is possible -> temp_format==TEMP_CELSIUS ? D_UNIT_CELSIUS[0] : D_UNIT_FAHRENHEIT[0]; bool FirstSensorShown = false; @@ -1016,7 +1020,7 @@ void EQ3Show(void) label = tlabel; } WSContentSend_P(HTTP_EQ3_MAC, label, addrStr(EQ3Devices[i].addr)); - WSContentSend_PD(HTTP_EQ3_RSSI, label, EQ3Devices[i].RSSI); + WSContentSend_PD(HTTP_EQ3_RSSI, label, WifiGetRssiAsQuality(EQ3Devices[i].RSSI), EQ3Devices[i].RSSI); WSContentSend_PD(HTTP_EQ3_TEMPERATURE, label, Settings->flag2.temperature_resolution, &EQ3Devices[i].TargetTemp, c_unit); WSContentSend_P(HTTP_EQ3_DUTY_CYCLE, label, EQ3Devices[i].DutyCycle); WSContentSend_P(HTTP_EQ3_BATTERY, label, EQ3Devices[i].Battery ? D_NEOPOOL_LOW : D_OK); diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino index 32f842112..50b4b0318 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -20,11 +20,14 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ -#define MI32_VERSION "V0.9.2.6" +#define MI32_VERSION "V0.9.2.7" /* -------------------------------------------------------------------------------------------- Version yyyymmdd Action Description -------------------------------------------------------------------------------------------- + 0.9.2.7 20251204 changed - display RSSI in general format "xx% (-yy dBm)" + view on UI only when BLE enabled + ------- 0.9.2.6 20250503 changed - display alias instead of type, when present ------- 0.9.2.5 20250319 changed - added support for MI LYWSD02MMC with different device ID @@ -2749,7 +2752,7 @@ void CmndMi32Keys(void){ const char HTTP_MI32[] PROGMEM = "{s}MI ESP32 " MI32_VERSION "{m}%u%s / %u{e}"; const char HTTP_MI32_TYPE[] PROGMEM = "{s}%s " D_SENSOR"{m}%s{e}"; const char HTTP_MI32_MAC[] PROGMEM = "{s}%s " D_MAC_ADDRESS "{m}%s{e}"; -const char HTTP_MI32_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}"; +const char HTTP_MI32_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d%% (%d dBm){e}"; const char HTTP_MI32_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%u %%{e}"; const char HTTP_MI32_LASTBUTTON[] PROGMEM = "{s}%s Last Button{m}%u{e}"; const char HTTP_MI32_EVENTS[] PROGMEM = "{s}%s Events{m}%u{e}"; @@ -3527,6 +3530,8 @@ void MI32Show(bool json) #ifdef USE_WEBSERVER } else { + if (!Settings->flag5.mi32_enable) return; + static uint16_t _page = 0; static uint16_t _counter = 0; int32_t i = _page * MI32.perPage; @@ -3559,7 +3564,7 @@ void MI32Show(bool json) char _MAC[18]; ToHex_P(p->MAC,6,_MAC,18);//,':'); WSContentSend_P(HTTP_MI32_MAC, label, _MAC); - WSContentSend_PD(HTTP_MI32_RSSI, label, p->RSSI); + WSContentSend_PD(HTTP_MI32_RSSI, label, WifiGetRssiAsQuality(p->RSSI), p->RSSI); // for some reason, display flora differently switch(p->type){