Commit Graph
26792 Commits
Author SHA1 Message Date
J. Nick Koston 04b40f8f15 Clean up comments in application.h 2026-04-04 10:32:49 -10:00
J. Nick Koston e372440ed2 [core] Move wake_loop out of socket component into core
Wake primitives (esp_schedule, __sev, FreeRTOS task notifications)
are platform SDK functions that don't depend on the socket/network
stack. Move them to esphome/core/wake.h/.cpp so they work
unconditionally on all platforms.

This eliminates the require_wake_loop_threadsafe() boilerplate,
the USE_WAKE_LOOP_THREADSAFE define, and the socket AUTO_LOAD
entries that 12 components needed just to use wake.

wake_loop_threadsafe() and wake_loop_any_context() now just work
on every platform without opt-in.
2026-04-04 10:32:32 -10:00
J. Nick Koston 173195ee1b Add comments explaining why latched interrupts are not cleared at setup 2026-04-04 10:22:50 -10:00
J. Nick Koston af87f21e68 Remove unnecessary latched interrupt clearing during setup
A latched interrupt at boot is harmless - the ISR fires immediately,
loop runs, cache invalidates, and a normal read cycle clears it.
The extra register reads added unnecessary complexity.
2026-04-04 10:22:19 -10:00
J. Nick Koston aeb8e9413b Clear latched MCP23xxx interrupts during setup, fix uint8_t truncation
- MCP23008/MCP23S08: Read GPIO register before attaching ISR to clear
  any latched interrupt from a previous MCU run (chip may stay powered)
- MCP23017/MCP23S17: Read both GPIOA and GPIOB to clear latched state
- PI4IOE5V6408: Add explicit static_cast<uint8_t> for ~mode_mask_ to
  avoid implicit int-to-uint8_t truncation
2026-04-04 10:21:28 -10:00
J. Nick Koston 1e9e5ca763 Fix pin_interrupt_mode overriding auto-enabled CHANGE interrupt
MCP23XXXGPIOPin::setup() calls pin_interrupt_mode(pin, NO_INTERRUPT)
after pin_mode() already auto-enabled CHANGE, undoing the auto-enable.
Skip the explicit pin_interrupt_mode call when interrupt_pin is
configured and the user didn't override the default.
2026-04-04 10:05:00 -10:00
J. Nick Koston 85036d64d9 Fix MCP23x17 MIRROR bit, add dump_config logging, and clear PI4IOE5V6408 latched interrupts
- MCP23017/MCP23S17: Enable MIRROR bit in IOCON when interrupt_pin is
  configured so INTA and INTB are ORed together, allowing a single
  interrupt wire to catch changes on all 16 pins
- All MCP23xxx variants: Log interrupt_pin in dump_config for debugging
- PI4IOE5V6408: Read interrupt status register during setup to clear
  any latched state that could hold INT line low
- MCP23XXXBase: Move setup_interrupt_pin_() to protected visibility
2026-04-04 10:03:40 -10:00
J. Nick Koston 8234512a89 Auto-enable chip-level interrupts for input pins
- MCP23x08/x17: auto-enable CHANGE interrupt mode in pin_mode() when
  interrupt_pin is configured, so users don't need to manually set
  interrupt: CHANGE on every pin
- PI4IOE5V6408: write interrupt enable mask for input pins in
  write_gpio_modes_() when interrupt_pin is configured
2026-04-04 09:44:59 -10:00
J. Nick Koston d1e737280f Fix ESP8266 SPI test pin conflict: use GPIO0 for interrupt_pin 2026-04-04 09:18:04 -10:00
J. Nick Koston 3773ff9a98 Fix clang-tidy: rename setup_interrupt_pin_ to setup_interrupt_pin 2026-04-04 09:17:29 -10:00
J. Nick Koston 41e09c1e6c [mcp23xxx][pi4ioe5v6408] Add optional interrupt pin to eliminate polling
Extend interrupt_pin support to MCP23008, MCP23017, MCP23S08, MCP23S17,
and PI4IOE5V6408 GPIO expander components. Same approach as PCF8574/PCA9554:
when configured, the component disables its loop and only wakes on interrupt,
and the cache stays valid between interrupts so binary sensors return from
cache instead of doing I2C/SPI reads every loop iteration.

For MCP23xxx, the interrupt_pin config and C++ logic lives in the shared
MCP23XXXBase template class, so all four variants (I2C 8/16-pin, SPI
8/16-pin) inherit it automatically.

