Skip to content

Commit

Permalink
EQ3 TRV firmware version 1.46 fails if the default true is used in ->…
Browse files Browse the repository at this point in the history
…subscribe on the notify characteristic. (#22328)

So pass false always - then it works with both new and old EQ3 firmware.
  • Loading branch information
btsimonh authored Oct 20, 2024
1 parent 923ed91 commit 7ea96eb
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions tasmota/tasmota_xdrv_driver/xdrv_79_esp32_ble.ino
Original file line number Diff line number Diff line change
Expand Up @@ -1905,20 +1905,35 @@ 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?)
notifystate = GEN_STATE_WAITNOTIFY;
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;
Expand All @@ -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;
Expand Down

0 comments on commit 7ea96eb

Please sign in to comment.