Commit Graph

22521 Commits

Author SHA1 Message Date
J. Nick Koston
09f604f2fc Merge branch 'api-proto-write-presized-buffer' into integration
# Conflicts:
#	esphome/components/api/proto.h
2026-02-16 15:17:06 -06:00
J. Nick Koston
f1d51773af Revert "[api] Pass ProtoWriteBuffer by reference in encode()"
This reverts commit 6369f3b279.
2026-02-16 15:12:10 -06:00
J. Nick Koston
6369f3b279 [api] Pass ProtoWriteBuffer by reference in encode()
Pass ProtoWriteBuffer by reference instead of by value in virtual
encode() methods. This avoids copying both buffer_ and pos_ pointers
for every encode call - only a single pointer is passed.

Also simplifies encode_message since child writes directly advance
the shared pos_. Adds debug_check_size_ to verify calculate_size
matches actual encode output.
2026-02-16 15:01:59 -06:00
J. Nick Koston
af4579ca87 [api] Write protobuf encode output to pre-sized buffer directly
ProtoSize::calculate_size() already computes the exact encoded size
before encode() runs and is the boundary validation. The buffer is
pre-sized to match. Since the buffer size is always correct,
push_back() capacity checks on every byte are redundant overhead.

Rename ProtoWriteBuffer to ProtoWritePreSizedBuffer to document the
contract. Write through a raw uint8_t* pointer instead of push_back().
Pre-resize the buffer to include payload space before encoding.

Add ESPHOME_DEBUG_API bounds checks to validate writes stay within the
pre-sized region during development and integration testing.
2026-02-16 14:40:55 -06:00
J. Nick Koston
ab26e5d574 Merge remote-tracking branch 'origin/api-proto-write-presized-buffer' into integration 2026-02-16 11:20:30 -06:00
J. Nick Koston
ee9de5c412 [api] Write protobuf encode output to pre-sized buffer directly
ProtoSize::calculate_size() already computes the exact encoded size
before encode() runs and is the boundary validation. The buffer is
pre-sized to match. Since the buffer size is always correct,
push_back() capacity checks on every byte are redundant overhead.

Rename ProtoWriteBuffer to ProtoWritePreSizedBuffer to document the
contract. Write through a raw uint8_t* pointer instead of push_back().
Pre-resize the buffer to include payload space before encoding.

