mirror of
https://github.com/syssi/esphome-votronic.git
synced 2025-07-23 04:23:02 +02:00
Unregister BLE notifications on disconnect (#56)
Some checks failed
CI / yamllint (push) Has been cancelled
CI / lint-clang-format (push) Has been cancelled
CI / lint-clang-tidy (push) Has been cancelled
CI / lint-python (push) Has been cancelled
CI / esphome-config (push) Has been cancelled
CI / esphome-compile (push) Has been cancelled
Some checks failed
CI / yamllint (push) Has been cancelled
CI / lint-clang-format (push) Has been cancelled
CI / lint-clang-tidy (push) Has been cancelled
CI / lint-python (push) Has been cancelled
CI / esphome-config (push) Has been cancelled
CI / esphome-compile (push) Has been cancelled
This commit is contained in:
committed by
GitHub
parent
91a7913e8b
commit
9aa26b3c9d
@@ -37,6 +37,24 @@ void VotronicBle::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t
|
||||
this->publish_state_(this->charged_energy_sensor_, NAN);
|
||||
this->publish_state_(this->pv_power_sensor_, NAN);
|
||||
|
||||
if (this->char_battery_computer_handle_ != 0) {
|
||||
auto status = esp_ble_gattc_unregister_for_notify(
|
||||
this->parent()->get_gattc_if(), this->parent()->get_remote_bda(), this->char_battery_computer_handle_);
|
||||
if (status) {
|
||||
ESP_LOGW(TAG, "esp_ble_gattc_unregister_for_notify failed, status=%d", status);
|
||||
}
|
||||
}
|
||||
this->char_battery_computer_handle_ = 0;
|
||||
|
||||
if (this->char_solar_charger_handle_ != 0) {
|
||||
auto status = esp_ble_gattc_unregister_for_notify(
|
||||
this->parent()->get_gattc_if(), this->parent()->get_remote_bda(), this->char_solar_charger_handle_);
|
||||
if (status) {
|
||||
ESP_LOGW(TAG, "esp_ble_gattc_unregister_for_notify failed, status=%d", status);
|
||||
}
|
||||
}
|
||||
this->char_solar_charger_handle_ = 0;
|
||||
|
||||
break;
|
||||
}
|
||||
case ESP_GATTC_SEARCH_CMPL_EVT: {
|
||||
|
Reference in New Issue
Block a user