Commit Graph
25644 Commits
Author SHA1 Message Date
J. Nick Koston bd7bdc0e2d Merge remote-tracking branch 'upstream/devirtualize-decode' into integration 2026-03-22 21:39:51 -10:00
J. Nick Koston d755922aae Merge remote-tracking branch 'upstream/dev' into devirtualize-decode 2026-03-22 21:18:09 -10:00
J. Nick Koston f059a1c2ea [api] Remove USE_API guards from api_pb2_service (aligned with parent PR) 2026-03-22 21:18:04 -10:00
J. Nick Koston 5560c9eef7 [test] Fix flakey ld2412 integration test race condition (#15100) 2026-03-22 21:10:51 -10:00
J. Nick Koston f4097d5a95 [api] Devirtualize API command dispatch (#15044) 2026-03-23 19:57:40 +13:00
Keith BurzinskiandClaude Sonnet 4.6 225330413a [uart] Rename FlushResult to UARTFlushResult with UART_FLUSH_RESULT_ prefix (#15101)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-23 01:55:14 -05:00
J. Nick Koston e67b5a78d0 [esp32] Patch DRAM segment for testing mode to fix grouped component test overflow (#15102) 2026-03-23 01:51:40 -05:00
J. Nick Koston 9ad332457e Merge branch 'deprecate-sensor-raw-state' into integration 2026-03-22 19:19:53 -10:00
J. Nick Koston 5519c2a5a3 [sensor] Narrow pragma to just the raw_state access line, matching select pattern 2026-03-22 19:19:09 -10:00
J. Nick Koston a1b1df3f71 Merge remote-tracking branch 'upstream/deprecate-sensor-raw-state' into integration 2026-03-22 19:10:28 -10:00
J. Nick Koston cab07c537e [sensor] Narrow pragma scope to only functions accessing deprecated raw_state
Scope the deprecation warning suppression to just the constructor
and publish_state() instead of the entire file, so unrelated
deprecation warnings aren't accidentally hidden.
2026-03-22 18:56:15 -10:00
J. Nick Koston 5e8497d611 Merge remote-tracking branch 'origin/fix-roaming-counter-reset' into integration 2026-03-22 18:52:39 -10:00
J. Nick Koston 3e8125799f Merge branch 'binary-sensor-remove-optional-state' into integration 2026-03-22 18:50:20 -10:00
J. Nick Koston 5be49b947a Merge remote-tracking branch 'origin/text-sensor-guard-raw-callback' into integration 2026-03-22 18:47:25 -10:00
J. Nick Koston 39782ff3f7 Merge branch 'dev' into text-sensor-guard-raw-callback 2026-03-22 18:47:09 -10:00
J. Nick Koston 801b16f3fd Merge remote-tracking branch 'upstream/dev' into integration 2026-03-22 18:46:46 -10:00
J. Nick Koston eaf38c10cc [binary_sensor] Use const T* instead of T current{} in set_new_state
Avoids requiring T to be default-constructible, which would break
future instantiations with non-default-constructible state types.

Capture old_state before set_state_value() since the pointer aliases
subclass storage that gets overwritten.
2026-03-22 18:40:00 -10:00
J. Nick Koston cd5b19ab0d [binary_sensor] Fast-path dedup in send_state_internal before virtual dispatch
Check state == new_state directly before calling virtual set_new_state.
Avoids the virtual dispatch chain (BinarySensor::set_new_state →
StatefulEntityBase::set_new_state → virtual get_state()) on the
common no-change path. Fixes -20% CodSpeed regression on
BinarySensorPublish_NoChange benchmark.
2026-03-22 18:38:34 -10:00
J. Nick Koston 84c58403f7 [sensor] Clarify compile-time vs runtime in raw_callback comment 2026-03-22 18:34:28 -10:00
J. Nick Koston 936764b89a [text_sensor] Clarify compile-time vs runtime in raw_callback comment 2026-03-22 18:33:58 -10:00
J. Nick Koston 99c0db34cc Merge branch 'dev' into deprecate-sensor-raw-state 2026-03-22 18:26:43 -10:00
J. Nick Koston baf365404c [network] Inline get_use_address() to eliminate function call overhead (#14942) 2026-03-23 04:18:43 +00:00
J. Nick Koston 4a200f8a2b [binary_sensor] Reduce flash: cache get_state(), guard full_state_callbacks call
- Cache get_state() result to avoid calling the virtual method twice
  (once for comparison, once for old_state construction)
- Move full_state_callbacks_.call() inside the !empty() guard so both
  the optional construction and the call are skipped when no callbacks
- Swap to had_state || get_trigger_on_initial_state() so the virtual
  call is skipped on the common path (every change except the first)

Saves ~21 bytes of flash in set_new_state.
2026-03-22 18:16:57 -10:00
J. Nick Koston 8a4b152488 Merge branch 'dev' into binary-sensor-remove-optional-state 2026-03-22 18:08:32 -10:00
J. Nick Koston 874b30d97d [wifi] Fix roaming attempt counter reset on disconnect during scan
When WiFi disconnects while a roaming scan is in progress, the
SCANNING state was transitioning to IDLE in retry_connect(). When the
device then reconnected, check_connecting_finished() treated the IDLE
state as a normal connection and reset roaming_attempts_ to 0. This
caused the roaming counter to perpetually restart at 1/3 instead of
progressing to 2/3, 3/3, creating an infinite loop of roaming scans
every 5 minutes.

This is most likely to occur on ESP8266 where disconnect callbacks
run immediately in SDK system context (setting error_from_callback_
before the main loop can process scan results), compared to ESP32 IDF
where events are queued and the scan-done event is typically processed
before the disconnect.

Fix by transitioning to RECONNECTING instead of IDLE when a disconnect
occurs during SCANNING. This preserves the attempts counter on
successful reconnection, allowing the device to reach the 3-attempt
limit and stop scanning.
2026-03-22 18:04:58 -10:00
J. Nick Koston 1458b03d7f Merge branch 'dev' into text-sensor-guard-raw-callback 2026-03-22 18:03:12 -10:00
J. Nick Koston efcb660691 [text_sensor] Guard raw_callback_ behind USE_TEXT_SENSOR_FILTER
Same pattern as sensor: raw_callback_ is only needed when filters are
configured. add_on_raw_state_callback remains always available —
without filters it delegates to callback_ since raw == filtered.

Saves 4 bytes per TextSensor instance on builds without filters.
2026-03-22 17:48:12 -10:00
J. Nick Koston 0de2c758aa [scheduler] Use placement-new for std::function move in set_timer_common_ (#14757) 2026-03-23 16:31:27 +13:00
J. Nick Koston 597bb18543 [benchmark] Add binary sensor publish and sensor filter benchmarks (#15035) 2026-03-23 16:30:57 +13:00
Jesse Hills ebdf20adc0 Merge branch 'release' into dev 2026-03-23 16:10:17 +13:00
J. Nick Koston 0b66dc7a34 Merge branch 'dev' into deprecate-sensor-raw-state 2026-03-22 17:10:06 -10:00
J. Nick Koston 5e3d1f8de2 Merge branch 'dev' into binary-sensor-remove-optional-state 2026-03-22 17:09:40 -10:00
Jesse Hills 7ecdf6db2e Merge pull request #15084 from esphome/bump-2026.3.1
2026.3.1
2026.3.1
2026-03-23 16:09:32 +13:00
J. Nick Koston 8a3b5a8def [core] Fix placement new storage name for templated types (#15096) 2026-03-23 16:09:23 +13:00
J. Nick Koston 65f02ac690 Merge remote-tracking branch 'upstream/fix-pstorage-template-namespace' into binary-sensor-remove-optional-state 2026-03-22 16:59:09 -10:00
J. Nick Koston 6c95f2e706 [core] Fix placement new storage name for templated types
When Pvariable types contain template arguments with :: (e.g.
Automation<std::optional<bool>>), the namespace extraction logic
incorrectly split on :: inside the template params, producing
invalid C++ identifiers like Automation<std__automation_id__pstorage.

Fix by stripping template arguments before extracting the namespace.
Extract the logic into a testable _extract_component_ns helper.
2026-03-22 16:56:35 -10:00
J. Nick Koston 9578376f46 [sensor] Remove USE_SENSOR_FILTER guard from SensorRawStateTrigger
add_on_raw_state_callback is always available now (delegates to
callback_ without filters). SensorRawStateTrigger doesn't need
the guard, and on_raw_value doesn't need to set USE_SENSOR_FILTER.

Without filters raw == filtered, so the trigger fires with the
correct value either way — no wasted RAM on filter infrastructure.
2026-03-22 16:51:01 -10:00
J. Nick Koston 30b5c3fb71 [sensor] Keep add_on_raw_state_callback always available
Delegate to callback_ when USE_SENSOR_FILTER is off since raw state
equals filtered state without filters. This avoids requiring external
components to know about USE_SENSOR_FILTER.
2026-03-22 16:49:20 -10:00
J. Nick Koston 9291b71176 [binary_sensor] Move set_trigger_on_initial_state off StatefulEntityBase
set_trigger_on_initial_state is only called from codegen on concrete
BinarySensor instances. It's an implementation detail of BinarySensor,
not part of the StatefulEntityBase contract. Only get_trigger_on_initial_state
remains as a pure virtual — subclasses decide how to control it.
2026-03-22 16:45:00 -10:00
J. Nick Koston 8aa9a82c13 [binary_sensor] Clarify trigger_on_initial_state docs - subclass decides storage 2026-03-22 16:43:37 -10:00
J. Nick Koston a6e230d665 [binary_sensor] Restore comment about USE_BINARY_SENSOR guard 2026-03-22 16:40:47 -10:00
J. Nick Koston 1a8cbe92ff [binary_sensor] Update StatefulEntityBase docs to reflect virtual dispatch design 2026-03-22 16:39:28 -10:00
J. Nick Koston 3fd28eeea2 [binary_sensor] Inline send_state_internal - virtual dispatch prevents template bloat 2026-03-22 16:38:38 -10:00
J. Nick Koston 0417de007a [binary_sensor] Restore virtual set_new_state, remove on_state_changed hook
Making set_new_state virtual means callers like send_state_internal
and invalidate_state resolve via vtable dispatch to the .cpp, avoiding
template bloat without needing out-of-line tricks or hiding declarations.

BinarySensor overrides set_new_state directly for logging and
ControllerRegistry notification, matching the original pattern.
2026-03-22 16:37:54 -10:00
J. Nick Koston 27d38baf0d [binary_sensor] Fix invalidate_state: keep inline on base, hide on BinarySensor
invalidate_state() can't be declaration-only on a template class.
Keep it inline on StatefulEntityBase, and add a hiding declaration
on BinarySensor with an out-of-line definition in the .cpp to prevent
template bloat from automation.h and filter.cpp callers.
2026-03-22 16:36:17 -10:00
J. Nick Koston df733708d5 Merge branch 'dev' into binary-sensor-remove-optional-state 2026-03-22 16:33:32 -10:00
J. Nick Koston a827410ecf [binary_sensor] Fix clang-tidy naming: no trailing underscore on virtual methods
- set_new_state → set_new_state_ (protected non-virtual, trailing underscore)
- on_state_changed_ → on_state_changed (virtual, no trailing underscore)
- set_state_value_ → set_state_value (virtual, no trailing underscore)

Update StatefulEntityBase docs to list on_state_changed and invalidate_state.
2026-03-22 16:27:34 -10:00
J. Nick Koston 98d9fd76b3 [mqtt] Fix const-correctness for trigger constructors (#15093) 2026-03-22 16:27:20 -10:00
J. Nick Koston 6992219e34 [core] Attribute placement new storage symbols to components (#15092) 2026-03-22 16:27:07 -10:00
J. Nick Koston 349f45f582 [binary_sensor] Move send_state_internal and invalidate_state to .cpp
set_new_state is a template method (~189 bytes when instantiated).
Inlining callers like send_state_internal and invalidate_state causes
the template code to be duplicated at every call site (publish_state,
Filter::output, BinarySensorInvalidateAction::play, etc.), adding
~384 bytes of flash.

Keep these as out-of-line definitions in the .cpp so the template
is instantiated once.
2026-03-22 16:26:16 -10:00