Merge pull request #17136 from Staars/mi_disco

MI32 legacy: hide BLE sensors from discovery to do this in Berry
This commit is contained in:
Theo Arends 2022-11-19 10:05:53 +01:00 committed by GitHub
commit 215db46966
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 8 deletions

View File

@ -201,7 +201,6 @@ struct {
uint32_t allwaysAggregate:1; // always show all known values of one sensor in brdigemode uint32_t allwaysAggregate:1; // always show all known values of one sensor in brdigemode
uint32_t noSummary:1; // no sensor values at TELE-period uint32_t noSummary:1; // no sensor values at TELE-period
uint32_t directBridgeMode:1; // send every received BLE-packet as a MQTT-message in real-time uint32_t directBridgeMode:1; // send every received BLE-packet as a MQTT-message in real-time
uint32_t showRSSI:1;
uint32_t activeScan:1; uint32_t activeScan:1;
uint32_t ignoreBogusBattery:1; uint32_t ignoreBogusBattery:1;
uint32_t minimalSummary:1; // DEPRECATED!! uint32_t minimalSummary:1; // DEPRECATED!!

View File

@ -615,7 +615,6 @@ void MI32PreInit(void) {
MI32.option.noSummary = 0; MI32.option.noSummary = 0;
MI32.option.minimalSummary = 0; MI32.option.minimalSummary = 0;
MI32.option.directBridgeMode = 0; MI32.option.directBridgeMode = 0;
MI32.option.showRSSI = 1;
MI32.option.ignoreBogusBattery = 1; // from advertisements MI32.option.ignoreBogusBattery = 1; // from advertisements
MI32loadCfg(); MI32loadCfg();
@ -640,7 +639,7 @@ void MI32Init(void) {
} }
} }
if(MI32.mode.didGetConfig){ if(MI32.mode.didGetConfig && !Settings->flag5.zigbee_hide_bridge_topic){ // borrow SO125 1 to turn off HomeKit
MI32.mode.didStartHAP = 0; MI32.mode.didStartHAP = 0;
#ifdef USE_MI_HOMEKIT #ifdef USE_MI_HOMEKIT
MI32getSetupCodeFromMAC(MI32.hk_setup_code); MI32getSetupCodeFromMAC(MI32.hk_setup_code);
@ -2096,6 +2095,7 @@ void MI32Show(bool json)
if(!MI32.mode.triggeredTele){ if(!MI32.mode.triggeredTele){
if(MI32.option.noSummary) return; // no message at TELEPERIOD if(MI32.option.noSummary) return; // no message at TELEPERIOD
} }
if(TasmotaGlobal.masterlog_level == LOG_LEVEL_DEBUG_MORE) return; // we want to announce sensors unlinked to the ESP, check for LOG_LEVEL_DEBUG_MORE is medium-safe
MI32suspendScanTask(); MI32suspendScanTask();
for (uint32_t i = 0; i < MIBLEsensors.size(); i++) { for (uint32_t i = 0; i < MIBLEsensors.size(); i++) {
if(MI32.mode.triggeredTele && MIBLEsensors[i].eventType.raw == 0) continue; if(MI32.mode.triggeredTele && MIBLEsensors[i].eventType.raw == 0) continue;
@ -2228,10 +2228,9 @@ void MI32Show(bool json)
} }
} }
} }
if (MI32.option.showRSSI) { MI32ShowContinuation(&commaflg);
MI32ShowContinuation(&commaflg); ResponseAppend_P(PSTR("\"RSSI\":%d"), MIBLEsensors[i].RSSI);
ResponseAppend_P(PSTR("\"RSSI\":%d"), MIBLEsensors[i].RSSI);
}
ResponseJsonEnd(); ResponseJsonEnd();
MIBLEsensors[i].eventType.raw = 0; MIBLEsensors[i].eventType.raw = 0;
@ -2319,6 +2318,7 @@ int ExtStopBLE(){
MI32Scan->stop(); MI32Scan->stop();
MI32.mode.deleteScanTask = 1; MI32.mode.deleteScanTask = 1;
AddLog(LOG_LEVEL_INFO,PSTR("M32: stop BLE")); AddLog(LOG_LEVEL_INFO,PSTR("M32: stop BLE"));
while (MI32.mode.runningScan) yield();
} }
#ifdef USE_MI_HOMEKIT #ifdef USE_MI_HOMEKIT
if(MI32.mode.didStartHAP) { if(MI32.mode.didStartHAP) {
@ -2371,7 +2371,7 @@ bool Xsns62(uint32_t function)
break; break;
#ifdef USE_MI_EXT_GUI #ifdef USE_MI_EXT_GUI
case FUNC_WEB_ADD_MAIN_BUTTON: case FUNC_WEB_ADD_MAIN_BUTTON:
if (MI32.mode.didGetConfig) WSContentSend_P(HTTP_BTN_MENU_MI32); if (Settings->flag5.mi32_enable) WSContentSend_P(HTTP_BTN_MENU_MI32);
break; break;
case FUNC_WEB_ADD_HANDLER: case FUNC_WEB_ADD_HANDLER:
WebServer_on(PSTR("/m32"), MI32HandleWebGUI); WebServer_on(PSTR("/m32"), MI32HandleWebGUI);