Inspired by jesserockz's work in #11959 which proposed a more comprehensive
interrupt-driven approach with per-pin interrupt status register reading.
This implementation takes a simpler path by leveraging the existing
CachedGpioExpander cache invalidation mechanism.
2026-04-04 09:12:09 -10:00
J. Nick Koston ec11c17e74 Merge remote-tracking branch 'upstream/pcf8574-pca9554-interrupt-pin' into integration 2026-04-04 09:08:11 -10:00
J. Nick Koston 9f3fb37d12 Remove duplicate @brief line in cached_gpio.h 2026-04-04 08:59:09 -10:00
J. Nick Koston 0afdc6df26 [pcf8574][pca9554] Add interrupt_pin to compile tests 2026-04-04 08:58:02 -10:00
J. Nick Koston a2120953b9 [gpio_expander] Rename interrupt_driven_ to invalidate_on_read_
The base class doesn't need to know about interrupts — it just controls
whether digital_read() self-invalidates cache entries. Rename the flag
and invert the polarity for clarity.
2026-04-04 08:43:16 -10:00
J. Nick Koston 2c2b6b893e Merge remote-tracking branch 'upstream/pcf8574-pca9554-interrupt-pin' into integration 2026-04-04 08:38:56 -10:00
J. Nick Koston cf7bed8b6c [gpio_expander] Keep cache valid in interrupt-driven mode
When interrupt_driven_ is set, digital_read() no longer self-invalidates
each pin's cache entry. The cache stays valid until reset_pin_cache_()
is called from loop() when an interrupt fires. This eliminates I2C reads
on every binary sensor loop iteration — only reading when pins actually
change.
2026-04-04 08:38:35 -10:00
J. Nick Koston 3a659233be Merge remote-tracking branch 'upstream/pcf8574-pca9554-interrupt-pin' into integration 2026-04-04 08:29:03 -10:00
J. Nick Koston 79fe3de912 [pcf8574][pca9554] Add optional interrupt pin to eliminate polling
Add interrupt_pin config option to PCF8574 and PCA9554 GPIO expander
components. When configured, the component disables its loop and only
wakes on interrupt, eliminating continuous I2C polling when no pins
have changed state.
2026-04-04 08:22:37 -10:00
J. Nick Koston e4e664a9e6 Revert "[gpio_expander] Remove loop() from all GPIO expander components"
This reverts commit 8403728d4a.
2026-04-04 08:10:27 -10:00
J. Nick Koston c579846b2e Merge remote-tracking branch 'upstream/gpio-expander-remove-loop' into integration 2026-04-04 08:05:39 -10:00
J. Nick Koston 8403728d4a [gpio_expander] Remove loop() from all GPIO expander components
Move cache invalidation into CachedGpioExpander::digital_read() itself,
triggered by detecting a new loop iteration via App.get_loop_component_start_time().
This eliminates the need for a dedicated loop() override in every GPIO expander
component that only existed to call reset_pin_cache_().

Removes loop() from: pcf8574, pca9554, tca9555, pi4ioe5v6408, pca6416a,
mcp23016, mcp23xxx_base. For sx1509, only the reset_pin_cache_() call is
removed (loop() is kept for keypad scanning).
2026-04-04 07:55:38 -10:00
Clyde Stubbs 1a1725f958 [esp32] Clean build when sdkconfig options change (#15439) 2026-04-04 09:11:29 -04:00
J. Nick Koston 1329ad245e bot coments 2026-04-04 01:14:18 -10:00
J. Nick Koston c56e8cf7d8 fix validation 2026-04-04 01:09:31 -10:00
J. Nick Koston 297f9c134f [time] Use set_interval for CronTrigger instead of loop() (#15433) 2026-04-04 01:07:16 -10:00
J. Nick Koston 73029a5494 address review, validate 2026-04-04 01:01:32 -10:00
J. Nick Koston 01f2a86222 address review, validate 2026-04-04 00:59:44 -10:00
J. Nick Koston aa8f087ea6 address review, validate 2026-04-04 00:55:57 -10:00
J. Nick Koston 5e3bdc4613 address review, validate 2026-04-04 00:55:17 -10:00
J. Nick Koston a7dbbb9e15 address review, validate 2026-04-04 00:54:27 -10:00
J. Nick Koston c47bdf568b preen 2026-04-04 00:49:06 -10:00
J. Nick Koston 25f84b99ad Merge remote-tracking branch 'upstream/dev' into enhancement/ethernet-spi-interface
# Conflicts:
#	esphome/components/ethernet/__init__.py
#	esphome/components/ethernet/ethernet_component.cpp
#	esphome/components/ethernet/ethernet_component.h
2026-04-04 00:46:46 -10:00
J. Nick Koston f51871fa6b [total_daily_energy] Replace loop() with timeout-based midnight reset (#15432) 2026-04-04 00:37:50 -10:00
J. Nick Koston 9ee5089891 [time] Support */N syntax in cron expressions (#15434) 2026-04-04 00:30:41 -10:00
J. Nick Koston b0d39aedd3 [hlw8012] Change periodic sensor reading logs to LOGV (#15431) 2026-04-04 00:30:29 -10:00
J. Nick Koston 80296ae6f2 Merge remote-tracking branch 'upstream/api/peel-first-write-iteration' into integration 2026-04-04 00:04:36 -10:00
J. Nick Koston 915f1899ed bot comments 2026-04-04 00:03:50 -10:00
J. Nick Koston b7e666aa9b Merge remote-tracking branch 'origin/api/peel-first-write-iteration' into integration 2026-04-04 00:01:33 -10:00
J. Nick Koston f0c22fc1cd dupe 2026-04-04 00:00:25 -10:00
J. Nick Koston 269c234ac2 Merge remote-tracking branch 'upstream/api/peel-first-write-iteration' into integration 2026-04-03 23:48:58 -10:00
J. Nick Koston 99d080b2a7 preen 2026-04-03 23:35:41 -10:00
J. Nick Koston 8b0e6a3324 preen 2026-04-03 23:34:57 -10:00
J. Nick Koston 392aa0fcbc preen 2026-04-03 23:27:19 -10:00
J. Nick Koston a3febe4a9e fix bloat 2026-04-03 23:20:05 -10:00
J. Nick Koston 5553962eae fix bloat 2026-04-03 23:16:56 -10:00
J. Nick Koston 72df34a507 fix bloat 2026-04-03 23:07:06 -10:00
J. Nick Koston 599f784a90 fix bloat 2026-04-03 22:46:36 -10:00
J. Nick Koston dee78b8a8e fix slowdown 2026-04-03 22:39:19 -10:00
J. Nick Koston 3a564633b7 clean 2026-04-03 22:20:11 -10:00