Commit Graph

28397 Commits

Author SHA1 Message Date
J. Nick Koston d403f472fc Merge remote-tracking branch 'upstream/api-infrared-rf-speed-optimized' into integration 2026-04-30 06:22:15 -05:00
J. Nick Koston 27116e1239 Merge remote-tracking branch 'origin/followup/hal-libretiny' into integration 2026-04-29 22:50:45 -05:00
J. Nick Koston 6097d5d7f8 Merge branch 'dev' into followup/hal-libretiny
# Conflicts:
#	esphome/core/hal/hal_libretiny.h
2026-04-29 22:43:47 -05:00
J. Nick Koston f0bffed3c0 [esp8266] Move HAL bodies into components/esp8266/hal.cpp + inline arch_init (#16112) 2026-04-30 15:42:17 +12:00
J. Nick Koston 663f856076 [api] Mark ZWaveProxyFrame and SerialProxyDataReceived as speed_optimized
Both messages are unconditionally exercised in the proxy hot paths
(every Z-Wave frame received from the controller; every UART read on a
configured serial proxy), so the modest flash cost of forcing -O2 on
their encode/calculate_size pays off on every device that has the proxy
enabled. Same treatment as InfraredRFReceiveEvent in the prior commit
and the other high-volume server-emitted messages.
2026-04-29 22:40:53 -05:00
J. Nick Koston 1d4dbf5476 [api] Mark InfraredRFReceiveEvent encode/calculate_size as speed_optimized
This message is emitted on every IR/RF receive event with a packed sint32
timings array (typically ~50-200 entries). The encode walks the vector
calling ProtoEncode::encode_sint32 per element; under -Os GCC does not
inline those helpers, so each element pays the call overhead.

Adding option (speed_optimized) = true to the proto definition causes
the codegen to emit __attribute__((optimize("O2"))) on encode and
calculate_size, matching what already exists on SensorStateResponse,
SubscribeLogsResponse, and BluetoothLERawAdvertisementsResponse — the
other high-volume server-emitted messages.

The CodSpeed Encode_InfraredRFReceiveEvent / CalculateSize_InfraredRFReceiveEvent
benchmarks added in the parent PR will quantify the improvement.
2026-04-29 22:40:52 -05: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
Jesse Hills 1a871e231d [ci] Use client-id for GitHub App token generation (#16155) 2026-04-30 13:09:37 +12:00
Jesse Hills 47765bd2d0 [ci] Correct version comment on create-github-app-token pin (#16156) 2026-04-30 13:08:56 +12:00
dependabot[bot] 8066325e0b Bump esphome/workflows/.github/workflows/lock.yml from 2026.4.0 to 2026.4.1 (#16143)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-30 12:52:25 +12:00
J. Nick Koston b8d24c9e49 [mcp23xxx_base] Reject unsupported interrupt_pin options (inverted, allow_other_uses) (#16149) 2026-04-30 11:14:07 +12:00
J. Nick Koston 9b1f5c59bb [core] Fix null deref in WarnIfComponentBlockingGuard for self-keyed scheduler timers (#16150) 2026-04-29 23:05:38 +00:00
J. Nick Koston b16aeb8c60 Merge remote-tracking branch 'upstream/core-delay-action-drop-internal-id' into integration 2026-04-29 17:54:04 -05:00
J. Nick Koston 534fd3f8da Merge remote-tracking branch 'upstream/mdns-config-hash' into integration 2026-04-29 17:53:59 -05:00
J. Nick Koston 6259935065 update host stub 2026-04-29 17:53:14 -05:00
J. Nick Koston 8dea8135fa [core] Drop unused DELAY_ACTION from InternalSchedulerID enum
Followup to #16129. DelayAction now keys its scheduler entry by
self-pointer (NameType::SELF_POINTER), so the DELAY_ACTION enum
value is no longer referenced anywhere.
2026-04-29 17:49:06 -05:00
Jonathan Swoboda e4b33fddf5 [esp32] Add ESP-IDF 6.0.1 platform entry (#16146) 2026-04-29 18:43:15 -04:00
J. Nick Koston 46dd1ced2c Merge remote-tracking branch 'upstream/fix-runtime-stats-null-component' into integration 2026-04-29 17:29:01 -05:00
J. Nick Koston 295e8563eb [core] Fix null deref in WarnIfComponentBlockingGuard for self-keyed timers
Self-keyed scheduler items (Scheduler::set_timeout(self, ...) and
set_interval(self, ...)) intentionally store component == nullptr. When
USE_RUNTIME_STATS is enabled, WarnIfComponentBlockingGuard::finish()
dereferenced component_ to call runtime_stats_.record_time(), causing a
load access fault on RISC-V (e.g. ESP32-C3) when these timers fire.

Skip the per-component bookkeeping when component_ is null, but still
accumulate into ComponentRuntimeStats::global_recorded_us so
Application::loop() overhead accounting (which subtracts scheduled
callback time from before_loop_tasks_) stays accurate.
2026-04-29 17:27:25 -05:00
J. Nick Koston 15bb89ed64 Merge remote-tracking branch 'upstream/mdns-config-hash' into integration 2026-04-29 16:45:16 -05:00
J. Nick Koston 5a59e99016 [mdns] Move setup helper to .cpp and use format_hex_to 2026-04-29 16:44:03 -05:00
J. Nick Koston 4b6b5fe275 Merge remote-tracking branch 'upstream/mdns-config-hash' into integration 2026-04-29 16:30:20 -05:00
J. Nick Koston 7543a356c8 Merge branch 'dev' into mdns-config-hash 2026-04-29 16:25:12 -05:00
J. Nick Koston 2c87abe130 Merge remote-tracking branch 'upstream/followup/hal-libretiny' into integration 2026-04-29 16:21:27 -05:00
J. Nick Koston f484c28060 Merge remote-tracking branch 'upstream/followup/hal-esp8266' into integration 2026-04-29 16:06:03 -05:00
Jonathan Swoboda 77da64a367 [sx126x] Add cold sleep option and drop unused RTC wakeup bit (#16144) 2026-04-29 17:05:51 -04:00
J. Nick Koston 1a75db7437 Merge branch 'followup/hal-esp8266' into followup/hal-libretiny 2026-04-29 15:52:19 -05:00
J. Nick Koston 387aba530d Merge branch 'dev' into followup/hal-esp8266 2026-04-29 15:52:17 -05:00
J. Nick Koston d7bbc9d2d9 Merge branch 'followup/hal-esp8266' into followup/hal-libretiny 2026-04-29 15:38:01 -05:00
J. Nick Koston 09542430f4 [esp8266] Address Copilot review on #16112
- hal.cpp: include esphome/core/helpers.h for the HOT macro (millis/delay
  use it; without the include the TU fails to compile).
- hal_esp8266.h: drop the redundant arch_get_cpu_cycle_count() bare
  declaration that came back via the merge from dev (the inline def
  above already declares the function).
2026-04-29 15:37:47 -05:00
J. Nick Koston 87b9a9612a [mdns] Broadcast config_hash TXT record on _esphomelib._tcp 2026-04-29 15:37:35 -05:00
J. Nick Koston cecccebc64 [core] DelayAction: drop Component inheritance, use self-keyed scheduler (#16129) 2026-04-29 20:35:04 +00:00
J. Nick Koston e374e8f65b Merge branch 'followup/hal-esp8266' into followup/hal-libretiny 2026-04-29 15:19:44 -05:00
Jonathan Swoboda 53b682e48f [ci] Bump clang-tidy from 18.1.8 to 22.1.0.1 (#16078)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-29 20:19:33 +00:00
J. Nick Koston 6bbb5668b4 Merge branch 'dev' into followup/hal-esp8266
# Conflicts:
#	esphome/core/hal.h
#	esphome/core/hal/hal_esp32.h
#	esphome/core/hal/hal_host.h
#	esphome/core/hal/hal_libretiny.h
#	esphome/core/hal/hal_rp2040.h
#	esphome/core/hal/hal_zephyr.h
2026-04-29 15:19:32 -05:00
Mat931 14910e65d9 [ota] Use WatchdogManager for OTA on ESP32 (#16138)
Co-authored-by: J. Nick Koston <nick@koston.org>
2026-04-29 20:15:21 +00:00
J. Nick Koston 813964714c [esp32] Move HAL bodies into components/esp32/hal.cpp + inline trivial dispatches (#16111) 2026-04-29 20:09:08 +00:00
J. Nick Koston 8246b09445 Merge branch 'ota-watchdogmanager' into integration 2026-04-29 14:34:36 -05:00
J. Nick Koston 5a146ab6b7 [valve] Fold ControlAction fields into a single stateless lambda (#16123) 2026-04-29 19:20:15 +00:00
J. Nick Koston 61a41402df [fan] Fold TurnOnAction fields into a single stateless lambda (#16122) 2026-04-29 19:16:05 +00:00
J. Nick Koston a68d4324a3 Merge branch 'dev' into ota-watchdogmanager 2026-04-29 13:51:51 -05:00
Mat931 59b4cfd07c [watchdog] Use default CHECK_IDLE_TASK and PANIC when configuring the watchdog (#16142) 2026-04-29 18:41:12 +00:00
J. Nick Koston 32d39ca7f4 Merge remote-tracking branch 'upstream/followup/hal-esp8266' into integration 2026-04-29 13:31:04 -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
Clyde Stubbs 0ad8a071a7 [espnow] Cleanup method visibility and naming (#16109) 2026-04-29 14:18:21 -04: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