mirror of
https://github.com/esphome/esphome.git
synced 2026-02-28 01:44:20 -07:00
Add require response option for BLE binary output (#3091)
This commit is contained in:
@@ -63,7 +63,11 @@ void BLEBinaryOutput::write_state(bool state) {
|
||||
|
||||
uint8_t state_as_uint = (uint8_t) state;
|
||||
ESP_LOGV(TAG, "[%s] Write State: %d", this->char_uuid_.to_string().c_str(), state_as_uint);
|
||||
chr->write_value(&state_as_uint, sizeof(state_as_uint));
|
||||
if (this->require_response_) {
|
||||
chr->write_value(&state_as_uint, sizeof(state_as_uint), ESP_GATT_WRITE_TYPE_RSP);
|
||||
} else {
|
||||
chr->write_value(&state_as_uint, sizeof(state_as_uint), ESP_GATT_WRITE_TYPE_NO_RSP);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace ble_client
|
||||
|
||||
Reference in New Issue
Block a user