Commit Graph
3904 Commits
Author SHA1 Message Date
J. Nick Koston cb81ede701 Merge remote-tracking branch 'upstream/api-logs-decode-noraise' into integration 2026-05-01 12:09:10 -05:00
J. Nick Koston c05e66669e [api] Tidy decoder warning when EsphomeError has no message
_run_idedata raises EsphomeError() with no message, so the warning
shows 'unavailable ()' which looks like a bug. Use a generic fallback
explanation when str(exc) is empty.
2026-05-01 12:09:00 -05:00
J. Nick Koston 67b839c4bb Merge remote-tracking branch 'upstream/api-logs-decode-noraise' into integration 2026-05-01 12:06:19 -05:00
J. Nick Koston f4d3fb1a18 [api] Short-circuit log-line decoder after first failure
_decode_pc shells out to PlatformIO via _run_idedata; without a
populated build dir for the device that subprocess fails for every
PC/BT line in a crash dump. Disable decoding after the first
EsphomeError (per logs session) and emit a single user-facing warning
instead of retrying on every line.

Also rename the helper to _LogLineProcessor since it now owns the
per-session decode-enabled state, not just the decode call.
2026-05-01 12:01:19 -05:00
J. Nick Koston fcc6f04805 [api] Don't tear down log connection on stack-trace decode failure
When 'esphome logs' processes a crash backtrace from the device,
process_stacktrace -> _decode_pc -> _run_idedata can raise
EsphomeError if the local build dir hasn't been populated (e.g. the
device was flashed from a different machine). on_log runs inside an
asyncio protocol callback, so the unhandled exception triggers
'Fatal error: protocol.data_received() call failed.', the loop tears
the connection down, and ReconnectLogic immediately reconnects. The
device replays the same crash trace and we loop forever.

