diff --git a/tasmota/xdrv_52_BLE_ESP32.ino b/tasmota/xdrv_52_BLE_ESP32.ino index 87919fab9..162c434f9 100644 --- a/tasmota/xdrv_52_BLE_ESP32.ino +++ b/tasmota/xdrv_52_BLE_ESP32.ino @@ -279,7 +279,7 @@ const char * getStateString(int state); //int SafeAddLog_P(uint32_t loglevel, PGM_P formatP, ...); static void BLEDiag(); -const char *getAlias(uint8_t *addr); +const char *getAlias(const uint8_t *addr); //void BLEAliasMqttList(); void BLEAliasListResp(); //////////////////////////////////////////////////////////////////////// @@ -2404,7 +2404,7 @@ static const char *noAlias = PSTR(""); //////////////////////////////////////////// // use to display the alias name if required -const char *getAlias(uint8_t *addr){ +const char *getAlias(const uint8_t *addr){ if (!addr){ return noAlias; } diff --git a/tasmota/xsns_62_MI_ESP32_BLE_ESP32.ino b/tasmota/xsns_62_MI_ESP32_BLE_ESP32.ino index 8b04993da..678d63d9a 100644 --- a/tasmota/xsns_62_MI_ESP32_BLE_ESP32.ino +++ b/tasmota/xsns_62_MI_ESP32_BLE_ESP32.ino @@ -922,11 +922,10 @@ int MI32advertismentCallback(BLE_ESP32::ble_advertisment_t *pStruct) int RSSI = pStruct->RSSI; const uint8_t *addr = pStruct->addr; if(MI32isInBlockList(addr) == true) return 0; - if (MI32.option.onlyAliased){ - const char *alias = BLE_ESP32::getAlias(p->MAC); + const char *alias = BLE_ESP32::getAlias(addr); if (!alias || !(*alias)){ - return; + return 0; } } @@ -2130,6 +2129,10 @@ void CmndMi32Option(void){ } break; case 5:{ MI32.option.onlyAliased = onOff; + if (MI32.option.onlyAliased){ + // discard all sensors for a restart + MIBLEsensors.clear(); + } } break; } ResponseCmndDone();