Commit Graph
27945 Commits
Author SHA1 Message Date
J. Nick Koston 249d428a10 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-24 14:57:06 -05:00
dependabot[bot]dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>J. Nick Koston
f62972c2c6 Bump ruff from 0.15.11 to 0.15.12 (#15981)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2026-04-24 19:34:00 +00:00
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> f36efbc762 Update tzdata requirement from >=2026.1 to >=2026.2 (#15980)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-04-24 19:27:12 +00:00
J. Nick Koston 3c16cbf8e2 Merge branch 'inline-micros-esp32' into integration 2026-04-24 12:33:48 -05:00
J. Nick Koston 9f5121e271 [core] Suppress redundant-declaration warning for ESP32 esp_timer_get_time forward decl 2026-04-24 12:33:41 -05:00
J. Nick Koston bca5bc08a7 [core] Remove leftover -O2 attributes (writer.py loop, host/zephyr main) 2026-04-24 12:08:11 -05:00
J. Nick Koston c4829e0bc5 Merge branch 'inline-micros-esp32' into integration
Re-merge the updated PR (now keeps esp8266 millis/delay out-of-line so
integration's accumulator + custom delay overlay cleanly, while still
inlining yield/micros/millis_64 on esp8266).
2026-04-24 12:06:08 -05:00
J. Nick Koston a1e3ec7118 [core] Keep esp8266 millis/delay out-of-line for #15662 compatibility 2026-04-24 12:02:57 -05:00
J. Nick Koston 2d4dcc6f90 Merge branch 'inline-micros-esp32' into integration
Resolves esp8266/core.cpp conflict by keeping integration's custom
millis() accumulator, custom delay(), and __wrap_millis machinery
out-of-line — those cannot be inlined safely:

  - esphome::millis() is the body of __wrap_millis (-Wl,--wrap=millis),
    so it must remain a real symbol; inlining would cause infinite
    recursion at the wrapped call site.
  - delay() intentionally avoids Arduino's __delay → millis path so the
    slow Arduino millis body can be stripped from IRAM.
  - millis_64() depends on millis() and stays out-of-line for symmetry.

esp8266 yield() and micros() are removed from core.cpp (now inlined in
hal.h alongside the other Arduino-flavored platforms — both are simple
::yield()/::micros() passthroughs).

hal.h is patched so the USE_ESP8266 branch only inlines yield() and
micros(), while delay()/millis()/millis_64() stay as out-of-line
declarations (defined in esp8266/core.cpp).
2026-04-24 11:59:40 -05:00
J. Nick Koston 47b998d7f5 [core] Drop -O2 attribute hack in favor of inline HAL wrappers (will merge inline-micros-esp32 next) 2026-04-24 11:55:14 -05:00
Kevin Ahrendt 9caf9ee023 [sendspin] Bumps sendspin-cpp library for a bugfix (#15976) 2026-04-24 11:53:03 -05:00
J. Nick Koston d3bae21d13 [core] Extend HAL inlining to yield/delay/millis_64 + libretiny + rp2040
Extends the prior commit to cover more wrappers and platforms:

- ESP32: also inline yield() and delay()
- ESP8266: also inline yield(), delay(), millis(), millis_64()
- LibreTiny: inline yield(), delay(), micros(), per-variant millis()
  fast paths, and millis_64() (via Millis64Impl::compute, now reachable
  from hal.h since time_64.h dropped its helpers.h dep)
- RP2040: also inline yield(), delay(), micros()

Consolidates the ESP8266/LibreTiny/RP2040 Arduino-flavored ::yield /
::delay / ::micros wrappers into a single shared block in hal.h.

LibreTiny note: the prior IRAM_ATTR on the wrapper was decorative —
::micros(), ::yield(), ::delay() and xTaskGetTickCount all live in
flash on every libretiny family (realtek-amb, beken-72xx,
lightning-ln882h all checked), so an IRAM ISR call would have crashed
the same way an inlined direct call does.

Also drops the helpers.h include from time_64.h (only used for the
ESPHOME_ALWAYS_INLINE macro, replaced with the raw attribute) so
time_64.h is light enough for hal.h to include.
2026-04-24 11:51:23 -05:00
J. Nick Koston 9d138e73c9 [core] Suppress redundant-declaration warning for ESP8266 micros() forward decl 2026-04-24 11:35:03 -05:00
J. Nick Koston e23a6bf59f [core] Inline micros()/millis_64() at the HAL layer
Replaces the per-function ``__attribute__((optimize("O2")))`` approach in
#15693 with a direct inline definition of micros() / millis_64() in hal.h
for ESP32, plus inline definitions for ESP8266 micros() and RP2040
millis()/millis_64().

The original goal of #15693 was to inline micros() into the main loop so
that ``call esphome::micros() → call esp_timer_get_time()`` collapses to
a single ``call esp_timer_get_time``. That wrapper-collapse benefits
every micros() call site, not just loop_task — so the real fix is to
mark the wrapper inline, not to bump the loop's optimization level.

Doing this at the HAL layer also makes runtime_stats measurements more
accurate: each timing read no longer hides a wrapper call/return between
the component end-time capture and the underlying clock read.

Refactor: move ``micros_to_millis<>()`` from helpers.h to a new
lightweight ``time_conversion.h`` so hal.h can include it without
pulling the rest of helpers.h into every TU that includes hal.h.
2026-04-24 11:23:16 -05:00
J. Nick Koston be8e677085 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-24 10:46:31 -05:00
Kevin Ahrendt 94e300389c [sendspin] remove year and track number text sensors and refactor (#15975) 2026-04-24 15:35:32 +00:00
J. Nick Koston 49584c1f15 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-24 09:56:10 -05:00
Kevin Ahrendt 55bcf33446 [sendspin] Add metadata sensor component (#15971) 2026-04-24 14:32:47 +00:00
Kevin Ahrendt f132b7dc07 [media_player][speaker][speaker_source] Centralize preferred format codegen (#14771) 2026-04-24 14:09:03 +00:00
J. Nick Koston 6cee6d68f4 Merge remote-tracking branch 'upstream/sendspin-sensors' into integration 2026-04-24 09:06:41 -05:00
Kevin Ahrendt 61de24a279 drop bound check on year and track number as they aren't relevant (we only checked text sensors so we wouldn't overflow the character buffer) 2026-04-24 09:56:09 -04:00
J. Nick Koston e694873aa5 Merge remote-tracking branch 'upstream/sendspin-sensors' into integration 2026-04-24 08:52:29 -05:00
Kevin Ahrendt 66019feb8f add year and track number sensors (will remove them from text_sensor in a future PR) 2026-04-24 09:27:37 -04:00
J. Nick Koston baa6d5f96b [web_server_idf] Fix cross-thread race on SSE session state (#15967) 2026-04-24 08:11:47 -05:00
J. Nick Koston 773b4d887b [core] Scheduler: don't sleep while defer queue is non-empty (#15968) 2026-04-24 08:11:29 -05:00
Kevin Ahrendt a179a0de22 log the update interval for the track progress sensor 2026-04-24 08:46:11 -04:00
Kevin Ahrendt f395e29c59 publish immediately on resume 2026-04-24 08:44:41 -04:00
Kevin Ahrendt 6b278e3eb4 make both sensors inherit from the hub's defined child classes to enforce setup priority 2026-04-24 08:44:24 -04:00
Kevin Ahrendt 8f3a2691fa Add a SendspinPolloingChild class to enforce uniform setup priority 2026-04-24 08:43:42 -04:00
Kevin Ahrendt 52eeb52d0e mark get_track_progress_ms as const 2026-04-24 08:43:06 -04:00
Kevin Ahrendt 42f0b1a7e2 add Sendspin sensor component 2026-04-24 08:21:29 -04:00
Kevin Ahrendt ac7f0f0b74 [sendspin] Add a metadata text sensor component (#15969) 2026-04-24 11:07:00 +00:00
J. Nick Koston 761e32bdc5 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-24 05:53:44 -05:00
Kevin AhrendtCopilotCopilotpre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>J. Nick Koston
bc7f35b569 [sendspin] Add a Sendspin media source component for playing audio (PR4) (#15950)
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2026-04-24 10:00:22 +00:00
J. Nick Koston b07ec95c13 Merge remote-tracking branch 'upstream/dev' into integration 2026-04-24 03:42:42 -05:00
J. Nick Koston ae02ab3865 [wifi] Fix stale wifi.connected after state transition (#15966) 2026-04-24 03:42:36 -05:00
J. Nick Koston 0542674452 Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration 2026-04-24 03:42:27 -05:00
J. Nick Koston 8bd8be2ac2 [web_server_idf] Add NOLINT at call site for cross-function analyzer path
The function-level NOLINTBEGIN/NOLINTEND on start_session_main_loop_()
only covers bug paths whose primary or note locations fall inside that
function. clang-analyzer now traces the leak through the caller chain
(AsyncEventSource::loop -> adopt_pending_sessions_main_loop_ ->
start_session_main_loop_ -> ArduinoJson), with notes at lines 497/498
and 530/537 that sit outside the wrapped range. Add a NOLINTNEXTLINE
at the call site in adopt_pending_sessions_main_loop_ so the caller's
bug-path location is covered too.
2026-04-24 03:41:48 -05:00
J. Nick Koston de729c6095 Merge remote-tracking branch 'upstream/scheduler_wake_when_defer_pending' into integration 2026-04-24 03:37:51 -05:00
J. Nick Koston d507feaf81 [core] Scheduler::next_schedule_in: also handle single-threaded defer path
On ESPHOME_THREAD_SINGLE builds (ESP8266, RP2040), defer() does not
route through defer_queue_ — set_timer_common_ treats it as an ordinary
0-delay set_timeout that stages in to_add_ (scheduler.cpp:197). Since
next_schedule_in only inspects items_[0], any defer posted from a
component's loop() sits in to_add_ invisible to the sleep calculation
until the next scheduler.call() runs process_to_add().

The symmetric fix checks to_add_empty_() on single-threaded and
short-circuits sleep the same way. This also costs one "skipped sleep"
for any non-zero-delay timer added at runtime, but the next tick
produces a correct next_schedule_in reading and the cost is a single
yield — negligible vs. the stall this closes.

Suggested by Copilot review on #15968.
2026-04-24 03:37:11 -05:00
J. Nick Koston f4b7bb3613 Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration 2026-04-24 03:28:37 -05:00
J. Nick Koston b0ac9477df [web_server_idf] Widen NewDeleteLeaks NOLINT over start_session_main_loop_
The previous narrow NOLINT only wrapped the sorting_groups JSON loop.
Now that the function is invoked through an extra call layer
(loop() -> adopt_pending_sessions_main_loop_ -> start_session_main_loop_),
clang-analyzer traces a leak path through ws->get_config_json() as
well -- also a false positive inside ArduinoJson's VariantData.
Move the NOLINTBEGIN/NOLINTEND to bracket the entire function body.
2026-04-24 03:28:24 -05:00
J. Nick Koston c150041f1a Merge remote-tracking branch 'upstream/scheduler_wake_when_defer_pending' into integration 2026-04-24 03:28:04 -05:00
J. Nick Koston da5c31cb27 [core] Scheduler::next_schedule_in: return 0 when defer queue is non-empty
On multi-thread platforms (ESP32/LibreTiny/host), defer() items go
directly into a separate defer_queue_ instead of the main items_ heap
(scheduler.cpp:200). next_schedule_in previously only looked at
items_[0], so a pending defer posted from a background task was
invisible to the loop's sleep-duration calculation: if items_[0] fired
seconds away, the main loop would sleep that long on ulTaskNotifyTake
while the defer sat unexecuted.

In practice this rarely bit anyone because concurrent socket activity
usually woke the loop via the lwip fast-select path, but a defer with
no accompanying network traffic could stall for seconds.

Check defer_empty_() (cheap atomic/volatile load, scheduler.h:594)
before the items_ check and return 0 if pending. process_defer_queue_
runs at the top of every scheduler.call(), so "defer pending" == "run
immediately."

Single-threaded platforms funnel defers into to_add_ like any other
timeout, so the fix is gated on !ESPHOME_THREAD_SINGLE.
2026-04-24 03:26:21 -05:00
J. Nick Koston ba93b9af18 Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration 2026-04-24 03:19:13 -05:00
J. Nick Koston 4fca594871 [web_server_idf] Drop redundant 'Removing dead event source session' log
destroy() already logs the close with the fd on the httpd task, so the
follow-up log when the main loop reaps the session adds no information
and doubles log volume during reconnect storms.
2026-04-24 03:18:58 -05:00
J. Nick Koston b46ccb5ae0 [web_server_idf] Move NOLINTNEXTLINE adjacent to onConnect declaration 2026-04-24 03:16:42 -05:00
J. Nick Koston c024cfd0dc Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration 2026-04-24 03:11:28 -05:00
J. Nick Koston 3507d567cc [web_server_idf] Preserve on_connect_ ordering and document main-loop context
Pre-refactor, on_connect_ ran after the ctor had already sent the
initial ping/config/sorting_groups. Call start_session_main_loop_()
before on_connect_ so the callback still observes a primed session.

Also document at onConnect() that the callback now runs on the main
loop instead of the httpd task.
2026-04-24 03:10:17 -05:00
J. Nick Koston b2b29cd506 Merge remote-tracking branch 'upstream/web_server_idf_session_ownership' into integration 2026-04-24 03:08:25 -05:00