Commit Graph
27841 Commits
Author SHA1 Message Date
J. Nick Koston 5be5f16662 Fix compat: heap-allocate deprecated vector, add find fallback
Two bugs fixed from Copilot review:

1. Dangling pointer on copy: deprecated setters stored data in an
   OwnedPresetModes struct on FanTraits. If the traits object was
   copied, the copy's pointer dangled. Fix: deprecated setters now
   heap-allocate (intentional leak). Pointer survives any copy.
   Remove the OwnedPresetModes wrapper entirely.

2. find_preset_mode_ / save_state_ only searched the Fan-owned
   vector, breaking external components using the deprecated traits
   setters. Fix: fall back to get_traits() when the entity vector
   is null.
2026-03-26 13:52:41 -10:00
J. Nick Koston 5ea1c08975 Merge branch 'dev' into media-player-trigger-trampoline 2026-03-26 13:52:30 -10:00
J. Nick Koston 79228c7c0e Merge branch 'dev' into rtttl-trigger-trampoline 2026-03-26 13:52:22 -10:00
J. Nick Koston fa8a609bcc [automation] Eliminate trigger trampolines with deduplicated forwarder structs (#15174) 2026-03-26 13:50:50 -10:00
J. Nick Koston 5a9e55707b Fix compat: heap-allocate deprecated vectors, add find fallback
Two bugs fixed from Copilot review:

1. Dangling pointer on copy: deprecated setters stored data in an
   OwnedCustomModes struct on ClimateTraits. If the traits object was
   copied (when NRVO doesn't apply), the copy's pointer dangled.
   Fix: deprecated setters now heap-allocate (intentional leak, same
   pattern as Climate entity). Pointer survives any copy. Remove the
   OwnedCustomModes wrapper entirely.

2. find_custom_fan_mode_ / find_custom_preset_ only searched the
   Climate-owned vectors, breaking external components using the
   deprecated traits setters. Fix: fall back to get_traits() when
   the entity vector is null.
2026-03-26 13:50:18 -10:00
J. Nick Koston 554d97ff04 Fix clang-tidy: add braces around if statements, extract ensure helper 2026-03-26 13:33:15 -10:00
J. Nick Koston c283e11ffa Fix clang-tidy: add braces around if statements, extract ensure helpers 2026-03-26 13:32:32 -10:00
J. Nick Koston 4ff0d30e07 Use leak-on-purpose raw pointer for Fan-owned preset modes vector
Fan entities live for the entire program lifetime, so the preset
modes vector never needs to be freed. Use a raw pointer (null by
default, allocated on first set_supported_preset_modes() call)
instead of an inline std::vector member.

This saves 24 bytes of RAM per Fan instance for components that
don't use preset modes (binary, bedjet, tuya, etc.).
2026-03-26 13:24:58 -10:00
J. Nick Koston 805bc4c9a8 Use leak-on-purpose raw pointers for Climate-owned vectors
Climate entities live for the entire program lifetime, so the custom
mode vectors never need to be freed. Use raw pointers (null by default,
allocated on first set_supported_custom_*() call) instead of inline
std::vector members.

This saves 48 bytes of RAM per Climate instance (two empty vectors)
for components that don't use custom modes (bang_bang, pid, etc.),
and avoids any copy overhead in get_traits().
2026-03-26 13:22:46 -10:00
J. Nick Koston df58091d1d Make compat owned vector skip-on-copy to eliminate copy overhead
Wrap the deprecated owned vector in a struct with a no-op copy
constructor. FanTraits copies (which happen on every get_traits()
call) don't pay the 24-byte cost of copying an empty vector.
2026-03-26 13:14:52 -10:00
J. Nick Koston ba57555b6f Make compat owned vectors skip-on-copy to eliminate copy overhead
Wrap the deprecated owned vectors in a struct with a no-op copy
constructor. This way ClimateTraits copies (which happen on every
get_traits() call) don't pay the 48-byte cost of copying two empty
vectors. The compat data only matters for the original traits object
where the deprecated setter was called.
2026-03-26 13:13:16 -10:00
J. Nick Koston b2290891a3 Revert benchmark changes — keep identical to base for apples-to-apples comparison 2026-03-26 13:11:24 -10:00
J. Nick Koston fe395ac41d Use plain vector compat members, add custom modes benchmark
The owned vectors add 48 bytes to ClimateTraits copies — this is the
cost of backward compat and will be removed in 2026.11.0.

Add ClimatePublish_WithCustomModes benchmark to show the improvement
for climate devices that use custom fan modes and presets (the case
that previously heap-allocated on every publish).
2026-03-26 13:10:47 -10:00
J. Nick Koston 3f1dfd0f3f Fix deprecation dates: 2026.5.0 deprecated, 2026.11.0 removed 2026-03-26 13:05:33 -10:00
J. Nick Koston 237cfdebfc [fan] Store preset mode vector on Fan entity, not FanTraits
FanTraits contained a std::vector<const char *> for preset modes.
Every get_traits() call reconstructed this vector, causing heap
allocations on every publish_state() and control()/perform() call.

Move the vector storage to the Fan base class and have FanTraits hold
a const pointer instead. Internal callers (save_state_, find_preset_mode_)
search the Fan-owned vector directly, avoiding traits reconstruction.

The old FanTraits setters are preserved as deprecated compatibility
overloads (removed in 2026.11.0) that self-own the data, so external
components continue to compile — they just get a deprecation warning
and still heap-allocate until they migrate.
2026-03-26 13:04:59 -10:00
J. Nick Koston a723ca31ed Add deprecated compat layer, restore const ref return type
Keep the old set_supported_custom_fan_modes() and
set_supported_custom_presets() overloads on ClimateTraits as deprecated
compatibility shims. They self-own the data so external components
continue to compile without changes (heap alloc but functional).

Restores get_supported_custom_fan_modes() / get_supported_custom_presets()
to return const vector & (not pointer) for full backward compat.
2026-03-26 13:02:22 -10:00
J. Nick Koston 236d1ea88f Fix: use inline function for empty vector to avoid EMPTY macro clash and static local overhead 2026-03-26 12:56:30 -10:00
J. Nick Koston 013d832475 Fix clang-tidy: rename static constant empty to EMPTY 2026-03-26 12:42:15 -10:00
J. Nick Koston 854e8d90cb Fix copy lock namespace qualification for LockState 2026-03-26 12:39:44 -10:00
J. Nick Koston 7ae1f2f6d7 [climate] Store custom mode vectors on Climate entity, not ClimateTraits
ClimateTraits contained two std::vector<const char *> members for custom
fan modes and custom presets. Every get_traits() / traits() call
reconstructed these vectors, causing heap allocations on every
publish_state() and control()/perform() call — the hottest paths in the
climate component.

Move the vector storage to the Climate base class and have ClimateTraits
hold const pointers instead. get_traits() wires the pointers
automatically. This eliminates all heap allocation from ClimateTraits
copies, making the struct trivially copyable (floats + bitmasks +
2 pointers).

Additionally, set_custom_fan_mode_() and set_custom_preset_() no longer
need to call get_traits() just to search for a mode — they search the
Climate-owned vectors directly, removing another traits rebuild from the
control/perform path.
2026-03-26 12:38:25 -10:00
J. Nick Koston 24cc9bdb13 Update copy lock to accept LockState callback parameter 2026-03-26 12:31:14 -10:00
J. Nick Koston ce64d9ea4c Merge branch 'lock-trigger-trampoline' into integration 2026-03-26 10:37:29 -10:00
J. Nick Koston 0adb0f8426 Merge branch 'ld2450-trigger-trampoline' into integration 2026-03-26 10:37:18 -10:00
J. Nick Koston 05b2fda36f Merge branch 'media-player-trigger-trampoline' into integration 2026-03-26 10:37:12 -10:00
J. Nick Koston 491e065843 Merge branch 'alarm-control-panel-trigger-trampoline' into integration 2026-03-26 10:37:06 -10:00
J. Nick Koston 9073574bbd Merge branch 'safe-mode-trigger-trampoline' into integration 2026-03-26 10:37:01 -10:00
J. Nick Koston 4737407585 Merge branch 'rtttl-trigger-trampoline' into integration 2026-03-26 10:36:56 -10:00
J. Nick Koston bf575dd1c4 Merge branch 'eliminate-trigger-trampolines' into safe-mode-trigger-trampoline 2026-03-26 10:36:14 -10:00
J. Nick Koston 92bd8b85f3 Merge branch 'eliminate-trigger-trampolines' into alarm-control-panel-trigger-trampoline 2026-03-26 10:35:54 -10:00
J. Nick Koston 0ddda2561c Merge branch 'eliminate-trigger-trampolines' into lock-trigger-trampoline 2026-03-26 10:35:47 -10:00
J. Nick Koston 596f90ea0c Merge branch 'eliminate-trigger-trampolines' into ld2450-trigger-trampoline 2026-03-26 10:35:30 -10:00
J. Nick Koston 1a29edf836 Merge branch 'eliminate-trigger-trampolines' into media-player-trigger-trampoline 2026-03-26 10:35:22 -10:00
J. Nick Koston 6f1ed2132b Merge branch 'eliminate-trigger-trampolines' into rtttl-trigger-trampoline 2026-03-26 10:35:13 -10:00
J. Nick Koston ef1f028eb5 Refactor automation building to iterate tuples 2026-03-26 10:34:13 -10:00
J. Nick Koston 1f9b02165a Remove stale trigger class declarations and schema overrides 2026-03-26 10:32:04 -10:00
J. Nick Koston f6e58848ea Migrate rtttl FinishedPlaybackTrigger to callback automation 2026-03-26 10:26:52 -10:00
J. Nick Koston 88075c1e0c Migrate ld2450 LD2450DataTrigger to callback automation 2026-03-26 10:25:11 -10:00
J. Nick Koston 86434a2b99 Migrate media_player triggers to callback automation 2026-03-26 10:21:06 -10:00
J. Nick Koston 2dec1ee46e Migrate lock LockStateTrigger to callback automation 2026-03-26 10:16:07 -10:00
J. Nick Koston 310e58f282 Migrate alarm_control_panel triggers to callback automation 2026-03-26 10:09:46 -10:00
J. Nick Koston 33487966c6 Migrate safe_mode SafeModeTrigger to callback automation 2026-03-26 10:03:18 -10:00
dependabot[bot]andJ. Nick Koston 6aafb521c1 Bump ruff from 0.15.7 to 0.15.8 (#15192)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-03-26 19:59:21 +00:00
Edward Firmo 81f0aa1168 [nextion] Replace or/and operators and missing this-> (#15191) 2026-03-26 09:54:50 -10:00
dependabot[bot] 3152642571 Bump codecov/codecov-action from 5.5.3 to 6.0.0 (#15194)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-26 09:48:06 -10:00
dependabot[bot] 1e2c410abf Bump cryptography from 46.0.5 to 46.0.6 (#15193)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-26 09:47:18 -10:00
J. Nick Koston 4170f0ecb4 Merge remote-tracking branch 'origin/warn-verbose-logging' into integration 2026-03-26 09:43:45 -10:00
J. Nick KostonandCopilot a008c27fcf [climate] Avoid duplicate get_traits() in publish_state (#15181)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-26 15:01:08 -04:00
Clyde Stubbs 1edf952dda [font] Add unit tests verifying correct processing of glyphs (#15178) 2026-03-26 14:59:06 -04:00
Edward Firmo d9ada4536c [nextion] Fix leading space in pressed color string commands (#15190) 2026-03-26 14:58:12 -04:00
J. Nick Koston 76c93b882d [logger] Use only compiled log level for verbose warning
The compiled ESPHOME_LOG_LEVEL is what matters - all log calls up
to that level are in the binary and will format/block UART regardless
of runtime initial_level.
2026-03-26 08:30:00 -10:00