diff --git a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino index 763ffc477..bb3cd2caa 100644 --- a/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino +++ b/tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino @@ -1905,12 +1905,27 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: got notify characteristic")); #endif op->notifylen = 0; + bool response = false; + + /* although it FEELS like this would do the job, it does not for EQ3. + // when SHOULD we pass the default true? Is it just that EQ3 is a bad BLE implementation? + bool response = true; + if (pNCharacteristic->canWriteNoResponse()){ + response = false; + } + */ + uint8_t props = pNCharacteristic->getProperties(); +#ifdef BLE_ESP32_DEBUG + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: characteristic props 0x%02X"), props); +#endif + if(pNCharacteristic->canNotify()) { uint64_t now = esp_timer_get_time(); op->notifytimer = now; - if(pNCharacteristic->subscribe(true, BLE_ESP32::BLEGenNotifyCB)) { + + if(pNCharacteristic->subscribe(true, BLE_ESP32::BLEGenNotifyCB, response)) { #ifdef BLE_ESP32_DEBUG - if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for notify")); + if (BLEDebugMode > 0) AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for notify - resp %d"), response? 1:0); #endif // this will get changed to read or write, // but here in case it's notify only (can that happen?) @@ -1918,7 +1933,7 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe waitNotify = true; } else { #ifdef BLE_ESP32_DEBUG - AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for notify")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for notify - resp %d"), response? 1:0); #endif newstate = GEN_STATE_FAILED_NOTIFY; op->notifytimer = 0L; @@ -1927,15 +1942,15 @@ static void BLETaskRunCurrentOperation(BLE_ESP32::generic_sensor_t** pCurrentOpe if(pNCharacteristic->canIndicate()) { uint64_t now = esp_timer_get_time(); op->notifytimer = now; - if(pNCharacteristic->subscribe(false, BLE_ESP32::BLEGenNotifyCB)) { + if(pNCharacteristic->subscribe(false, BLE_ESP32::BLEGenNotifyCB, response)) { #ifdef BLE_ESP32_DEBUG - AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for indicate")); + AddLog(LOG_LEVEL_DEBUG,PSTR("BLE: subscribe for indicate - resp %d"), response? 1:0); #endif notifystate = GEN_STATE_WAITINDICATE; waitNotify = true; } else { #ifdef BLE_ESP32_DEBUG - AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for indicate")); + AddLog(LOG_LEVEL_ERROR,PSTR("BLE: failed subscribe for indicate - resp %d"), response? 1:0); #endif newstate = GEN_STATE_FAILED_INDICATE; op->notifytimer = 0L;