diff --git a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino index 1ee386063..1dfa9d217 100644 --- a/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino +++ b/tasmota/tasmota_xsns_sensor/xsns_62_esp32_mi.ino @@ -95,11 +95,12 @@ class MI32SensorCallback : public NimBLEClientCallbacks { MI32.mode.connected = 1; pclient->updateConnParams(8,11,0,1000); } - void onDisconnect(NimBLEClient* pclient) { + void onDisconnect(NimBLEClient* pclient, int reason) { MI32.mode.connected = 0; MI32.infoMsg = MI32_DID_DISCONNECT; - MI32.conCtx->error = MI32_CONN_DID_DISCCONNECT; - MI32.mode.triggerBerryConnCB = 1; //mainly for unexpected or requested disconnects + MI32.conCtx->error = reason; + MI32.conCtx->operation = 5; //set for all disconnects that come from the remote device or connection loss + MI32.mode.triggerBerryConnCB = 1; //AddLog(LOG_LEVEL_DEBUG,PSTR("disconnected")); } }; @@ -2738,4 +2739,4 @@ bool Xsns62(uint32_t function) #endif // USE_MI_ESP32 #endif // CONFIG_IDF_TARGET_ESP32 or CONFIG_IDF_TARGET_ESP32C3 #endif // ESP32 -#endif // USE_BLE_ESP32 \ No newline at end of file +#endif // USE_BLE_ESP32