Skip to content

fix: ESPBTUUID::to_str() requires a buffer argument, not zero - #315

Merged
eigger merged 1 commit into
masterfrom
fix/uuid-to-str-argument
Aug 18, 2026
Merged

fix: ESPBTUUID::to_str() requires a buffer argument, not zero#315
eigger merged 1 commit into
masterfrom
fix/uuid-to-str-argument

Conversation

@eigger

@eigger eigger commented Aug 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fixes a real build break in production: esphome compile on a real device config (logger: level: DEBUG) fails with error: no matching function for call to 'ESPBTUUID::to_str()'to_str() takes a std::span<char, 37> output buffer, it doesn't return std::string.
  • This is a follow-up to fix: clean up build warnings and sync Colorado Tab5 package #314's to_string()to_str() migration, which passed our own component tests only because none of them declare a logger: component — ESPHome silently strips ESP_LOGCONFIG/ESP_LOGW to no-ops in that case and never type-checks their arguments. Root-caused via the user's actual build log.
  • Also fixes a second, previously-hidden bug in divoom_display.cpp the same gap was masking: address_str() already returns const char*, so chaining .c_str() on it doesn't compile either.

Test plan

  • esphome compile for ble_elm327 and divoom (esp32-idf) with logger: level: DEBUG/VERY_VERBOSE explicitly added — zero errors, zero warnings in our code.
  • Test-hardening (adding logger: to every component's test config so this class of bug can't hide again) is a separate PR, since it's orthogonal to this fix.

🤖 Generated with Claude Code

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>
@eigger
eigger merged commit 7010243 into master Aug 18, 2026
2 checks passed
eigger added a commit that referenced this pull request Aug 18, 2026
)

None of the component test configs declared a logger: component,
which makes ESPHome silently compile ESP_LOGCONFIG/ESP_LOGW down to
no-ops and skip type-checking their arguments entirely (see #315,
where this exact gap let a broken ESPBTUUID::to_str() call through
CI). Add logger: level: VERY_VERBOSE to every component's test config
(via the shared common.yaml where one exists) so dump_config() and
warning-log code paths actually get compiled and type-checked.

Recompiled every component's esp32-idf/esp32-ard test config with
this change and fixed the one warning it caught: a %u format
specifier vs. uint32_t argument mismatch in divoom_display.cpp's
dump_config(), the same class of bug already fixed in ble_elm327.

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
@eigger
eigger deleted the fix/uuid-to-str-argument branch August 20, 2026 03:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant