Skip to content

Commit 58e608b

Browse files
authored
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
1 parent 960b42a commit 58e608b

File tree

4 files changed

+24
-5
lines changed

4 files changed

+24
-5
lines changed

tasmota/tasmota.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ void setup(void) {
634634
Settings->rule_enabled = 0; // Disable all rules
635635
Settings->flag3.shutter_mode = 0; // disable shutter support
636636
TasmotaGlobal.no_autoexec = true;
637+
Settings->flag5.mi32_enable = false; // disable BLE
637638
}
638639
if (RtcReboot.fast_reboot_count > Settings->param[P_BOOT_LOOP_OFFSET] +3) { // Restarted 5 times
639640
for (uint32_t i = 0; i < nitems(Settings->my_gp.io); i++) {

tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,15 @@ i.e. the Bluetooth of the ESP can be shared without conflict.
158158
#include "NimBLEEddystoneTLM.h"
159159
#include "NimBLEBeacon.h"
160160

161+
// 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.
162+
// So we undefine them here to avoid conflicts.
163+
#undef LOG_LEVEL_DEBUG
164+
#undef LOG_LEVEL_INFO
165+
#undef LOG_LEVEL_WARN
166+
#undef LOG_LEVEL_ERROR
167+
#undef LOG_LEVEL_CRITICAL
168+
#undef LOG_LEVEL_NONE
169+
161170
// assume this hack is still valid.
162171
#define DEPENDSONNIMBLEARDUINO 1
163172
#ifdef DEPENDSONNIMBLEARDUINO

tasmota/tasmota_xdrv_driver/xdrv_85_esp32_ble_eq3_trv.ino

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
--------------------------------------------------------------------------------------------
2020
Version yyyymmdd Action Description
2121
--------------------------------------------------------------------------------------------
22+
1.0.1.1 20251204 changed - display RSSI in general format "xx% (-yy dBm)"
23+
view on UI only when BLE enabled
2224
1.0.1.0 20240113 publish - Add some values to WebUI; code cleanup
2325
1.0.0.0 20210910 publish - renamed to xdrv_85, and checked with TAS latest dev branch
2426
0.0.0.0 20201213 created - initial version
@@ -991,13 +993,15 @@ int EQ3SendResult(char *requested, const char *result){
991993
#ifdef USE_WEBSERVER
992994
const char HTTP_EQ3_TYPE[] PROGMEM = "{s}%s " D_NEOPOOL_TYPE "{m}EQ3{e}";
993995
const char HTTP_EQ3_MAC[] PROGMEM = "{s}%s " D_MAC_ADDRESS "{m}%s{e}";
994-
const char HTTP_EQ3_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}";
996+
const char HTTP_EQ3_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d%% (%d dBm){e}";
995997
const char HTTP_EQ3_TEMPERATURE[] PROGMEM = "{s}%s " D_THERMOSTAT_SET_POINT "{m}%*_f " D_UNIT_DEGREE "%c{e}";
996998
const char HTTP_EQ3_DUTY_CYCLE[] PROGMEM = "{s}%s " D_THERMOSTAT_VALVE_POSITION "{m}%d " D_UNIT_PERCENT "{e}";
997999
const char HTTP_EQ3_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%s{e}";
9981000

9991001
void EQ3Show(void)
10001002
{
1003+
if (!Settings->flag5.mi32_enable) return;
1004+
10011005
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];
10021006
bool FirstSensorShown = false;
10031007

@@ -1016,7 +1020,7 @@ void EQ3Show(void)
10161020
label = tlabel;
10171021
}
10181022
WSContentSend_P(HTTP_EQ3_MAC, label, addrStr(EQ3Devices[i].addr));
1019-
WSContentSend_PD(HTTP_EQ3_RSSI, label, EQ3Devices[i].RSSI);
1023+
WSContentSend_PD(HTTP_EQ3_RSSI, label, WifiGetRssiAsQuality(EQ3Devices[i].RSSI), EQ3Devices[i].RSSI);
10201024
WSContentSend_PD(HTTP_EQ3_TEMPERATURE, label, Settings->flag2.temperature_resolution, &EQ3Devices[i].TargetTemp, c_unit);
10211025
WSContentSend_P(HTTP_EQ3_DUTY_CYCLE, label, EQ3Devices[i].DutyCycle);
10221026
WSContentSend_P(HTTP_EQ3_BATTERY, label, EQ3Devices[i].Battery ? D_NEOPOOL_LOW : D_OK);

tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@
2020
You should have received a copy of the GNU General Public License
2121
along with this program. If not, see <http://www.gnu.org/licenses/>.
2222
*/
23-
#define MI32_VERSION "V0.9.2.6"
23+
#define MI32_VERSION "V0.9.2.7"
2424
/*
2525
--------------------------------------------------------------------------------------------
2626
Version yyyymmdd Action Description
2727
--------------------------------------------------------------------------------------------
28+
0.9.2.7 20251204 changed - display RSSI in general format "xx% (-yy dBm)"
29+
view on UI only when BLE enabled
30+
-------
2831
0.9.2.6 20250503 changed - display alias instead of type, when present
2932
-------
3033
0.9.2.5 20250319 changed - added support for MI LYWSD02MMC with different device ID
@@ -2749,7 +2752,7 @@ void CmndMi32Keys(void){
27492752
const char HTTP_MI32[] PROGMEM = "{s}MI ESP32 " MI32_VERSION "{m}%u%s / %u{e}";
27502753
const char HTTP_MI32_TYPE[] PROGMEM = "{s}%s " D_SENSOR"{m}%s{e}";
27512754
const char HTTP_MI32_MAC[] PROGMEM = "{s}%s " D_MAC_ADDRESS "{m}%s{e}";
2752-
const char HTTP_MI32_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d dBm{e}";
2755+
const char HTTP_MI32_RSSI[] PROGMEM = "{s}%s " D_RSSI "{m}%d%% (%d dBm){e}";
27532756
const char HTTP_MI32_BATTERY[] PROGMEM = "{s}%s " D_BATTERY "{m}%u %%{e}";
27542757
const char HTTP_MI32_LASTBUTTON[] PROGMEM = "{s}%s Last Button{m}%u{e}";
27552758
const char HTTP_MI32_EVENTS[] PROGMEM = "{s}%s Events{m}%u{e}";
@@ -3527,6 +3530,8 @@ void MI32Show(bool json)
35273530

35283531
#ifdef USE_WEBSERVER
35293532
} else {
3533+
if (!Settings->flag5.mi32_enable) return;
3534+
35303535
static uint16_t _page = 0;
35313536
static uint16_t _counter = 0;
35323537
int32_t i = _page * MI32.perPage;
@@ -3559,7 +3564,7 @@ void MI32Show(bool json)
35593564
char _MAC[18];
35603565
ToHex_P(p->MAC,6,_MAC,18);//,':');
35613566
WSContentSend_P(HTTP_MI32_MAC, label, _MAC);
3562-
WSContentSend_PD(HTTP_MI32_RSSI, label, p->RSSI);
3567+
WSContentSend_PD(HTTP_MI32_RSSI, label, WifiGetRssiAsQuality(p->RSSI), p->RSSI);
35633568

35643569
// for some reason, display flora differently
35653570
switch(p->type){

0 commit comments

Comments
 (0)