Wrap the per-line decode in a helper that swallows EsphomeError so
the connection stays up. Also covered with unit tests for the new
helper.
2026-05-01 11:56:19 -05:00
Mat931andJ. Nick Koston 58cb7effd4 [ota] Add extended OTA protocol (#16164)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-05-01 10:40:14 -05:00
J. Nick Koston 918b1fac71 Merge branch 'ota-extended-protocol' into integration 2026-05-01 09:23:11 -05:00
J. Nick Koston 7f1cff1866 address bot nits 2026-05-01 09:22:37 -05:00
J. Nick Koston 588701fa9a Merge branch 'ota-extended-protocol' into integration 2026-05-01 09:10:26 -05:00
J. Nick Koston 54ac510a25 cover 2026-05-01 09:08:58 -05:00
J. Nick Koston a6cd2a9f4d improve error reporting in case we mess it up later 2026-05-01 09:08:07 -05:00
J. Nick Koston fd921fb9e0 Merge branch 'ota-extended-protocol' into integration 2026-05-01 09:01:46 -05:00
Mat931 23ac2ead27 Merge branch 'dev' into ota-extended-protocol 2026-05-01 09:12:47 +00:00
J. Nick Koston 4e560dbd2e Merge remote-tracking branch 'upstream/dev' into integration 2026-04-30 21:11:33 -05:00
Kevin Ahrendt faa61696e0 [sendspin] Use sendspin-cpp to v0.4.0 to reduce stuttering (#16178) 2026-04-30 20:43:24 -05:00
J. Nick Koston 3d69169141 [climate] Fold ControlAction fields into a single stateless lambda (#16044) 2026-04-30 19:16:16 -05:00
J. Nick Koston 148d478dec [api] Add encode/decode benchmarks for Z-Wave, IR/RF, and serial proxy messages (#16157) 2026-04-30 19:14:20 -05:00
J. Nick Koston 2fbfb4c385 [ci] Split integration tests into 3 buckets when count is more than 10 (#16152) 2026-04-30 19:10:53 -05:00
Mat931 cba3fc51be Delete partition_access test 2026-04-30 20:18:30 +02:00
Mat931 68334cdd44 Remove conditional compilation 2026-04-30 20:02:07 +02:00
Mat931 5535b05bf5 Fix tests 2026-04-30 19:13:40 +02:00
J. Nick Koston 20743e3e9a Merge branch 'scheduler-pool-unbounded-freelist' into integration 2026-04-30 11:06:46 -05:00
J. Nick Koston 2a451cb870 [core] Strengthen scheduler-pool integration test with lower-bound check
Adds an assertion that the observed peak pool size exceeds the old
MAX_POOL_SIZE=5 cap. Without this, a silent regression that re-introduced a
small cap could pass the existing pool_full_count == 0 invariant. Phase 5 + 6
of the fixture schedule 8 + 10 same-component timeouts, so the peak should
comfortably exceed 5.

Address Copilot review feedback on PR.
2026-04-30 10:57:11 -05:00
J. Nick Koston f9b87d0ede [core] Replace scheduler pool vector with unbounded intrusive freelist
The fixed MAX_POOL_SIZE=5 cap was the source of the heap churn the pool was
meant to prevent: any device with more than 5 concurrent timers (e.g. a board
with 30+ LD2450 sensors) hit a steady-state oscillation of recycle->delete and
acquire->new on every loop iteration.

Replace std::vector<SchedulerItem*> with a singly-linked freelist threaded
through SchedulerItem::next_free, which shares storage with `component` via an
anonymous union (zero per-item overhead -- the component pointer is dead while
pooled). Drop the cap entirely: the freelist quiesces at the application's
natural concurrent-timer high-water mark, which is the working set the device
already needs while those timers are active.

No std::vector means no growth-doubling slack and no realloc copies during
warm-up. Caller of get_item_from_pool_locked_() must overwrite item->component
before unlocking (already true at the sole call site); nullptr remains a valid
live `component` value for SELF_POINTER items, so we cannot pre-clear it.
2026-04-30 10:42:46 -05:00
J. Nick Koston e32ce0f006 Merge remote-tracking branch 'upstream/sensor-throttle-average-pack-bitfield' into integration 2026-04-30 08:15:59 -05:00
J. Nick Koston d05f4f82e1 Merge remote-tracking branch 'upstream/core-loop-wake-take-first' into integration 2026-04-30 07:52:35 -05:00
Kevin Ahrendt a8b0133ec1 [audio] Enable specific codecs and configure advanced features (#16166) 2026-04-30 08:49:28 -04:00
J. Nick Koston d403f472fc Merge remote-tracking branch 'upstream/api-infrared-rf-speed-optimized' into integration 2026-04-30 06:22:15 -05:00
Mat931 c99e60be7d Add extended OTA protocol (split from PR #15780) 2026-04-30 10:51:12 +02:00
Jesse Hills e127268dac [core] Strip \\?\ prefix from sys.executable for PlatformIO subprocess (#16158) 2026-04-30 16:04:52 +12:00
J. Nick Koston 8c0e5e9d9a [api] Address Copilot review on proxy benchmarks PR
- Make UARTFlushResult in the serial_proxy stub a scoped enum class with
  matching scoped enumerator return in flush_port(), so the stub
  signature lines up with the real esphome::uart::UARTFlushResult.
- Replace heap-leaking lazy-init in get_ir_timings_100() with a
  function-local static const std::vector populated by a regular helper
  function. Same lazy-init behavior, no leak in valgrind/ASan, no lambda
  IIFE.
- Emit field 6 (modulation = 1) in build_infrared_rf_transmit_wire() so
  the bytes match the documented field list and the decode benchmark
  also exercises the field-6 decode_varint path.
2026-04-29 22:40:45 -05:00
J. Nick Koston a0532d657f [api] Drop escape() helper and return-by-value APIBuffer in proxy decode benchmarks
Simplifies the decode benchmarks to mirror the encode pattern more
closely: no per-iteration asm volatile barrier, no return-by-value of
APIBuffer through encode_message_for_proxy. CodSpeed callgrind has been
crashing inside Decode_ZWaveProxyFrame and the previous setup was the
main thing it had that the (passing) Encode_ZWaveProxyFrame did not.
2026-04-29 21:46:32 -05:00
J. Nick Koston 483d294ef6 [api] Move proxy message benchmarks into bench_proto_proxy.cpp
Splitting these out from bench_proto_encode.cpp and bench_proto_decode.cpp
moves them to the end of the linker's static-init order. CodSpeed's
callgrind runner has been segfaulting immediately after measuring the
last existing decode benchmark (Decode_SwitchCommandRequest), and
isolating the new code into its own translation unit lets us see whether
the crash is triggered by one of the new benchmarks or by something
about the new USE_*_PROXY/USE_INFRARED/USE_RADIO_FREQUENCY defines
changing how api_pb2.cpp compiles.
2026-04-29 21:38:01 -05:00
J. Nick Koston f841de0664 [api] Avoid lambda IIFE and per-byte APIBuffer growth in proxy benchmarks
The InfraredRFReceiveEvent encode benchmark used a C++17 lambda IIFE
(`[]{...}()`) to seed a function-static vector, and the
InfraredRFTransmitRawTimingsRequest decode benchmark grew its APIBuffer
one byte at a time (~210 grow_() calls), each allocating a fresh
exact-fit buffer and memcpy'ing the prior contents. Both patterns are
fine under direct execution but appear to hit a CodSpeed/valgrind
edge case during the simulated benchmark run.

Switch to a plain heap-init pattern for the vector and build the wire
bytes into a stack array first, then resize+memcpy into the APIBuffer
once.
2026-04-29 21:25:46 -05:00
J. Nick Koston 4c027e87ba [api] Add encode/decode benchmarks for Z-Wave, IR/RF, and serial proxy messages
Mirrors the existing BluetoothLERawAdvertisementsResponse benchmarks for
the remaining proxy message families: ZWaveProxyFrame/ZWaveProxyRequest,
SerialProxyDataReceived/SerialProxyWriteRequest, and
InfraredRFReceiveEvent/InfraredRFTransmitRawTimingsRequest.

Adds minimal stub headers under tests/benchmarks/stubs/ for the
zwave_proxy, infrared, radio_frequency, and serial_proxy components so
api_connection.cpp compiles without dragging in their UART/RMT/BLE
hardware dependencies.
2026-04-29 21:07:39 -05:00
J. Nick Koston 8246b09445 Merge branch 'ota-watchdogmanager' into integration 2026-04-29 14:34:36 -05:00
J. Nick Koston c41f38e16d [scheduler] Add self-keyed timer API for callers without a Component (#16127) 2026-04-29 13:24:37 -05:00
J. Nick Koston 985dba9332 [core] Defer heavy module-scope imports in __main__, loader, and config (#15955) 2026-04-29 13:17:59 -05:00
J. Nick Koston 44cabc191d [core] Catch body-read errors in download_content (#16023) 2026-04-29 14:06:41 -04:00
J. Nick Koston e5b1991cf7 [fan] Add tests for fan.turn_on action field combinations (#16125) 2026-04-29 12:46:06 -05:00
J. Nick Koston 7fba57ce51 [valve] Add tests for valve.control action field combinations (#16126) 2026-04-29 12:45:30 -05:00
J. Nick Koston e6f86b343c Merge remote-tracking branch 'upstream/binary-sensor-filters-drop-component' into integration 2026-04-29 11:08:17 -05:00
J. Nick Koston e3fdea8ce1 [scheduler] Address Copilot feedback: %p type, NameType doc, test docstring
- Strip const for the %p varargs call (the format spec takes void*, not
  const void*; same representation everywhere but pedantically correct).
- Mention SELF_POINTER in the NameType discriminator comment.
- Update test docstring to match the actual const void * signatures.
2026-04-29 11:06:04 -05:00
J. Nick Koston ba34021e8e Merge remote-tracking branch 'upstream/sensor-filters-drop-component' into integration 2026-04-29 10:21:49 -05:00
J. Nick Koston 9745a3299e [scheduler] Address review feedback (const void *, %p cast, buffer size) 2026-04-29 09:34:45 -05:00
J. Nick Koston 241d7797e3 [scheduler] Add self-keyed timer API for callers without a Component 2026-04-29 09:18:09 -05:00
Jonathan Swoboda 42b8597719 [api] Extend NOLINT to cover bugprone-random-generator-seed in MAC varint test (#16120) 2026-04-29 13:58:19 +00:00
J. Nick Koston dc48f2df13 Merge remote-tracking branch 'origin/cover-action-bitmask' into integration 2026-04-29 07:41:16 -05:00
J. Nick Koston 01a4769a5d Merge remote-tracking branch 'origin/climate-control-action-bitmask' into integration 2026-04-29 07:41:08 -05:00
J. Nick Koston f7c8df8234 [cover] Address review feedback (const ref args, drop mask numbering) 2026-04-29 06:56:18 -05:00