From 2322646773f39ff0e12da8fb412b2b92b3839849 Mon Sep 17 00:00:00 2001 From: Andy Knight Date: Tue, 26 Nov 2024 10:28:55 +0000 Subject: [PATCH] Prevent active BLE operations with unencrypted MI-format beacons (#22453) --- tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 3818717f8..752e2fdd1 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi_ble.ino @@ -792,7 +792,7 @@ int genericSensorReadFn(int slot, int force){ break;*/ case MI_LYWSD03MMC: // don't read if key present and we've decoded at least one advert - if (MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND && !force) return -2; + if ((MIBLEsensors[slot].needkey == KEY_NOT_REQUIRED || MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND) && !force) return -2; res = MI32Operation(slot, OP_READ_HT_LY, LYWSD03_Svc, nullptr, LYWSD03_BattNotifyChar); break; case MI_LYWSD02MMC: @@ -800,7 +800,7 @@ int genericSensorReadFn(int slot, int force){ break; case MI_MHOC401: // don't read if key present and we've decoded at least one advert - if (MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND && !force) return -2; + if ((MIBLEsensors[slot].needkey == KEY_NOT_REQUIRED || MIBLEsensors[slot].needkey == KEY_REQUIRED_AND_FOUND) && !force) return -2; res = MI32Operation(slot, OP_READ_HT_LY, MHOC401_Svc, nullptr, MHOC401_BattNotifyChar); break;