Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix: ESPBTUUID::to_str() requires a buffer argument, not zero
The previous to_string() -> to_str() migration compiled fine in our
own tests because none of them declared a logger: component, which
silently strips ESP_LOGCONFIG/ESP_LOGW down to no-ops and skips
type-checking their arguments entirely. Real device configs run with
logger: level: DEBUG or higher, where ESPHome 2026.7.4 fails to build:

  error: no matching function for call to 'ESPBTUUID::to_str()'
  candidate: 'const char *to_str(std::span<char, 37> output) const'

Fix both call sites to pass a stack buffer instead of chaining
.c_str() on a call that no longer returns std::string.

Also fixes a second, pre-existing bug in divoom_display.cpp that the
same missing-logger gap was hiding: address_str() already returns
const char*, so .c_str() on it doesn't compile either.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
  • Loading branch information
eigger and claude committed Aug 18, 2026
commit 53a86ca029d04145cce63ae86884fac503d90099
7 changes: 4 additions & 3 deletions components/ble_elm327/ble_elm327.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ void BleElm327Component::loop() {
}

void BleElm327Component::dump_config() {
char uuid_buf[espbt::UUID_STR_LEN];
ESP_LOGCONFIG(TAG, "BLE ELM327:");
ESP_LOGCONFIG(TAG, " MAC address : %s", this->parent_->address_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", service_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " RX Char UUID : %s", rx_char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " TX Char UUID : %s", tx_char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", service_uuid_.to_str(uuid_buf));
ESP_LOGCONFIG(TAG, " RX Char UUID : %s", rx_char_uuid_.to_str(uuid_buf));
ESP_LOGCONFIG(TAG, " TX Char UUID : %s", tx_char_uuid_.to_str(uuid_buf));
ESP_LOGCONFIG(TAG, " TX delay : %lums", (unsigned long) tx_delay_ms_);
ESP_LOGCONFIG(TAG, " Base init commands : ATZ, ATE0, ATL0, ATS0, ATH0, ATSP0");
ESP_LOGCONFIG(TAG, " Extra init commands: %u", (unsigned)extra_init_commands_.size());
Expand Down
25 changes: 14 additions & 11 deletions components/divoom/divoom_display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ static const char *const TAG = "divoom";

void DivoomDisplay::dump_config()
{
char uuid_buf[espbt::UUID_STR_LEN];
LOG_DISPLAY("", "divoom", this);
ESP_LOGCONFIG(TAG, " Width: %d, Height: %d", this->width_, this->height_);
ESP_LOGCONFIG(TAG, " MAC address : %s", this->parent_->address_str().c_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", this->service_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " Characteristic UUID: %s", this->char_uuid_.to_str().c_str());
ESP_LOGCONFIG(TAG, " MAC address : %s", this->parent_->address_str());
ESP_LOGCONFIG(TAG, " Service UUID : %s", this->service_uuid_.to_str(uuid_buf));
ESP_LOGCONFIG(TAG, " Characteristic UUID: %s", this->char_uuid_.to_str(uuid_buf));
ESP_LOGCONFIG(TAG, " Update Interval: %u ms", this->get_update_interval());
}

Expand Down Expand Up @@ -58,20 +59,21 @@ void DivoomDisplay::loop()

void DivoomDisplay::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gattc_if, esp_ble_gattc_cb_param_t *param)
{
switch (event)
char uuid_buf[espbt::UUID_STR_LEN];
switch (event)
{
case ESP_GATTC_OPEN_EVT:
connected_ = true;
if (this->bt_connected_) this->bt_connected_->publish_state(connected_);
this->client_state_ = espbt::ClientState::ESTABLISHED;
ESP_LOGW(TAG, "[%s] Connected successfully!", this->char_uuid_.to_str().c_str());
ESP_LOGW(TAG, "[%s] Connected successfully!", this->char_uuid_.to_str(uuid_buf));
break;
case ESP_GATTC_DISCONNECT_EVT:
connected_ = false;
synced_time_ = false;
old_image_buffer_.clear();
if (this->bt_connected_) this->bt_connected_->publish_state(connected_);
ESP_LOGW(TAG, "[%s] Disconnected", this->char_uuid_.to_str().c_str());
ESP_LOGW(TAG, "[%s] Disconnected", this->char_uuid_.to_str(uuid_buf));
this->client_state_ = espbt::ClientState::IDLE;
break;
case ESP_GATTC_WRITE_CHAR_EVT:
Expand All @@ -83,12 +85,12 @@ void DivoomDisplay::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
auto *chr = this->parent()->get_characteristic(this->service_uuid_, this->char_uuid_);
if (chr == nullptr)
{
ESP_LOGW(TAG, "[%s] Characteristic not found.", this->char_uuid_.to_str().c_str());
ESP_LOGW(TAG, "[%s] Characteristic not found.", this->char_uuid_.to_str(uuid_buf));
break;
}
if (param->write.handle == chr->handle)
{
ESP_LOGW(TAG, "[%s] Write error, status=%d", this->char_uuid_.to_str().c_str(), param->write.status);
ESP_LOGW(TAG, "[%s] Write error, status=%d", this->char_uuid_.to_str(uuid_buf), param->write.status);
}
break;
}
Expand Down Expand Up @@ -282,15 +284,16 @@ void DivoomDisplay::add_color_point(ColorPoint point)

bool DivoomDisplay::write_data(std::vector<uint8_t> &data)
{
char uuid_buf[espbt::UUID_STR_LEN];
if (this->client_state_ != espbt::ClientState::ESTABLISHED)
{
ESP_LOGW(TAG, "[%s] Not connected to BLE client. State update can not be written.", this->char_uuid_.to_str().c_str());
ESP_LOGW(TAG, "[%s] Not connected to BLE client. State update can not be written.", this->char_uuid_.to_str(uuid_buf));
return false;
}
auto *chr = this->parent()->get_characteristic(this->service_uuid_, this->char_uuid_);
if (chr == nullptr)
{
ESP_LOGW(TAG, "[%s] Characteristic not found. State update can not be written.", this->char_uuid_.to_str().c_str());
ESP_LOGW(TAG, "[%s] Characteristic not found. State update can not be written.", this->char_uuid_.to_str(uuid_buf));
return false;
}
if (this->require_response_)
Expand Down Expand Up @@ -447,7 +450,7 @@ void DivoomDisplay::sync_time_()
auto time = this->time_->now();
if (!time.is_valid())
{
ESP_LOGW(TAG, "[%s] Time is not yet valid. Time can not be synced.", this->parent_->address_str().c_str());
ESP_LOGW(TAG, "[%s] Time is not yet valid. Time can not be synced.", this->parent_->address_str());
return;
}
time.recalc_timestamp_utc(true); // calculate timestamp of local time
Expand Down