Add ESPHOME_DEBUG_API bounds checks to validate writes stay within the
pre-sized region during development and integration testing.
2026-02-16 11:10:10 -06:00
J. Nick Koston
b86cd229cc Merge remote-tracking branch 'upstream/api-remove-unused-reserve' into integration 2026-02-16 10:08:55 -06:00
J. Nick Koston
f40fa97883 [api] Remove unused reserve from APIServer constructor
All send paths already call prepare_first_message_buffer which does
clear() + reserve() with the exact needed size, making the initial
reserve(64) redundant. Removing it saves 68 bytes of flash.
2026-02-16 10:07:41 -06:00
J. Nick Koston
4a5639e9f7 Merge remote-tracking branch 'upstream/dev' into integration 2026-02-16 10:03:06 -06:00
J. Nick Koston
0c4827d348 [json, core] Remove stored RAMAllocator, make constructors constexpr (#14000) 2026-02-16 08:09:53 -06:00
J. Nick Koston
81872d9822 [camera, camera_encoder] Remove stored RAMAllocator member (#13997) 2026-02-16 08:09:26 -06:00
J. Nick Koston
ffb9a00e26 [online_image] Remove stored RAMAllocator member from DownloadBuffer (#13999) 2026-02-16 08:09:13 -06:00
J. Nick Koston
f2c827f9a2 [runtime_image] Remove stored RAMAllocator member (#13998) 2026-02-16 08:08:43 -06:00
J. Nick Koston
268dda8746 Merge branch 'json-remove-stored-allocator' into integration 2026-02-15 21:19:53 -06:00
J. Nick Koston
6ac6636127 Merge branch 'dev' into json-remove-stored-allocator 2026-02-15 20:58:32 -06:00
Cornelius A. Ludmann
f2cb5db9e0 [epaper_spi] Add Waveshare 7.5in e-Paper (H) (#13991) 2026-02-16 13:44:30 +11:00
Kevin Ahrendt
066419019f [audio] Support reallocating non-empty AudioTransferBuffer (#13979) 2026-02-15 16:09:35 -05:00
Pawelo
15da6d0a0b [epaper_spi] Add WeAct 3-color e-paper display support (#13894) 2026-02-16 07:58:51 +11:00
Jonathan Swoboda
6303bc3e35 [esp32_rmt] Handle ESP32 variants without RMT hardware (#14001)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 13:23:06 -05:00
Jonathan Swoboda
0f4dc6702d [fan] Fix preset_mode not restored on boot (#14002)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:11:50 -05:00
Jonathan Swoboda
f48c8a6444 [combination] Fix 'coeffecient' typo with backward-compatible deprecation (#14004)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 12:11:36 -05:00
J. Nick Koston
2f7b96a4a1 Merge branch 'camera-remove-stored-allocator' into integration 2026-02-14 16:00:18 -07:00
J. Nick Koston
3e0a117416 Merge branch 'runtime-image-remove-stored-allocator' into integration 2026-02-14 16:00:13 -07:00
J. Nick Koston
0fe2200689 Merge branch 'online-image-remove-stored-allocator' into integration 2026-02-14 16:00:07 -07:00
J. Nick Koston
d32f412c42 Merge remote-tracking branch 'origin/json-remove-stored-allocator' into integration 2026-02-14 15:59:56 -07:00
J. Nick Koston
062f223876 [json, core] Remove stored RAMAllocator, make constructors constexpr
RAMAllocator with default flags is stateless — it's just a dispatch
wrapper over heap_caps_malloc/realloc/free. Remove the stored member
from SpiRamAllocator, using stack-local instances at each call site.

Also make RAMAllocator constructors constexpr so the compiler can
fully evaluate flag logic at compile time.

Note: SpiRamAllocator was initialized with RAMAllocator::NONE (0),
which is equivalent to default construction since the constructor
preserves the default ALLOC_INTERNAL | ALLOC_EXTERNAL flags when
no valid allocation flags are provided.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-02-14 15:43:50 -07:00
J. Nick Koston
6273ad6bf8 [online_image] Remove stored RAMAllocator member from DownloadBuffer
RAMAllocator with default flags is stateless — it's just a dispatch
wrapper over heap_caps_malloc/realloc/free. There's no need to store
it as a class member. Use stack-local instances at each call site
instead, matching the pattern used in audio_transfer_buffer and
ring_buffer.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-02-14 15:35:05 -07:00
J. Nick Koston
be5f4845eb [runtime_image] Remove stored RAMAllocator member
RAMAllocator with default flags is stateless — it's just a dispatch
wrapper over heap_caps_malloc/realloc/free. There's no need to store
it as a class member. Use stack-local instances at each call site
instead, matching the pattern used in audio_transfer_buffer and
ring_buffer.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-02-14 15:34:11 -07:00
J. Nick Koston
df3a36376d [camera, camera_encoder] Remove stored RAMAllocator member
RAMAllocator is stateless when using default flags — it's just a
dispatch wrapper over heap_caps_malloc/realloc/free. There's no need
to store it as a class member. Use stack-local instances at each call
site instead, matching the pattern used in audio_transfer_buffer and
ring_buffer.

Co-Authored-By: J. Nick Koston <nick@koston.org>
2026-02-14 15:32:11 -07:00
dependabot[bot]
38404b2013 Bump ruff from 0.15.0 to 0.15.1 (#13980)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-02-14 15:11:17 -07:00
AndreKR
5a6d64814a [http_request] Improve TLS logging on ESP8266 (#13985) 2026-02-14 10:08:26 -07:00
J. Nick Koston
36776b40c2 [wifi] Fix ESP8266 DHCP state corruption from premature dhcp_renew() (#13983)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 08:21:04 -07:00
J. Nick Koston
82e608369f Merge remote-tracking branch 'origin/integration' into integration 2026-02-14 05:32:59 -07:00
J. Nick Koston
c291d7deef Merge remote-tracking branch 'origin/fix-esp8266-dhcp-state-corruption' into integration 2026-02-14 05:32:40 -07:00
J. Nick Koston
46cc9c0eef [wifi] Simplify comment — remove unverified link state claim
Cannot confirm wifi_station_disconnect() synchronously clears the
lwIP netif LINK_UP flag on ESP8266 NONOS SDK. The comment doesn't
need to make claims about link state since the fix is simply that
the hostname never changes at runtime, making dhcp_renew() pointless.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 05:24:52 -07:00
J. Nick Koston
f7705c8589 [wifi] Remove dhcp_renew() entirely — it can never run usefully
The dhcp_renew() loop was cargo-culted from Arduino ESP8266's
WiFi.hostname() which was designed for changing the hostname on
an already-connected system with multiple interfaces (WiFi+Ethernet).

In ESPHome, wifi_apply_hostname_() is only called from:
  - setup_() — before WiFi connects (link never up)
  - wifi_sta_connect_() — after wifi_disconnect_() (link always down)

The hostname is fixed at compile time and never changes at runtime.
Setting intf->hostname is sufficient — lwIP automatically includes
it in DHCP DISCOVER/REQUEST packets via LWIP_NETIF_HOSTNAME.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 05:22:39 -07:00
J. Nick Koston
8abb472c3a [wifi] Also require netif_is_link_up for dhcp_renew guard
DHCP_STATE_BOUND alone is insufficient — during reconnection, DHCP
can remain BOUND from a previous connection while the link is down
(wifi_disconnect_() doesn't stop DHCP). Both conditions are needed:
DHCP must be BOUND and the interface must have link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 20:04:51 -07:00
Jesse Hills
58c3ba7ac6 Merge branch 'beta' into dev 2026-02-14 16:03:25 +13:00
Jesse Hills
afa4047089 Merge pull request #13984 from esphome/bump-2026.2.0b2
2026.2.0b2
2026.2.0b2
2026-02-14 16:02:49 +13:00
Jesse Hills
a8a324cbfb Bump version to 2026.2.0b2 2026-02-14 13:53:54 +13:00
J. Nick Koston
f6aeef2e68 [api] Fix ESP8266 noise API handshake deadlock and prompt socket cleanup (#13972) 2026-02-14 13:53:54 +13:00
Jonathan Swoboda
297dfb0db4 [docker] Suppress git detached HEAD advice (#13962)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:53:54 +13:00
Jonathan Swoboda
c08356b0c1 [alarm_control_panel] Fix flaky integration test race condition (#13964)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 13:53:54 +13:00
Lukáš Maňas
e9bf9bc691 [pulse_meter] Fix early edge detection (#12360)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2026-02-14 13:53:54 +13:00
J. Nick Koston
ead7937dbf [api] Extract cold code from APIServer::loop() hot path (#13902) 2026-02-14 13:53:54 +13:00
J. Nick Koston
844210519a [uart] Remove redundant mutex, fix flush race, conditional event queue (#13955) 2026-02-14 13:53:54 +13:00
Guillermo Ruffino
7c70b2e04e [schema-gen] fix Windows: ensure UTF-8 encoding when reading component files (#13952) 2026-02-14 13:53:54 +13:00
dependabot[bot]
931b47673c Bump github/codeql-action from 4.32.2 to 4.32.3 (#13981)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-02-13 16:22:26 -06:00
J. Nick Koston
79d9fbf645 [nfc] Replace constant std::vector with static constexpr std::array (#13978) 2026-02-13 16:22:05 -06:00
J. Nick Koston
f24e7709ac [core] Make LOG_ENTITY_ICON a no-op when icons are compiled out (#13973) 2026-02-13 16:21:50 -06:00