1
0
mirror of https://github.com/esphome/esphome.git synced 2025-11-04 17:11:51 +00:00

Compare commits

...

2116 Commits

Author SHA1 Message Date
J. Nick Koston
cd3558623b Merge branch 'integration' into memory_api 2025-11-04 08:34:32 -06:00
J. Nick Koston
c0ebadd99d Merge remote-tracking branch 'upstream/dev' into integration 2025-11-04 08:34:24 -06:00
leejoow
13e3c03a61 [dallas_temp] add support for index (#11346) 2025-11-03 22:30:53 -08:00
J. Nick Koston
060bb4159f [ci] Cache component dependency graph for up to 3.4x faster determine-jobs (#11648) 2025-11-04 17:38:57 +13:00
J. Nick Koston
4ae36c0b59 Merge branch 'integration' into memory_api 2025-11-03 22:30:16 -06:00
J. Nick Koston
6f924dc296 Merge branch 'set_use_address_flash' into integration 2025-11-03 22:30:10 -06:00
J. Nick Koston
080bebbe06 review 2025-11-03 22:29:58 -06:00
J. Nick Koston
beca5901ec Merge branch 'integration' into memory_api 2025-11-03 22:27:11 -06:00
J. Nick Koston
2ce7c51c1e Merge branch 'set_use_address_flash' into integration 2025-11-03 22:27:06 -06:00
J. Nick Koston
1530e3105d review 2025-11-03 22:25:49 -06:00
J. Nick Koston
980098ca77 [ci] Fix non-component files incorrectly detected as components (#11701) 2025-11-04 16:47:11 +13:00
J. Nick Koston
4d2f9db861 [esp32_ble] Remove leftover lwip/sockets.h include (#11702) 2025-11-04 16:46:34 +13:00
J. Nick Koston
4c31cb57ea [espnow] Add wake_loop_threadsafe() for low-latency event processing (#11696) 2025-11-04 16:45:57 +13:00
J. Nick Koston
5257900495 [mqtt] Add wake_loop_threadsafe() for low-latency event processing on ESP32 (#11695) 2025-11-04 16:45:20 +13:00
Clyde Stubbs
3e086c2127 [lvgl] Fix rotation with unusual width (#11680) 2025-11-04 16:43:27 +13:00
Clyde Stubbs
0b04361fc0 [lvgl] Layout improvements (#10149)
Co-authored-by: clydeps <U5yx99dok9>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-04 16:39:27 +13:00
Clyde Stubbs
758ac58343 [psram] Require mode for S3 (#11470)
Co-authored-by: clydeps <U5yx99dok9>
2025-11-04 16:38:43 +13:00
J. Nick Koston
2ee409d799 Merge branch 'integration' into memory_api 2025-11-03 21:33:39 -06:00
J. Nick Koston
35d91e44b6 Merge branch 'set_use_address_flash' into integration 2025-11-03 21:33:32 -06:00
J. Nick Koston
69a1ea43e7 [network] Store use_address in RODATA to save RAM 2025-11-03 21:31:03 -06:00
Jesse Hills
ce63137565 Merge branch 'release' into dev 2025-11-04 16:04:48 +13:00
Jesse Hills
00155989af Merge pull request #11703 from esphome/bump-2025.10.4
2025.10.4
2025-11-04 16:04:04 +13:00
J. Nick Koston
60d309b97a Merge branch 'integration' into memory_api 2025-11-03 21:03:49 -06:00
J. Nick Koston
abaa9cda60 Merge remote-tracking branch 'upstream/dev' into integration 2025-11-03 21:03:33 -06:00
Jonathan Swoboda
326975ccad [core] Fix ESPTime crash (#11705) 2025-11-03 21:09:34 -05:00
J. Nick Koston
6220084fe6 [ci] Fix memory impact analysis to filter incompatible platform components (#11706) 2025-11-04 12:23:04 +11:00
Keith Burzinski
59326f137e [tinyusb] New component (#11678) 2025-11-03 18:29:30 -06:00
Keith Burzinski
266e4ae91f [helpers] Add get_mac_address_into_buffer() (#11700) 2025-11-03 23:30:37 +00:00
Clyde Stubbs
99d1a9cf6e [usb_uart] Fixes for transfer queue allocation (#11548) 2025-11-04 10:23:45 +11:00
J. Nick Koston
772c3b250e Merge branch 'integration' into memory_api 2025-11-03 16:36:17 -06:00
J. Nick Koston
ca041ff129 Merge remote-tracking branch 'upstream/dev' into integration 2025-11-03 16:36:07 -06:00
J. Nick Koston
99ce989eae [micro_wake_word] Add wake_loop_threadsafe() for low-latency wake word detection (#11698) 2025-11-03 16:30:35 -06:00
Jesse Hills
a3583da17d Bump version to 2025.10.4 2025-11-04 11:25:33 +13:00
Clyde Stubbs
0f6fd91304 [sdl] Fix keymappings (#11635) 2025-11-04 11:25:33 +13:00
Clyde Stubbs
2f5f1da16f [lvgl] Fix event for binary sensor (#11636) 2025-11-04 11:25:33 +13:00
Clyde Stubbs
51745d1d5e [image] Catch and report svg load errors (#11619) 2025-11-04 11:25:33 +13:00
J. Nick Koston
fecc8399a5 [lvgl] Fix nested lambdas in automations unable to access parameters (#11583)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
2025-11-04 11:25:33 +13:00
Clyde Stubbs
db395a662d [mipi_rgb] Fix rotation with custom model (#11585) 2025-11-04 11:25:33 +13:00
Anton Sergunov
641dd24b21 Fix the LiberTiny bug with UART pin setup (#11518) 2025-11-04 11:25:32 +13:00
Keith Burzinski
57f2e32b00 [uart] Fix order of initialization calls (#11510) 2025-11-04 11:25:32 +13:00
Clyde Stubbs
8aa8bb8f98 [epaper_spi] Refactoring (#11540)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-04 10:45:32 +13:00
J. Nick Koston
b294dbd547 Merge branch 'integration' into memory_api 2025-11-03 15:01:06 -06:00
J. Nick Koston
9091a2b658 Merge branch 'micro_wake_word_wake' into integration 2025-11-03 15:01:02 -06:00
J. Nick Koston
e65d3da763 [micro_wake_word] Add wake_loop_threadsafe() for low-latency wake word detection 2025-11-03 15:00:37 -06:00
Jonathan Swoboda
9c7cb30ae5 [esp32_hosted] Initial OTA implementation (#11562) 2025-11-03 14:08:50 -06:00
J. Nick Koston
fb7dbc9910 [usb_host] Add wake_loop_threadsafe() for low-latency USB event processing (#11683) 2025-11-03 13:50:39 -06:00
J. Nick Koston
3f12630a6b [core][esp32_ble][socket] Add wake_loop_threadsafe() helper for background thread wakeups (#11681) 2025-11-04 08:13:37 +13:00
tomaszduda23
06d0787ee0 [nrf52, i2c] i2c support for nrf52 (#8150)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: Ludovic BOUÉ <lboue@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-11-03 16:42:49 +00:00
Paul Strawder
cb039b42aa [esp32] Make the loop task's stack size configurable (#10564)
Co-authored-by: Paul Strawder <paul@korro.ai>
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+github@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-11-03 16:34:53 +00:00
Nathan Bernard
f05f45af74 Add support for Mopeka standard check alternate ID (#10907)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-11-03 15:17:28 +00:00
J. Nick Koston
1ec1692c77 [mqtt] Fix climate custom fan mode and preset compilation errors (#11692) 2025-11-03 08:23:04 -06:00
Kent Gibson
7e1cea8e69 [template] alarm_control_panel more ESP_LOGCONFIG reductions (#11691) 2025-11-03 08:05:33 -06:00
J. Nick Koston
2dc798f490 Merge branch 'integration' into memory_api 2025-11-02 23:20:42 -06:00
J. Nick Koston
199fe62686 Merge remote-tracking branch 'upstream/dev' into integration
# Conflicts:
#	esphome/components/bedjet/climate/bedjet_climate.cpp
#	esphome/components/climate/climate.cpp
#	esphome/components/climate/climate.h
#	esphome/components/demo/demo_climate.h
#	esphome/components/thermostat/thermostat_climate.cpp
2025-11-02 23:20:11 -06:00
tomaszduda23
0e792d0791 [nrf52,debug] fix status of nRESET pin, add extra registry from UICR (#11667)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
2025-11-03 05:20:08 +00:00
J. Nick Koston
42833c85f5 [climate] Replace std::vector<std::string> with const char* for custom fan modes and presets (#11621) 2025-11-02 23:16:39 -06:00
J. Nick Koston
a136501c63 Merge branch 'integration' into memory_api 2025-11-02 22:44:43 -06:00
J. Nick Koston
c3f2a901dd Merge branch 'app_wake_loop_threadsafe_usb' into integration 2025-11-02 22:44:36 -06:00
J. Nick Koston
9da3c08f3b [usb_host] Add wake_loop_threadsafe() for low-latency USB event processing 2025-11-02 22:43:00 -06:00
dependabot[bot]
a41c7b2b3c Bump aioesphomeapi from 42.5.0 to 42.6.0 (#11682)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-02 22:16:38 -06:00
J. Nick Koston
244716a05b Merge branch 'integration' into memory_api 2025-11-02 22:08:11 -06:00
J. Nick Koston
83f45a276c Merge branch 'app_wake_loop_threadsafe' into integration 2025-11-02 22:08:01 -06:00
J. Nick Koston
8e0721318c analysis 2025-11-02 22:06:15 -06:00
J. Nick Koston
ee2b10a992 move to socket 2025-11-02 22:05:15 -06:00
J. Nick Koston
8b7ef6cae8 move to socket 2025-11-02 22:04:20 -06:00
J. Nick Koston
edd01d5c9c move to socket 2025-11-02 22:04:14 -06:00
J. Nick Koston
4640198827 move to socket 2025-11-02 22:01:00 -06:00
J. Nick Koston
6a48c0f5cf move to socket 2025-11-02 21:59:22 -06:00
J. Nick Koston
acd26600dd move to socket 2025-11-02 21:57:57 -06:00
J. Nick Koston
2ac95abea7 [core][esp32_ble] Add wake_loop_threadsafe() helper for background thread wakeups 2025-11-02 21:51:39 -06:00
J. Nick Koston
f11103c895 [core][esp32_ble] Add wake_loop_threadsafe() helper for background thread wakeups 2025-11-02 21:50:56 -06:00
J. Nick Koston
12077d016d [core][esp32_ble] Add wake_loop_threadsafe() helper for background thread wakeups 2025-11-02 21:48:17 -06:00
J. Nick Koston
4dd3c90663 [esp32_ble] Wake main loop for GAP security events (#11677) 2025-11-03 15:55:17 +13:00
J. Nick Koston
6aa4485baf Merge branch 'integration' into memory_api 2025-11-02 20:22:59 -06:00
J. Nick Koston
ba4049b077 Merge remote-tracking branch 'origin/integration' into integration 2025-11-02 20:22:38 -06:00
J. Nick Koston
a436937b7d Merge branch 'integration' into memory_api 2025-11-02 20:22:20 -06:00
J. Nick Koston
a115ac002f Merge remote-tracking branch 'origin/climate_store_flash' into integration 2025-11-02 20:22:11 -06:00
J. Nick Koston
d0d00c2a79 Merge branch 'fan_no_double_storage' into integration 2025-11-02 20:21:57 -06:00
J. Nick Koston
42c3e7b542 fix trigge on preset mode cleared 2025-11-02 20:07:32 -06:00
J. Nick Koston
a72837704c fix trigge on preset mode cleared 2025-11-02 20:04:37 -06:00
J. Nick Koston
b3b48ca780 Merge branch 'dev' into climate_store_flash 2025-11-02 19:48:42 -06:00
J. Nick Koston
5e70dd76bf Merge branch 'integration' into memory_api 2025-11-02 19:45:11 -06:00
J. Nick Koston
171ff48bab Merge branch 'fan_no_double_storage' into integration 2025-11-02 19:45:05 -06:00
J. Nick Koston
5300460819 Merge remote-tracking branch 'upstream/dev' into fan_no_double_storage 2025-11-02 19:44:01 -06:00
J. Nick Koston
e5c4b50a1a Merge upstream/dev into integration
Resolved conflicts in:
- esphome/components/fan/fan.cpp: Preserved pointer-based preset mode optimization
- esphome/components/fan/fan_traits.h: Kept cstring include for strcmp
- esphome/components/web_server_idf/web_server_idf.cpp: Kept float_buf_size constant

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-02 19:42:06 -06:00
J. Nick Koston
0f0cd1f706 [core] Avoid redundant millis() calls in base_automation loop methods (#11676) 2025-11-03 01:40:13 +00:00
J. Nick Koston
4a5e6576c8 [scheduler] Refactor call() for improved code organization (#11643) 2025-11-03 14:29:29 +13:00
J. Nick Koston
cf76c3a747 [web_server_idf] Reduce flash by eliminating temporary string allocations in event formatting (#11658)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
2025-11-03 14:23:03 +13:00
J. Nick Koston
3f05fd82e5 [fan] Use std::vector for preset modes, preserve config order (#11483) 2025-11-03 14:18:59 +13:00
J. Nick Koston
34244afea1 [esp32_ble] Reduce GATT event latency from 8ms to 12μs with notification socket (#11663) 2025-11-03 14:16:26 +13:00
J. Nick Koston
4838eff382 [web_server] Use zero-copy entity ID comparison in request handlers (#11644) 2025-11-03 14:12:56 +13:00
J. Nick Koston
712421b82b [web_server] Eliminate nested lambdas in DeferredUpdateEventSourceList (#11641) 2025-11-03 14:10:18 +13:00
J. Nick Koston
7a1297ec84 [web_server] Remove redundant assignment in deq_push_back_with_dedup_ (#11642) 2025-11-03 14:08:12 +13:00
J. Nick Koston
40f919eaa6 Add action continuation tests (#11674) 2025-11-03 14:07:03 +13:00
J. Nick Koston
01ae86145a [ble_client] Fix premature disconnections by reading characteristics immediately after service discovery (#11410) 2025-11-03 14:06:40 +13:00
J. Nick Koston
17ab20ef61 [esp32_ble] Optimize loop() to reduce flash usage by ~104 bytes (#11627) 2025-11-03 14:05:36 +13:00
J. Nick Koston
1509ed8d23 [esphome][ota] Add write_byte_() helper to reduce code duplication (#11511) 2025-11-03 14:04:06 +13:00
J. Nick Koston
b4bebe0d44 Merge branch 'integration' into memory_api 2025-11-02 18:53:51 -06:00
J. Nick Koston
8d2a2f7fc3 Merge branch 'base_automation_time_calls' into integration 2025-11-02 18:53:45 -06:00
J. Nick Koston
e95eddba8f Merge branch 'integration' of https://github.com/esphome/esphome into integration 2025-11-02 18:53:29 -06:00
J. Nick Koston
c10663d88c [core] Avoid redundant millis() calls in base_automation loop methods 2025-11-02 18:52:59 -06:00
Clyde Stubbs
3e17767f6a [font][image] Use ESPHome urls for remote images (#11675) 2025-11-03 00:50:15 +00:00
Clyde Stubbs
19e275dc02 [component] Add is_idle method and condition (#11651) 2025-11-03 11:33:44 +11:00
J. Nick Koston
da53a13086 remove cruft 2025-11-02 18:17:39 -06:00
J. Nick Koston
7d0a04bac7 Merge branch 'integration' into memory_api 2025-11-02 17:59:04 -06:00
J. Nick Koston
3f1aee1d4e Merge branch 'action_chaining' into integration 2025-11-02 17:58:56 -06:00
J. Nick Koston
52a5cccc77 fix regression from moved code that was conflicted 2025-11-02 17:39:57 -06:00
J. Nick Koston
a3dbaa7a95 Merge branch 'cotinuation_tests' into action_chaining 2025-11-02 17:25:52 -06:00
J. Nick Koston
47cc240368 Add action continuation tests
new baseline ahead of https://github.com/esphome/esphome/pull/11650
2025-11-02 17:23:37 -06:00
J. Nick Koston
21a343701d cover 2025-11-02 17:21:03 -06:00
J. Nick Koston
2f35a94d28 revert 2025-11-02 17:13:56 -06:00
J. Nick Koston
035a510aba fix conflict 2025-11-02 17:11:13 -06:00
J. Nick Koston
c1023116f2 Merge dev branch with action continuation optimizations
- Integrated upstream loop re-entry fixes from PR #7972
- Updated WhileAction and RepeatAction to use simpler parameter passing (no var_ storage)
- Maintained all optimization benefits (ContinuationAction, WhileLoopContinuation, RepeatLoopContinuation)
- DelayAction: shared_ptr + lambda instead of std::bind
- WaitUntilAction: simple lambda instead of std::bind
- IfAction: ContinuationAction (4-8 bytes) instead of LambdaAction (40 bytes)
- WhileAction: WhileLoopContinuation with simplified parameter passing
- RepeatAction: RepeatLoopContinuation with simplified parameter passing
2025-11-02 17:06:22 -06:00
Kjell Braden
86402be9e3 actions: fix loop re-entry (#7972)
Co-authored-by: Clyde Stubbs <2366188+clydebarrow@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
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@home-assistant.io>
2025-11-02 17:02:13 -06:00
tomaszduda23
8a8a80e107 [nrf52, zigbee] OnlyWith support list of components (#11533)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-11-02 16:44:52 -06:00
Juan Antonio Aldea
79378a930e Use lists inits initialization instead of std::fill (#11532) 2025-11-02 16:26:20 -06:00
Jimmy Hedman
c822ec152f Enable IPv6 for host (#11630) 2025-11-02 16:22:49 -06:00
tomaszduda23
50e7ce55e7 [nrf52] enable nrf52 test (#11379) 2025-11-02 16:20:30 -06:00
tomaszduda23
70ea3af578 [nrf52,gpio] switch input gpio to polling mode (#11664) 2025-11-02 16:19:28 -06:00
Guillermo Ruffino
338190abec ESP32 Pin loopTask to CORE 1 (#11669) 2025-11-02 16:11:02 -06:00
Edward Firmo
425c88ee94 [nextion] Send auto_wake_on_touch as part of startup commands on loop (#11670) 2025-11-02 16:06:13 -06:00
Kjell Braden
f6946c0b9a add integration test for script re-entry argument issue (#11652)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-11-02 15:08:45 -06:00
J. Nick Koston
edde2fc94c Add basic tests for web_server_idf (#11659) 2025-11-02 08:18:17 -06:00
J. Nick Koston
1fc3165b58 [api] Remove unnecessary intermediate variable in frame helpers (#11668) 2025-11-01 22:43:39 -05:00
J. Nick Koston
d25121a55c [core] Remove redundant fd bounds check in yield_with_select_() (#11666) 2025-11-01 22:43:08 -05:00
J. Nick Koston
1704e8dd69 Merge branch 'integration' into memory_api 2025-11-01 21:57:55 -05:00
J. Nick Koston
cd38cc80cb Merge branch 'buffer_cleanup_temp' into integration 2025-11-01 21:57:48 -05:00
J. Nick Koston
b97c688f25 [api] Remove unnecessary intermediate variable in frame helpers 2025-11-01 18:31:26 -05:00
J. Nick Koston
82964576f0 Merge branch 'integration' into memory_api 2025-11-01 16:58:54 -05:00
J. Nick Koston
fedee74e25 Merge branch 'select_remove_double_check' into integration 2025-11-01 16:58:48 -05:00
J. Nick Koston
e2e20d79d0 [core] Remove redundant fd bounds check in yield_with_select_() 2025-11-01 16:58:17 -05:00
J. Nick Koston
e370dd0a14 Merge branch 'integration' into memory_api 2025-11-01 15:27:06 -05:00
J. Nick Koston
d2127b9000 Merge branch 'ble_latancy' into integration 2025-11-01 15:26:58 -05:00
J. Nick Koston
604508e3d8 fix 2025-11-01 15:23:35 -05:00
J. Nick Koston
bb2418a53f fix 2025-11-01 15:13:30 -05:00
J. Nick Koston
b80f40676a fix ble latency 2025-11-01 15:02:51 -05:00
J. Nick Koston
32ea82060d fix ble latency 2025-11-01 15:02:26 -05:00
J. Nick Koston
69af4cddb5 fix ble latency 2025-11-01 14:58:24 -05:00
J. Nick Koston
ff2e2bed66 fix ble latency 2025-11-01 14:56:11 -05:00
J. Nick Koston
f6a5a30dc2 fix ble latency 2025-11-01 14:55:37 -05:00
J. Nick Koston
a29f209b46 fix ble latency 2025-11-01 14:53:34 -05:00
J. Nick Koston
9c5dbd18c2 fix ble latency 2025-11-01 14:53:12 -05:00
J. Nick Koston
66eb10cc55 fix ble latency 2025-11-01 14:52:45 -05:00
J. Nick Koston
90fada3de9 Merge branch 'integration' into memory_api 2025-11-01 13:23:08 -05:00
J. Nick Koston
ad6bb77b9c Merge branch 'web_server_idf_appends' into integration 2025-11-01 13:23:00 -05:00
J. Nick Koston
e91b0bb804 preen 2025-11-01 13:13:56 -05:00
J. Nick Koston
a6b64db51a Merge branch 'integration' into memory_api 2025-11-01 13:05:01 -05:00
J. Nick Koston
45de63dd68 Merge branch 'web_server_idf_appends' into integration 2025-11-01 13:04:53 -05:00
J. Nick Koston
00abf7da72 Merge branch 'web_server_idf_appends' of https://github.com/esphome/esphome into web_server_idf_appends 2025-11-01 13:01:38 -05:00
J. Nick Koston
afcce8e5c6 fixup 2025-11-01 13:01:18 -05:00
J. Nick Koston
5b00ff1bf1 Merge branch 'web_server_idf_tests' into web_server_idf_appends 2025-11-01 12:49:23 -05:00
J. Nick Koston
0c101768d7 tests 2025-11-01 12:48:24 -05:00
J. Nick Koston
e567cb9658 tests 2025-11-01 12:47:54 -05:00
J. Nick Koston
7714f71d5c Merge branch 'integration' into memory_api 2025-11-01 12:42:49 -05:00
J. Nick Koston
6c7fd88ced Merge branch 'web_server_idf_appends' into integration 2025-11-01 12:42:42 -05:00
J. Nick Koston
2f56af0078 [web_server_idf] Reduce flash by eliminating temporary string allocations in event formatting 2025-11-01 12:41:22 -05:00
J. Nick Koston
f502907c7a [web_server_idf] Reduce flash by eliminating temporary string allocations in event formatting 2025-11-01 12:39:01 -05:00
J. Nick Koston
3c5e702c84 Merge branch 'integration' into memory_api 2025-11-01 12:12:06 -05:00
J. Nick Koston
087d093dfb Merge remote-tracking branch 'upstream/dev' into integration 2025-11-01 12:11:58 -05:00
tomaszduda23
55af818629 [nrf52] fix compilation warning (#11656) 2025-11-01 11:18:38 -05:00
J. Nick Koston
c662697ca7 [json] Fix component test compilation errors (#11647) 2025-11-01 11:18:10 -05:00
J. Nick Koston
e28c152298 [cpp_generator] Align isinstance() with codebase style (tuple vs PEP 604) (#11645) 2025-11-01 20:48:58 +11:00
J. Nick Koston
6c2f1c8a28 wip action chaining 2025-11-01 01:53:27 -05:00
Clyde Stubbs
0b4d445794 [sdl] Fix keymappings (#11635) 2025-11-01 17:45:42 +11:00
Clyde Stubbs
4d1d37a911 [lvgl] Fix event for binary sensor (#11636) 2025-11-01 17:37:07 +11:00
Clyde Stubbs
8df5a3a630 [lvgl] Trigger improvements and additions (#11628) 2025-11-01 17:27:28 +11:00
J. Nick Koston
5a5894eaa3 [ruff] Remove deprecated UP038 rule from ignore list (#11646) 2025-11-01 17:05:26 +11:00
J. Nick Koston
806f033800 Merge branch 'integration' into memory_api 2025-11-01 00:21:00 -05:00
J. Nick Koston
cb35d25e2f Merge branch 'web_server_zero_copy' into integration 2025-11-01 00:20:54 -05:00
J. Nick Koston
ab261f3436 [web_server] Use zero-copy entity ID comparison in request handlers 2025-11-01 00:19:54 -05:00
J. Nick Koston
0dabd8d392 Merge branch 'integration' into memory_api 2025-10-31 23:28:44 -05:00
J. Nick Koston
c98520c8b6 Merge branch 'scheduler_reorg' into integration 2025-10-31 23:28:36 -05:00
J. Nick Koston
d2249ff8be [scheduler] Refactor call() for improved code organization 2025-10-31 23:27:00 -05:00
Clyde Stubbs
d9d2d2f6b9 [automations] Update error message (#11640) 2025-11-01 15:17:23 +11:00
J. Nick Koston
2816aa6574 Merge branch 'integration' into memory_api 2025-10-31 22:56:48 -05:00
J. Nick Koston
6442f803bd Merge branch 'redundant_assign' into integration 2025-10-31 22:56:36 -05:00
J. Nick Koston
c8f7bceb34 [web_server] Remove redundant assignment in deq_push_back_with_dedup_ 2025-10-31 22:56:02 -05:00
J. Nick Koston
1e470b3018 Merge branch 'integration' into memory_api 2025-10-31 22:27:49 -05:00
J. Nick Koston
36f48de32c Merge branch 'web_server_reduce_nesting' into integration 2025-10-31 22:27:44 -05:00
J. Nick Koston
ad0d6da2f3 preen 2025-10-31 22:27:26 -05:00
J. Nick Koston
07d00d5061 Merge branch 'integration' into memory_api 2025-10-31 22:22:46 -05:00
J. Nick Koston
4f7fad7b24 Merge branch 'web_server_reduce_nesting' into integration 2025-10-31 22:22:33 -05:00
J. Nick Koston
04222d2851 [web_server] Eliminate nested lambdas in DeferredUpdateEventSourceList 2025-10-31 22:22:04 -05:00
Clyde Stubbs
30f2a4395f [image] Catch and report svg load errors (#11619) 2025-11-01 11:08:28 +11:00
J. Nick Koston
95c4bb62d0 Merge branch 'integration' into memory_api 2025-10-31 15:21:21 -05:00
J. Nick Koston
97d677a22f Merge remote-tracking branch 'upstream/dev' into integration 2025-10-31 15:21:14 -05:00
dependabot[bot]
292abd1187 Bump ruff from 0.14.2 to 0.14.3 (#11633)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-31 19:46:50 +00:00
J. Nick Koston
1704752aef Merge branch 'integration' into memory_api 2025-10-31 14:39:18 -05:00
J. Nick Koston
ce2eba4faf Merge branch 'fan_no_double_storage' into integration 2025-10-31 14:39:11 -05:00
J. Nick Koston
e1356e8ab2 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-31 14:39:03 -05:00
Javier Peletier
6d0527ff2a [substitutions] fix jinja parsing strings that look like sets as sets (#11611) 2025-10-31 14:04:55 -05:00
J. Nick Koston
5c184777c6 remove bugfix 2025-10-31 12:05:48 -05:00
J. Nick Koston
cbaa15635f remove bugfix 2025-10-31 11:49:35 -05:00
J. Nick Koston
d5938df531 remove bugfix 2025-10-31 11:45:12 -05:00
J. Nick Koston
e6421ac50c remove bugfix 2025-10-31 11:42:32 -05:00
J. Nick Koston
9dcfbed8af wip 2025-10-31 11:37:22 -05:00
J. Nick Koston
76952026b7 preen 2025-10-31 11:18:14 -05:00
J. Nick Koston
91ae8c82b0 preen 2025-10-31 11:15:59 -05:00
J. Nick Koston
ada0e8c2ea Merge branch 'fan_fixed' into fan_no_double_storage 2025-10-31 11:14:07 -05:00
J. Nick Koston
410afd196f preen 2025-10-31 11:13:57 -05:00
J. Nick Koston
4fabe464c8 wip 2025-10-31 11:08:24 -05:00
J. Nick Koston
79e2340588 wip 2025-10-31 11:06:18 -05:00
J. Nick Koston
cf85621d64 wip 2025-10-31 11:05:31 -05:00
J. Nick Koston
58ae4a38be wip 2025-10-31 11:04:27 -05:00
J. Nick Koston
cd3f10630b wip 2025-10-31 11:01:36 -05:00
J. Nick Koston
4e6d74c981 Merge branch 'dev' into fan_fixed 2025-10-31 10:40:02 -05:00
J. Nick Koston
62569c9770 Merge branch 'integration' into memory_api 2025-10-30 21:22:21 -05:00
J. Nick Koston
27859c8ccd Merge branch 'climate_store_flash' into integration 2025-10-30 21:22:14 -05:00
J. Nick Koston
fae90194e7 safety 2025-10-30 21:12:27 -05:00
J. Nick Koston
5c99eabd1a safety 2025-10-30 21:11:33 -05:00
J. Nick Koston
1378e52838 safety 2025-10-30 21:10:19 -05:00
J. Nick Koston
868d01ae03 safety 2025-10-30 21:10:01 -05:00
J. Nick Koston
c36b778158 safety 2025-10-30 21:07:23 -05:00
J. Nick Koston
1b5a942f61 fixes 2025-10-30 20:58:02 -05:00
J. Nick Koston
d7f55e9977 fixes 2025-10-30 20:53:30 -05:00
J. Nick Koston
f6e8fdcd91 simplify 2025-10-30 20:50:00 -05:00
J. Nick Koston
1fd6f7bcd3 simplify 2025-10-30 20:41:44 -05:00
J. Nick Koston
0a86254b84 simplify 2025-10-30 20:32:28 -05:00
J. Nick Koston
6dd29f1917 simplify 2025-10-30 20:25:26 -05:00
J. Nick Koston
a073ec4e11 simplify 2025-10-30 20:19:07 -05:00
J. Nick Koston
d1bb5c4d79 simplify 2025-10-30 20:16:36 -05:00
J. Nick Koston
60a303adb8 simplify 2025-10-30 20:10:36 -05:00
J. Nick Koston
03ec52752b simplify 2025-10-30 20:09:45 -05:00
J. Nick Koston
70ec33f418 simplify 2025-10-30 20:07:33 -05:00
J. Nick Koston
b4045b0963 simplify 2025-10-30 20:04:55 -05:00
J. Nick Koston
cd513b0672 simplify 2025-10-30 20:02:28 -05:00
J. Nick Koston
5013b7be87 simplify 2025-10-30 19:55:46 -05:00
J. Nick Koston
34d2056413 simplify 2025-10-30 19:51:54 -05:00
J. Nick Koston
219a318ee3 simplify 2025-10-30 19:50:11 -05:00
J. Nick Koston
13148f2c89 simplify 2025-10-30 19:47:45 -05:00
J. Nick Koston
dda7b52f94 simplify 2025-10-30 19:44:30 -05:00
J. Nick Koston
56c6cc8c9f simplify 2025-10-30 19:43:07 -05:00
J. Nick Koston
af165539e6 simplify 2025-10-30 19:37:02 -05:00
J. Nick Koston
1864cf6ad8 simplify 2025-10-30 19:08:40 -05:00
J. Nick Koston
8c90ea860c simplify 2025-10-30 19:04:52 -05:00
J. Nick Koston
46e4fe2896 simplify 2025-10-30 19:03:12 -05:00
J. Nick Koston
4565dcc4d9 simplify 2025-10-30 19:03:01 -05:00
J. Nick Koston
41bd8951dc simplify 2025-10-30 19:02:45 -05:00
J. Nick Koston
952f6f5029 simplify 2025-10-30 19:01:48 -05:00
J. Nick Koston
f66f9c4eaf simplify 2025-10-30 19:00:02 -05:00
J. Nick Koston
b9d0e4061b simplify 2025-10-30 18:58:52 -05:00
J. Nick Koston
39beaae20f simplify 2025-10-30 18:56:42 -05:00
J. Nick Koston
6b2a85541d simplify 2025-10-30 18:55:06 -05:00
J. Nick Koston
4d39e15920 simplify 2025-10-30 18:53:13 -05:00
J. Nick Koston
42e6b4326f simplify 2025-10-30 18:51:19 -05:00
J. Nick Koston
9161d3a758 simplify 2025-10-30 18:48:05 -05:00
J. Nick Koston
4aa03ed0a2 Merge remote-tracking branch 'upstream/dev' into climate_store_flash 2025-10-30 18:46:16 -05:00
J. Nick Koston
c3c1ae8e7f simplify 2025-10-30 18:44:28 -05:00
J. Nick Koston
210320b8cc simplify 2025-10-30 18:43:17 -05:00
J. Nick Koston
9753bd8b8a Merge branch 'integration' into memory_api 2025-10-30 18:06:24 -05:00
J. Nick Koston
40a867a863 Merge branch 'esp32_ble' into integration 2025-10-30 18:06:16 -05:00
J. Nick Koston
d848cc33d7 dry 2025-10-30 17:54:35 -05:00
J. Nick Koston
1925cd0379 dry 2025-10-30 17:53:34 -05:00
J. Nick Koston
1905bbd898 dry 2025-10-30 17:49:20 -05:00
J. Nick Koston
59736f25e9 wip 2025-10-30 17:43:45 -05:00
dependabot[bot]
fd64585f99 Bump github/codeql-action from 4.31.0 to 4.31.2 (#11626)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-30 16:50:06 -05:00
J. Nick Koston
c544b8258f Merge branch 'integration' into memory_api 2025-10-30 15:40:27 -05:00
J. Nick Koston
4926e90985 Merge branch 'select_options' into integration 2025-10-30 15:40:22 -05:00
J. Nick Koston
19e1427d92 wip 2025-10-30 15:40:10 -05:00
J. Nick Koston
f7d3a8eab4 Merge branch 'integration' into memory_api 2025-10-30 15:38:59 -05:00
J. Nick Koston
0b6648a823 Merge branch 'select_options' into integration 2025-10-30 15:38:49 -05:00
J. Nick Koston
2a73fd3fd6 esp8266 2025-10-30 15:38:40 -05:00
J. Nick Koston
b28dc7218d Merge branch 'integration' into memory_api 2025-10-30 15:33:37 -05:00
J. Nick Koston
a0efa628d1 Merge branch 'select_options' into integration 2025-10-30 15:33:31 -05:00
J. Nick Koston
10b9ec32a8 preen 2025-10-30 15:33:19 -05:00
J. Nick Koston
c191405b6d preen 2025-10-30 15:33:07 -05:00
J. Nick Koston
74a9445eff Merge branch 'integration' into memory_api 2025-10-30 15:27:58 -05:00
J. Nick Koston
b6b640cd33 Merge branch 'select_options' into integration 2025-10-30 15:27:51 -05:00
J. Nick Koston
774cdd33bc cleaner 2025-10-30 15:27:44 -05:00
J. Nick Koston
94207cb956 Merge branch 'integration' into memory_api 2025-10-30 15:24:18 -05:00
J. Nick Koston
7546b61e01 Merge branch 'select_options' into integration 2025-10-30 15:24:11 -05:00
J. Nick Koston
394d50a328 esphom prefers this-> 2025-10-30 15:24:02 -05:00
J. Nick Koston
04db4b821d Merge branch 'integration' into memory_api 2025-10-30 15:21:18 -05:00
J. Nick Koston
61f9737557 Merge branch 'select_options' into integration 2025-10-30 15:21:12 -05:00
J. Nick Koston
f86c74ff02 preen 2025-10-30 15:20:50 -05:00
J. Nick Koston
028d16d64e Merge branch 'integration' into memory_api 2025-10-30 14:31:21 -05:00
J. Nick Koston
bc32a0cc94 Merge branch 'select_options' into integration 2025-10-30 14:31:15 -05:00
J. Nick Koston
3552d29167 preen 2025-10-30 14:30:58 -05:00
J. Nick Koston
90a6771f4b Merge branch 'integration' into memory_api 2025-10-30 14:28:26 -05:00
J. Nick Koston
b28cee1f79 Merge branch 'select_options' into integration 2025-10-30 14:28:20 -05:00
J. Nick Koston
567672171a force inline 2025-10-30 14:28:09 -05:00
J. Nick Koston
be12da5690 Merge branch 'integration' into memory_api 2025-10-30 14:26:55 -05:00
J. Nick Koston
b147887b20 Merge branch 'select_options' into integration 2025-10-30 14:26:48 -05:00
J. Nick Koston
f447aaed8d force inline 2025-10-30 14:26:37 -05:00
J. Nick Koston
1a9aa23ae9 force inline 2025-10-30 14:25:35 -05:00
J. Nick Koston
fad0e55dcc Merge branch 'integration' into memory_api 2025-10-30 14:20:58 -05:00
J. Nick Koston
52e330f323 Merge branch 'select_options' into integration 2025-10-30 14:20:45 -05:00
J. Nick Koston
6cab143db2 break it out, logic was too hard to follow 2025-10-30 14:20:28 -05:00
J. Nick Koston
400e64906b Merge branch 'integration' into memory_api 2025-10-30 14:19:18 -05:00
J. Nick Koston
627f86828c Merge branch 'select_options' into integration 2025-10-30 14:19:10 -05:00
J. Nick Koston
867ff200ce break it out, logic was too hard to follow 2025-10-30 14:18:56 -05:00
J. Nick Koston
4913351540 Merge branch 'integration' into memory_api 2025-10-30 14:17:17 -05:00
J. Nick Koston
1aee375c31 Merge branch 'select_options' into integration 2025-10-30 14:17:10 -05:00
J. Nick Koston
9f62df1456 break it out, logic was too hard to follow 2025-10-30 14:16:56 -05:00
J. Nick Koston
9c9d6e61bb break it out, logic was too hard to follow 2025-10-30 14:16:43 -05:00
J. Nick Koston
a2e83d9018 Merge branch 'integration' into memory_api 2025-10-30 14:08:10 -05:00
J. Nick Koston
6fa411d382 Merge branch 'select_options' into integration 2025-10-30 14:08:01 -05:00
J. Nick Koston
c02d316866 tidy 2025-10-30 14:07:49 -05:00
J. Nick Koston
16b9eecbcd Merge branch 'integration' into memory_api 2025-10-30 13:40:47 -05:00
J. Nick Koston
afdfeae7c3 Merge branch 'select_options' into integration 2025-10-30 13:40:41 -05:00
J. Nick Koston
54c536cbe2 missed some 2025-10-30 13:40:33 -05:00
J. Nick Koston
7acc39abc8 Merge branch 'integration' into memory_api 2025-10-30 13:35:47 -05:00
J. Nick Koston
e7d617d89a Merge branch 'select_options' into integration 2025-10-30 13:35:43 -05:00
J. Nick Koston
849483eb3b silience warning 2025-10-30 13:35:35 -05:00
J. Nick Koston
edc21fe41e Merge branch 'integration' into memory_api 2025-10-30 13:34:01 -05:00
J. Nick Koston
cf240aeee9 Merge branch 'select_options' into integration 2025-10-30 13:33:53 -05:00
J. Nick Koston
d496676c84 preen 2025-10-30 13:30:22 -05:00
J. Nick Koston
dcc7dbb9e1 Merge branch 'integration' into memory_api 2025-10-30 13:28:52 -05:00
J. Nick Koston
c0cab0974c Merge branch 'select_options' into integration 2025-10-30 13:28:38 -05:00
J. Nick Koston
7d2ebabec7 give people time to migrate since we can 2025-10-30 13:28:27 -05:00
J. Nick Koston
27cef4d250 Merge branch 'integration' into memory_api 2025-10-30 13:26:48 -05:00
J. Nick Koston
fb6efe93cd Merge branch 'select_options' into integration 2025-10-30 13:26:40 -05:00
J. Nick Koston
ad5752f68e give people time to migrate since we can 2025-10-30 13:25:31 -05:00
J. Nick Koston
16f298896d Merge branch 'integration' into memory_api 2025-10-30 13:20:50 -05:00
J. Nick Koston
cf6e4c3e16 Merge branch 'select_options' into integration 2025-10-30 13:20:45 -05:00
J. Nick Koston
2e6dab89ff preen 2025-10-30 13:19:45 -05:00
J. Nick Koston
6dff2d6240 cleanups 2025-10-30 13:17:25 -05:00
J. Nick Koston
b6d178b8c1 cleanups 2025-10-30 13:12:28 -05:00
J. Nick Koston
fd8726b479 comment it 2025-10-30 13:07:03 -05:00
J. Nick Koston
f6aee64ec1 preen 2025-10-30 13:02:37 -05:00
J. Nick Koston
58a517afa6 preen 2025-10-30 13:01:32 -05:00
J. Nick Koston
a02b90129d preen 2025-10-30 13:00:02 -05:00
J. Nick Koston
d1adf79fc3 preen 2025-10-30 12:45:41 -05:00
J. Nick Koston
29887e1da5 preen 2025-10-30 12:43:50 -05:00
J. Nick Koston
5f4f6ced32 preen 2025-10-30 12:39:18 -05:00
J. Nick Koston
cf99bab87b preen 2025-10-30 12:38:12 -05:00
J. Nick Koston
c2902c9671 preen 2025-10-30 12:33:10 -05:00
J. Nick Koston
1c0a5a9765 preen 2025-10-30 12:32:37 -05:00
J. Nick Koston
df014f0217 preen 2025-10-30 12:28:19 -05:00
J. Nick Koston
18783ff20b preen 2025-10-30 12:26:47 -05:00
J. Nick Koston
0db55ef2dd select by index 2025-10-30 12:14:53 -05:00
J. Nick Koston
6f8842c170 Merge branch 'integration' into memory_api 2025-10-30 11:03:06 -05:00
J. Nick Koston
ea666bc18c Merge branch 'climate_store_flash' into integration 2025-10-30 11:03:01 -05:00
J. Nick Koston
721252d219 preen 2025-10-30 10:56:19 -05:00
J. Nick Koston
8f9f00df83 preen 2025-10-30 10:55:06 -05:00
J. Nick Koston
bf1514e672 preen 2025-10-30 10:46:32 -05:00
J. Nick Koston
ccfdd0cf06 remove testing 2025-10-30 10:44:49 -05:00
J. Nick Koston
10d6281edc remove testing 2025-10-30 10:44:36 -05:00
J. Nick Koston
fa424514db remove testing 2025-10-30 10:44:23 -05:00
J. Nick Koston
9ed3f18893 preen 2025-10-30 10:39:30 -05:00
J. Nick Koston
789e435aac preen 2025-10-30 10:36:32 -05:00
J. Nick Koston
d94c7b9c12 [climate] Replace std::vector<std::string> with const char* for custom fan modes and presets 2025-10-30 10:20:21 -05:00
Markus
077cce9848 [core] .local addresses are only resolvable if mDNS is enabled (#11508) 2025-10-30 10:08:08 -05:00
J. Nick Koston
a9b66ff943 Merge branch 'integration' into memory_api 2025-10-29 22:01:37 -05:00
J. Nick Koston
eaccc9305c Merge remote-tracking branch 'upstream/dev' into integration 2025-10-29 22:01:25 -05:00
J. Nick Koston
bd87e56bc7 [e131] Replace std::set with std::vector to reduce flash usage (#11598) 2025-10-30 15:14:03 +13:00
J. Nick Koston
58235049e3 [template] Eliminate optional wrapper to save 4 bytes RAM per instance (#11610) 2025-10-30 15:06:21 +13:00
J. Nick Koston
29ed3c20af [gpio] Skip set_use_interrupt call when using default value (#11612) 2025-10-30 14:28:38 +13:00
J. Nick Koston
08aae39ea4 [ci] Consolidate component splitting into determine-jobs (#11614) 2025-10-30 14:27:28 +13:00
J. Nick Koston
03fd114371 [ci] Restore parallel execution for clang-tidy split mode (#11613) 2025-10-30 14:26:37 +13:00
J. Nick Koston
932e19d9a1 Merge branch 'integration' into memory_api 2025-10-29 18:13:22 -05:00
J. Nick Koston
34f7ff42ae merge 2025-10-29 18:13:16 -05:00
J. Nick Koston
41abb8f9a5 Merge branch 'integration' into memory_api 2025-10-29 18:12:25 -05:00
J. Nick Koston
22bf0ae505 Merge remote-tracking branch 'clydebarrow/usb-uart' into integration 2025-10-29 18:12:17 -05:00
J. Nick Koston
6e259c2dbb update cover 2025-10-29 18:08:04 -05:00
J. Nick Koston
80ed3a6f66 Merge branch 'integration' into memory_api 2025-10-29 18:05:32 -05:00
J. Nick Koston
874f81e27b Merge branch 'gpio_interrupt_true' into integration 2025-10-29 18:05:28 -05:00
J. Nick Koston
0ea74c2663 [gpio] Skip set_use_interrupt call when using default value 2025-10-29 18:05:01 -05:00
J. Nick Koston
36e859be37 Merge branch 'integration' into memory_api 2025-10-29 17:58:04 -05:00
J. Nick Koston
6f4296325a Merge branch 'elimate_optional' into integration 2025-10-29 17:57:55 -05:00
J. Nick Koston
b743786908 merge 2025-10-29 17:45:18 -05:00
J. Nick Koston
22b718a87d missing disable in lock 2025-10-29 16:56:01 -05:00
J. Nick Koston
af6581bfed missing disable in lock 2025-10-29 16:55:52 -05:00
J. Nick Koston
ec128914a3 missing disable in lock 2025-10-29 16:55:41 -05:00
J. Nick Koston
d2f1baa800 remove enable_loops, not needed since setup runs after setters, since setters are called in main setup() before component setup() 2025-10-29 16:53:25 -05:00
J. Nick Koston
30e6d7a3c8 remove enable_loops, not needed since setup runs after setters, since setters are called in main setup() before component setup() 2025-10-29 16:53:13 -05:00
J. Nick Koston
97f53765b5 Merge branch 'integration' into memory_api 2025-10-29 16:49:55 -05:00
J. Nick Koston
29b544002c Merge branch 'elimate_optional' into integration 2025-10-29 16:49:43 -05:00
J. Nick Koston
fe1270e4c1 forward args 2025-10-29 16:45:29 -05:00
J. Nick Koston
931f52cb7b Merge branch 'integration' into memory_api 2025-10-29 16:24:12 -05:00
J. Nick Koston
e1d854cf22 Merge branch 'elimate_optional' into integration 2025-10-29 16:24:01 -05:00
J. Nick Koston
5478fa69e9 twip 2025-10-29 16:20:11 -05:00
J. Nick Koston
68d1a7e3ef wip 2025-10-29 16:15:15 -05:00
J. Nick Koston
922acda1a8 wip 2025-10-29 16:12:05 -05:00
J. Nick Koston
a849ddd57d wip 2025-10-29 16:10:32 -05:00
J. Nick Koston
f4d32c7def relo 2025-10-29 16:08:27 -05:00
Stuart Parmenter
918650f15a [lvgl] memset canvas buffer to prevent display of random garbage (#11582)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
2025-10-29 21:06:45 +00:00
Stuart Parmenter
287f65cbaf [lvgl] fix typo from previous refactor (#11596) 2025-10-30 07:27:31 +11:00
J. Nick Koston
b1dffcc921 Merge branch 'integration' into memory_api 2025-10-29 15:06:46 -05:00
J. Nick Koston
a8668d510f Merge branch 'more_flexible_template' into integration 2025-10-29 15:06:38 -05:00
J. Nick Koston
3636ab68f3 tidy 2025-10-29 15:06:20 -05:00
J. Nick Koston
d8da806bab tidy 2025-10-29 15:06:08 -05:00
clydebarrow
a21057a744 Relax memory order to acquire 2025-10-30 06:04:33 +10:00
J. Nick Koston
d900b84e55 Merge branch 'integration' into memory_api 2025-10-29 14:59:47 -05:00
J. Nick Koston
190fae51d8 Merge branch 'more_flexible_template' into integration 2025-10-29 14:59:42 -05:00
J. Nick Koston
b30c4e716f Revert "remove tests to get baseline"
This reverts commit 658c50e0c6.
2025-10-29 14:55:15 -05:00
J. Nick Koston
658c50e0c6 remove tests to get baseline 2025-10-29 14:45:50 -05:00
clydebarrow
d6c23ac056 Add clarifying comment 2025-10-30 05:38:16 +10:00
clydebarrow
f458ae9449 Merge branch 'dev' of https://github.com/esphome/esphome into usb-uart 2025-10-30 05:35:28 +10:00
J. Nick Koston
399b86255a [template] Add regression tests for lambdas with captures (PR #11555) 2025-10-29 14:35:03 -05:00
J. Nick Koston
c38a558df8 fix template regression 2025-10-29 14:26:33 -05:00
J. Nick Koston
299c937e67 fix template regression 2025-10-29 14:24:02 -05:00
J. Nick Koston
b6516c687d fix template regression 2025-10-29 14:21:34 -05:00
Javier Peletier
f18c70a256 [core] Fix substitution id redefinition false positive (#11603) 2025-10-30 07:06:55 +13:00
Jonathan Swoboda
6fb490f49b [remote_transmitter] Add non-blocking mode (#11524) 2025-10-29 12:40:22 -04:00
Clyde Stubbs
83a4436b17 Merge branch 'dev' into usb-uart 2025-10-29 20:55:38 +10:00
J. Nick Koston
66cf7c3a3b [lvgl] Fix nested lambdas in automations unable to access parameters (#11583)
Co-authored-by: clydebarrow <2366188+clydebarrow@users.noreply.github.com>
2025-10-29 17:07:48 +11:00
dependabot[bot]
f29021b5ef Bump ruff from 0.14.1 to 0.14.2 (#11519)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-29 05:23:42 +00:00
dependabot[bot]
7549ca4d39 Bump actions/download-artifact from 5.0.0 to 6.0.0 (#11521)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-29 00:20:13 -05:00
dependabot[bot]
33e7a2101b Bump actions/upload-artifact from 4.6.2 to 5.0.0 (#11520)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-29 00:20:05 -05:00
dependabot[bot]
59a216bfcb Bump github/codeql-action from 4.30.9 to 4.31.0 (#11522)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-29 00:19:47 -05:00
Jesse Hills
09d89000ad [core] Remove deprecated schema constants (#11591) 2025-10-29 00:14:02 -05:00
Kent Gibson
b6c9ece0e6 template_alarm_control_panel readability improvements (#11593) 2025-10-29 00:10:36 -05:00
J. Nick Koston
6e1dace240 Merge branch 'integration' into memory_api 2025-10-29 00:03:57 -05:00
J. Nick Koston
6e48f30147 Merge branch 'e131_cleanups' into integration 2025-10-29 00:03:50 -05:00
J. Nick Koston
90956f7417 [e131] Replace std::set with std::vector to reduce flash usage 2025-10-28 23:56:44 -05:00
J. Nick Koston
0bb6a6872d Merge branch 'dev' into fan_fixed 2025-10-28 23:47:02 -05:00
dependabot[bot]
7169556722 Bump aioesphomeapi from 42.4.0 to 42.5.0 (#11597)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-29 04:46:47 +00:00
J. Nick Koston
5e6baba76c Merge branch 'integration' into memory_api 2025-10-28 23:43:01 -05:00
J. Nick Koston
776198ec05 Merge branch 'ota_handle_data_cleanups' into integration 2025-10-28 23:42:41 -05:00
J. Nick Koston
a63b04fc0d Merge branch 'integration' into memory_api 2025-10-28 23:29:03 -05:00
J. Nick Koston
7533da006e Merge branch 'fan_fixed' into integration 2025-10-28 23:28:57 -05:00
J. Nick Koston
372c162e6b make sure no dangling 2025-10-28 23:02:14 -05:00
J. Nick Koston
b635689c29 make sure no dangling 2025-10-28 23:01:28 -05:00
J. Nick Koston
e4aec7f413 make sure no dangling 2025-10-28 22:57:50 -05:00
J. Nick Koston
bb99f68d33 cleanup 2025-10-28 22:47:36 -05:00
J. Nick Koston
47cbe74453 cleanup 2025-10-28 22:41:13 -05:00
J. Nick Koston
cc815fd683 cleanup 2025-10-28 22:40:56 -05:00
J. Nick Koston
4cc41606d1 cleanup 2025-10-28 22:40:45 -05:00
J. Nick Koston
6cf0a38b86 preen 2025-10-28 22:26:27 -05:00
J. Nick Koston
f6e4c0cb52 [ci] Fix component tests not running when only test files change (#11580) 2025-10-29 16:22:28 +13:00
J. Nick Koston
5e6ce6ee48 Merge branch 'dev' into fan_fixed 2025-10-28 22:15:50 -05:00
J. Nick Koston
f3634edc22 [select] Store options in flash to reduce RAM usage (#11514) 2025-10-29 15:28:16 +13:00
J. Nick Koston
c7904e845e Merge branch 'integration' into memory_api 2025-10-28 21:16:45 -05:00
J. Nick Koston
44c2917f24 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-28 21:16:39 -05:00
Jesse Hills
a609343cb6 [fan] Remove deprecated set_speed function (#11590) 2025-10-28 21:06:30 -05:00
Clyde Stubbs
5528c3c765 [mipi_rgb] Fix rotation with custom model (#11585) 2025-10-29 14:37:14 +13:00
Anton Sergunov
0d805355f5 Fix the LiberTiny bug with UART pin setup (#11518) 2025-10-29 14:33:16 +13:00
Jesse Hills
99f48ae51c [logger] Improve level validation errors (#11589)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-29 01:29:40 +00:00
Jesse Hills
25e4aafd71 [ci] Fix auto labeller workflow with wrong comment for too-big with labels (#11592) 2025-10-29 14:28:29 +13:00
Kent Gibson
4f2d54be4e template_alarm_control_panel cleanups (#11469) 2025-10-29 13:48:26 +13:00
dependabot[bot]
249cd7415b Bump aioesphomeapi from 42.3.0 to 42.4.0 (#11586)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-29 00:32:41 +00:00
J. Nick Koston
78d780105b [ci] Change upper Python version being tested to 3.13 (#11587) 2025-10-28 19:24:37 -05:00
Jesse Hills
466d4522bc [http_request] Pass trigger variables into on_response/on_error (#11464) 2025-10-29 12:17:16 +13:00
Javier Peletier
e462217500 [packages] Tighten package validation (#11584) 2025-10-29 11:18:47 +13:00
J. Nick Koston
f1bce262ed [uart] Optimize UART components to eliminate temporary vector allocations (#11570)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-29 09:48:20 +13:00
J. Nick Koston
7ed7e7ad26 [climate] Replace std::set with FiniteSetMask for trait storage (#11466) 2025-10-29 08:46:44 +13:00
J. Nick Koston
df56346fb6 Merge branch 'integration' into memory_api 2025-10-28 14:19:22 -05:00
J. Nick Koston
e7927cb388 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-28 14:19:15 -05:00
J. Nick Koston
08b8454555 [ble_client] Use function pointers for lambda actions and sensors (#11564)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-29 08:10:32 +13:00
J. Nick Koston
0119e17f04 [ci] Remove base bus components exclusion from memory impact analysis (#11572) 2025-10-29 08:08:13 +13:00
J. Nick Koston
c3f40de844 [modbus_controller] Optimize lambdas to use function pointers instead of std::function (#11566) 2025-10-29 08:06:13 +13:00
J. Nick Koston
7dd829cfca [esp32_ble_server][esp32_improv] Eliminate unnecessary heap allocations (#11569) 2025-10-29 08:05:12 +13:00
J. Nick Koston
da19673f51 Add additional uart test coverage (#11571) 2025-10-29 08:03:09 +13:00
rwrozelle
f5e32d03d0 [http_request] update timeout to be uint32_t (#11577) 2025-10-28 12:41:48 -04:00
J. Nick Koston
c34872f923 Merge branch 'integration' into memory_api 2025-10-28 10:59:06 -05:00
J. Nick Koston
4b65e311ff Merge branch 'improv_ble_copies' into integration 2025-10-28 10:59:00 -05:00
J. Nick Koston
f3b69383fd Add additional modbus compile tests (#11567) 2025-10-28 16:43:16 +13:00
J. Nick Koston
aba72809d3 Additional tests for ble_client lambdas (#11565) 2025-10-28 16:43:10 +13:00
J. Nick Koston
fc660bbb66 [esp32_ble_server][esp32_improv]: Eliminate unnecessary heap allocations 2025-10-27 22:32:04 -05:00
J. Nick Koston
4a51486979 Merge branch 'integration' into memory_api 2025-10-27 22:06:38 -05:00
J. Nick Koston
62af87b7b2 Merge branch 'select_options_in_flash' into integration 2025-10-27 22:06:26 -05:00
aanban
85205a28d2 [remote_base] add support for Dyson cool AM07 tower fan (#10163)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-27 22:49:16 -04:00
J. Nick Koston
d2f5fcd201 preen 2025-10-27 21:15:59 -05:00
J. Nick Koston
8d9f147edd Merge remote-tracking branch 'upstream/dev' into select_options_in_flash
# Conflicts:
#	esphome/components/template/select/template_select.cpp
2025-10-27 21:07:13 -05:00
J. Nick Koston
b4be5e7996 Merge branch 'integration' into memory_api 2025-10-27 19:37:39 -05:00
J. Nick Koston
9fd7125d48 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-27 19:37:29 -05:00
Edward Firmo
285e006637 [nextion] Add set_component_visibility() method for dynamic visibility control (#11530)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-28 13:22:28 +13:00
Edward Firmo
5647f36900 [nextion] Remove TFT upload baud rate validation to reduce flash usage (#11012) 2025-10-28 13:21:17 +13:00
Samuel Sieb
1e9309ffff [tuya] allow enum for eco id (#11544)
Co-authored-by: Samuel Sieb <samuel@sieb.net>
2025-10-28 13:20:21 +13:00
J. Nick Koston
0ada17356c Merge branch 'integration' into memory_api 2025-10-27 19:15:28 -05:00
J. Nick Koston
dcb24f8adc Merge branch 'modbus_func_ptr' into integration 2025-10-27 19:15:20 -05:00
J. Nick Koston
bdbe9caf36 [modbus_controller] Optimize lambdas to use function pointers instead of std::function 2025-10-27 19:11:32 -05:00
Daniel Herrmann
ce8a6a6c43 fix: load_cert_chain requires the path, not a file object (#11543) 2025-10-28 12:24:13 +13:00
J. Nick Koston
dfb4b31bf9 [template] Store initial option as index in template select (#11523) 2025-10-28 11:37:40 +13:00
clydebarrow
5716b4bf2b Merge branch 'usb-uart' of https://github.com/clydebarrow/esphome into usb-uart 2025-10-28 08:32:47 +10:00
clydebarrow
2ecfe50a74 Merge branch 'dev' of https://github.com/esphome/esphome into usb-uart 2025-10-28 08:32:38 +10:00
clydebarrow
733001bf65 Fix warning about shift overflow 2025-10-28 08:32:24 +10:00
J. Nick Koston
31b1b50ad9 [number] Skip set_mode call when using default AUTO mode (#11537) 2025-10-28 11:16:38 +13:00
J. Nick Koston
3377080272 [core] Simplify ESPTime::strftime() and save 20 bytes flash (#11539) 2025-10-28 11:16:09 +13:00
clydebarrow
6d63e9869d Merge branch 'dev' of https://github.com/esphome/esphome into usb-uart 2025-10-28 08:14:58 +10:00
Keith Burzinski
d65ad69338 [uart] Fix order of initialization calls (#11510) 2025-10-27 17:09:45 -05:00
J. Nick Koston
dfa69173ea [api] Use FixedVector const references for service array arguments (#11546) 2025-10-28 11:03:44 +13:00
J. Nick Koston
f44615cc8d [template] Optimize all template platforms to use function pointers for stateless lambdas (#11555) 2025-10-28 11:00:02 +13:00
Clyde Stubbs
0e1a79fc53 Merge branch 'dev' into usb-uart 2025-10-28 07:38:13 +10:00
J. Nick Koston
bda4769bd3 [core] Optimize TemplatableValue to use function pointers for stateless lambdas (#11554) 2025-10-27 21:05:40 +00:00
J. Nick Koston
14b057f54e [light] Optimize LambdaLightEffect and AddressableLambdaLightEffect with function pointers (#11556) 2025-10-27 20:14:16 +00:00
J. Nick Koston
e26b5874d7 [api] Register user services with initializer_list (#11545) 2025-10-28 09:07:31 +13:00
J. Nick Koston
00f22e5c36 [network] Eliminate runtime string parsing for IP address initialization (#11561) 2025-10-28 08:51:08 +13:00
Javier Peletier
51e080c2d3 [substitutions] fix #11077 Preserve ESPHomeDatabase (document metadata) in substitutions (#11087)
Co-authored-by: J. Nick Koston <nick+github@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-27 19:46:26 +00:00
J. Nick Koston
71ccbd8212 Merge branch 'integration' into memory_api 2025-10-27 14:41:55 -05:00
J. Nick Koston
8eeda02b68 Merge branch 'template_value_func_pointers' into integration 2025-10-27 14:41:49 -05:00
J. Nick Koston
b32ab80245 includes 2025-10-27 14:41:01 -05:00
J. Nick Koston
0dcdc45d5c Merge branch 'dev' into template_value_func_pointers 2025-10-27 14:38:22 -05:00
J. Nick Koston
3c18558003 Optimize stateless lambdas to use function pointers (#11551) 2025-10-28 08:06:22 +13:00
J. Nick Koston
c5ef520b99 Merge branch 'integration' into memory_api 2025-10-27 12:05:52 -05:00
J. Nick Koston
8962b592da Merge branch 'no_strings_for_ips' into integration 2025-10-27 12:05:41 -05:00
J. Nick Koston
6fc96188d5 tweak 2025-10-27 12:05:30 -05:00
J. Nick Koston
1d885ca6aa Merge branch 'integration' into memory_api 2025-10-27 11:59:01 -05:00
J. Nick Koston
1ede505709 Merge branch 'no_strings_for_ips' into integration 2025-10-27 11:58:56 -05:00
J. Nick Koston
7ceebadca6 [network] Eliminate runtime string parsing for IP address initialization 2025-10-27 11:58:10 -05:00
J. Nick Koston
1b25144bd7 Merge branch 'integration' into memory_api 2025-10-27 11:24:19 -05:00
J. Nick Koston
1b3071d29c Merge branch 'template_lambdas_m_sq' into integration 2025-10-27 11:24:12 -05:00
J. Nick Koston
887e69e0b2 merge 2025-10-27 11:24:03 -05:00
J. Nick Koston
0a47f7dfb5 Merge branch 'integration' into memory_api 2025-10-27 11:23:34 -05:00
J. Nick Koston
8704c6d231 preen 2025-10-27 11:22:47 -05:00
J. Nick Koston
f676759e04 preen 2025-10-27 11:22:36 -05:00
J. Nick Koston
6810da84ae Merge branch 'light_effects_stateless' into integration 2025-10-27 11:21:52 -05:00
J. Nick Koston
8789e8637c merge 2025-10-26 20:31:08 -05:00
J. Nick Koston
c0f9a0ed83 remov etemplate chnges 2025-10-26 20:27:41 -05:00
J. Nick Koston
469dc052a5 remov etemplate chnges 2025-10-26 20:27:23 -05:00
J. Nick Koston
11224212ba Merge branch 'template_lambdas_m' into light_effects_stateless 2025-10-26 20:24:43 -05:00
J. Nick Koston
d7343a769d [light] Optimize LambdaLightEffect and AddressableLambdaLightEffect with function pointers 2025-10-26 20:19:00 -05:00
J. Nick Koston
3389b92255 Merge branch 'template_lambdas_m' into memory_api 2025-10-26 19:43:32 -05:00
J. Nick Koston
5b8cfb0525 Merge branch 'template_lambdas_m' into integration 2025-10-26 19:43:16 -05:00
J. Nick Koston
17d875c8e7 [template] Optimize all template platforms to use function pointers for stateless lambdas 2025-10-26 19:39:56 -05:00
J. Nick Koston
05929c6248 Merge branch 'integration' into memory_api 2025-10-26 12:28:40 -07:00
J. Nick Koston
785a966d58 Merge branch 'template_value_func_pointers' into integration 2025-10-26 12:28:33 -07:00
J. Nick Koston
4967f40551 cleanup 2025-10-26 12:28:09 -07:00
J. Nick Koston
5ba7981c27 Merge branch 'integration' into memory_api 2025-10-26 12:24:41 -07:00
J. Nick Koston
bdb101bb0c Merge branch 'template_value_func_pointers' into integration 2025-10-26 12:24:31 -07:00
J. Nick Koston
561c891432 cleanup 2025-10-26 12:23:48 -07:00
J. Nick Koston
c9178b8026 Merge branch 'integration' into memory_api 2025-10-26 12:19:54 -07:00
J. Nick Koston
35b5959249 Revert "remove"
This reverts commit 077bd624f0.
2025-10-26 12:19:39 -07:00
J. Nick Koston
9c03425adf Merge branch 'template_value_func_pointers' into integration 2025-10-26 12:19:08 -07:00
J. Nick Koston
1652ea8b97 overkill 2025-10-26 12:14:01 -07:00
J. Nick Koston
48b45ba439 we have c++20 2025-10-26 12:01:54 -07:00
J. Nick Koston
b68d030f5a update tests 2025-10-26 11:59:12 -07:00
J. Nick Koston
0bbe326830 preen 2025-10-26 11:51:42 -07:00
J. Nick Koston
077bd624f0 remove 2025-10-26 11:32:59 -07:00
J. Nick Koston
ddf86b4e77 wip 2025-10-26 11:31:55 -07:00
J. Nick Koston
f8661300f5 Merge branch 'integration' into memory_api 2025-10-26 09:41:42 -07:00
J. Nick Koston
6dd3babe03 Merge branch 'stateless_lambdas' into integration 2025-10-26 09:41:35 -07:00
J. Nick Koston
5e4a551a77 over engineered 2025-10-26 09:32:58 -07:00
J. Nick Koston
beace82816 over engineered 2025-10-26 09:32:43 -07:00
Jonathan Swoboda
7394cbf773 [core] Don't allow python 3.14 (#11527) 2025-10-26 09:00:08 -04:00
J. Nick Koston
802b866d25 Merge branch 'integration' into memory_api 2025-10-26 01:31:20 -07:00
J. Nick Koston
cd2ed94054 Merge branch 'stateless_lambdas' into integration 2025-10-26 01:31:14 -07:00
J. Nick Koston
97346e5644 tweak 2025-10-26 01:30:39 -07:00
J. Nick Koston
c30e130a48 dry 2025-10-26 01:07:08 -07:00
J. Nick Koston
c168766832 Merge branch 'integration' into memory_api 2025-10-26 01:05:16 -07:00
J. Nick Koston
36ac9a4b4c Merge branch 'stateless_lambdas' into integration 2025-10-26 01:05:09 -07:00
J. Nick Koston
23207f0074 dry 2025-10-26 01:03:15 -07:00
J. Nick Koston
9e77ece7ce dry 2025-10-26 00:58:52 -07:00
J. Nick Koston
7737689774 dry 2025-10-26 00:56:22 -07:00
J. Nick Koston
73d510d502 Stateless lambdas 2025-10-26 00:35:09 -07:00
J. Nick Koston
1577a46efd [gpio] Skip set_inverted() call for default false value (#11538) 2025-10-25 22:09:42 -07:00
J. Nick Koston
cb0052f974 Merge branch 'integration' into memory_api 2025-10-25 19:12:40 -07:00
J. Nick Koston
60725e72b8 Merge branch 'api_services_once' into integration 2025-10-25 19:12:33 -07:00
J. Nick Koston
4d391fb27e missing define for analyzer 2025-10-25 19:12:21 -07:00
J. Nick Koston
af90cba909 tweak 2025-10-25 19:06:00 -07:00
clydebarrow
c3606a9229 Fix race condition in start_input 2025-10-26 10:05:44 +10:00
clydebarrow
28ee05b1a3 Revert incorrect change 2025-10-26 09:51:15 +10:00
J. Nick Koston
d8d6560acb Merge branch 'integration' into memory_api 2025-10-25 16:50:05 -07:00
J. Nick Koston
a282923f62 Merge branch 'api_services_once' into integration 2025-10-25 16:49:41 -07:00
J. Nick Koston
892aa61e79 Merge branch 'integration' into memory_api 2025-10-25 16:48:51 -07:00
J. Nick Koston
e0eb275c4d Merge branch 'gpio_inverted_default' into integration 2025-10-25 16:48:44 -07:00
J. Nick Koston
22b574992f no zero init pin 2025-10-25 16:47:48 -07:00
clydebarrow
5d170da762 Add instrumentation 2025-10-26 09:45:49 +10:00
J. Nick Koston
5099df00ec missing zero init 2025-10-25 16:36:10 -07:00
J. Nick Koston
6094875ae1 revert 2025-10-25 16:19:35 -07:00
J. Nick Koston
17c32391ae merge 2025-10-25 16:16:53 -07:00
clydebarrow
60d949bf7b WIP 2025-10-26 08:21:06 +10:00
J. Nick Koston
a00c9a6861 Merge branch 'integration' into memory_api 2025-10-25 15:05:27 -07:00
J. Nick Koston
f100073a84 Merge branch 'usb_memory_order_retry' into integration 2025-10-25 15:05:21 -07:00
J. Nick Koston
c18a0f538f preen 2025-10-25 15:05:13 -07:00
J. Nick Koston
4f24448709 Merge branch 'integration' into memory_api 2025-10-25 15:03:11 -07:00
J. Nick Koston
8858ad377b Merge branch 'usb_memory_order_retry' into integration 2025-10-25 15:03:05 -07:00
J. Nick Koston
7e31149584 readable 2025-10-25 15:02:56 -07:00
J. Nick Koston
052f6e6f0f Merge branch 'integration' into memory_api 2025-10-25 14:59:11 -07:00
J. Nick Koston
932b408576 Merge branch 'usb_memory_order_retry' into integration 2025-10-25 14:58:47 -07:00
J. Nick Koston
2c6b9d3826 no race window 2025-10-25 14:56:59 -07:00
J. Nick Koston
527039211e fix off by one 2025-10-25 14:53:48 -07:00
J. Nick Koston
d653aa3203 fix off by one 2025-10-25 14:53:38 -07:00
J. Nick Koston
177bdabd38 Merge branch 'integration' into memory_api 2025-10-25 14:44:50 -07:00
J. Nick Koston
8c52badc96 Merge branch 'usb_memory_order_retry' into integration 2025-10-25 14:44:43 -07:00
J. Nick Koston
1ea17607f3 fix race. 2025-10-25 14:44:36 -07:00
J. Nick Koston
4c08a7b86a fix race. 2025-10-25 14:44:25 -07:00
J. Nick Koston
77053c4ffa Merge branch 'integration' into memory_api 2025-10-25 14:39:45 -07:00
J. Nick Koston
d45b46341f Merge branch 'usb_memory_order_retry' into integration 2025-10-25 14:39:38 -07:00
J. Nick Koston
6cfca87ca7 safer 2025-10-25 14:39:28 -07:00
J. Nick Koston
e2a71b2ea1 Merge branch 'integration' into memory_api 2025-10-25 14:21:17 -07:00
J. Nick Koston
6eb05eaabe Merge branch 'usb_memory_order_retry' into integration 2025-10-25 14:21:08 -07:00
J. Nick Koston
8bd640875f touch ups 2025-10-25 14:20:57 -07:00
J. Nick Koston
1531b3c0d2 Merge branch 'integration' into memory_api 2025-10-25 14:12:28 -07:00
J. Nick Koston
698ee9cfdb Merge branch 'usb_memory_order_retry' into integration 2025-10-25 14:12:21 -07:00
J. Nick Koston
1e17ed8c1e narrow scope 2025-10-25 13:51:29 -07:00
J. Nick Koston
d3b4b11302 narrow scope 2025-10-25 13:50:16 -07:00
J. Nick Koston
6ad33a5a52 Merge branch 'integration' into memory_api 2025-10-25 13:46:41 -07:00
J. Nick Koston
b3409d8b19 Merge branch 'usb_memory_order_retry' into integration 2025-10-25 13:46:35 -07:00
J. Nick Koston
c5ff19d3ab [usb_host] Fix atomic memory ordering in transfer slot allocation 2025-10-25 13:43:53 -07:00
J. Nick Koston
82d76dc7a1 Merge branch 'integration' into memory_api 2025-10-25 11:37:48 -07:00
J. Nick Koston
95df94e7f9 Merge branch 'strftime_overkill' into integration 2025-10-25 11:37:41 -07:00
J. Nick Koston
f8bbd8e32a touch ups 2025-10-25 11:35:01 -07:00
J. Nick Koston
1b529c2f74 Merge branch 'strftime_overkill' into memory_api 2025-10-25 11:24:09 -07:00
J. Nick Koston
183e1268d9 Merge branch 'strftime_overkill' into integration 2025-10-25 11:24:03 -07:00
J. Nick Koston
ace2fce3a2 [core] Simplify ESPTime::strftime() and save 20 bytes flash 2025-10-25 11:23:23 -07:00
J. Nick Koston
960c80b202 [core] Simplify ESPTime::strftime() and save 20 bytes flash 2025-10-25 11:21:22 -07:00
J. Nick Koston
5861cf37f9 [core] Simplify ESPTime::strftime() and save 20 bytes flash 2025-10-25 11:20:06 -07:00
J. Nick Koston
4375d8ae61 Merge branch 'integration' into memory_api 2025-10-25 11:04:19 -07:00
J. Nick Koston
e41abce40e Merge branch 'gpio_inverted_default' into integration 2025-10-25 11:04:12 -07:00
J. Nick Koston
683ea5c568 [gpio] Skip set_inverted() call for default false value 2025-10-25 11:03:44 -07:00
J. Nick Koston
8ea1351285 Merge branch 'integration' into memory_api 2025-10-25 10:51:57 -07:00
J. Nick Koston
f7b98f5993 Merge branch 'number_auto_default' into integration 2025-10-25 10:51:50 -07:00
J. Nick Koston
1e220e9803 [number] Skip set_mode call when using default AUTO mode 2025-10-25 10:51:26 -07:00
J. Nick Koston
2fa5ed6029 Merge branch 'integration' into memory_api 2025-10-25 10:42:38 -07:00
J. Nick Koston
b0f5eacd74 Merge branch 'initial_option_template_select' into integration 2025-10-25 10:42:33 -07:00
J. Nick Koston
f0aa530069 preen 2025-10-25 10:42:20 -07:00
J. Nick Koston
641bcc1dca Merge remote-tracking branch 'origin/initial_option_template_select' into initial_option_template_select 2025-10-25 10:41:06 -07:00
J. Nick Koston
6c9f93fbf8 touch ups 2025-10-25 10:40:05 -07:00
J. Nick Koston
d8dc739645 Merge branch 'dev' into initial_option_template_select 2025-10-25 10:35:39 -07:00
J. Nick Koston
386c989b45 Merge branch 'integration' into memory_api 2025-10-25 10:31:45 -07:00
J. Nick Koston
bff02daa6c Merge branch 'initial_option_template_select' into integration 2025-10-25 10:31:37 -07:00
J. Nick Koston
3a49103584 touch ups 2025-10-25 10:31:13 -07:00
J. Nick Koston
16130308f9 touch ups 2025-10-25 10:26:53 -07:00
J. Nick Koston
e212ed024d [sntp] Replace std::vector<std::string> with std::array<const char*> to save heap memory (#11525) 2025-10-25 10:00:43 -07:00
J. Nick Koston
075efbb216 Merge branch 'integration' into memory_api 2025-10-25 00:28:23 -07:00
J. Nick Koston
3d020d5c6f Merge remote-tracking branch 'upstream/dev' into integration 2025-10-25 00:28:15 -07:00
Jonathan Swoboda
5fdd90c71a [esp32] Add IDF 5.4.3 to platform list and switch to tar.xz (#11528) 2025-10-25 00:27:39 -07:00
J. Nick Koston
b62f620b57 Merge branch 'integration' into memory_api 2025-10-25 00:25:55 -07:00
J. Nick Koston
976fab7488 Merge branch 'select_options_in_flash' into integration 2025-10-25 00:25:41 -07:00
J. Nick Koston
1ea48df6d6 save some bytes 2025-10-24 17:40:56 -07:00
J. Nick Koston
78585ca3f9 Merge branch 'integration' into memory_api 2025-10-24 17:32:52 -07:00
J. Nick Koston
e34333353b Merge branch 'sntp_servers_flash' into integration 2025-10-24 17:32:46 -07:00
J. Nick Koston
b77db3604f cleanup 2025-10-24 17:32:38 -07:00
J. Nick Koston
875506f2f7 cleanup 2025-10-24 17:30:21 -07:00
J. Nick Koston
7dd1071026 cleanup 2025-10-24 17:30:04 -07:00
J. Nick Koston
9a44f8c14d Merge branch 'integration' into memory_api 2025-10-24 14:39:17 -07:00
J. Nick Koston
7ef23657ab Merge branch 'sntp_servers_flash' into integration 2025-10-24 14:39:09 -07:00
J. Nick Koston
01b1844e9d must still be in ram on 8266 2025-10-24 14:38:46 -07:00
J. Nick Koston
9e798ffa4f must still be in ram on 8266 2025-10-24 14:37:35 -07:00
J. Nick Koston
ccdce3508c must still be in ram on 8266 2025-10-24 14:37:29 -07:00
J. Nick Koston
3025d35554 must still be in ram on 8266 2025-10-24 14:37:15 -07:00
J. Nick Koston
2b75eca91f Merge branch 'integration' into memory_api 2025-10-24 14:31:46 -07:00
J. Nick Koston
d53c162448 Merge branch 'sntp_servers_flash' into integration 2025-10-24 14:31:37 -07:00
J. Nick Koston
54fb391f13 cleanup 2025-10-24 14:26:17 -07:00
J. Nick Koston
45770811d2 [sntp] Store server strings in flash memory 2025-10-24 14:13:41 -07:00
J. Nick Koston
45c24e9550 [sntp] Store server strings in flash memory 2025-10-24 14:09:59 -07:00
J. Nick Koston
3b750adf29 Merge branch 'integration' into memory_api 2025-10-24 13:41:24 -07:00
J. Nick Koston
7a192cd769 Merge branch 'initial_option_template_select' into integration 2025-10-24 13:41:17 -07:00
J. Nick Koston
7efa1f7641 test 2025-10-24 13:39:06 -07:00
J. Nick Koston
7f06e0bbca [template] Store initial option as index in template select 2025-10-24 13:32:18 -07:00
Jonathan Swoboda
6929bdb415 [remote_transmitter] Remove delays and use RMT instead (#11505) 2025-10-24 15:01:30 -04:00
J. Nick Koston
353caaf4ff touch ups 2025-10-24 09:33:56 -07:00
J. Nick Koston
2e1c8a114a touch ups 2025-10-24 09:33:38 -07:00
J. Nick Koston
2df6a8aa9e Merge branch 'integration' into memory_api 2025-10-24 07:29:26 -07:00
J. Nick Koston
263a368e00 Merge branch 'select_options_in_flash' into integration 2025-10-24 07:29:17 -07:00
J. Nick Koston
44157f1ced tweak 2025-10-24 07:16:40 -07:00
J. Nick Koston
b2cded14ec tweak 2025-10-24 06:46:54 -07:00
J. Nick Koston
4135e0b5db fixes 2025-10-24 06:43:03 -07:00
J. Nick Koston
3ae82f6b98 [select] Store options in flash to reduce RAM usage 2025-10-24 04:39:55 -07:00
J. Nick Koston
09f97d86e6 [select] Store options in flash to reduce RAM usage 2025-10-24 04:31:16 -07:00
J. Nick Koston
83e4013a25 [select] Store options in flash to reduce RAM usage 2025-10-24 04:27:41 -07:00
J. Nick Koston
18b12f845d [select] Store options in flash to reduce RAM usage 2025-10-24 04:22:52 -07:00
J. Nick Koston
3d6224d1b1 [select] Store options in flash to reduce RAM usage 2025-10-24 04:22:22 -07:00
J. Nick Koston
d27e78e909 [select] Store options in flash to reduce RAM usage 2025-10-24 04:13:34 -07:00
J. Nick Koston
5426f8736b [esphome][ota] Add write_byte_() helper to reduce code duplication 2025-10-23 22:58:09 -07:00
J. Nick Koston
a061af8d73 Merge branch 'integration' into memory_api 2025-10-23 22:32:17 -07:00
J. Nick Koston
dfce46b33e Merge remote-tracking branch 'upstream/dev' into integration 2025-10-23 22:32:08 -07:00
J. Nick Koston
2c85ba037e [http_request] Pass collect_headers by const reference instead of by value (#11494) 2025-10-23 20:01:48 -07:00
J. Nick Koston
2440bbdceb [core][sensor] Eliminate redundant default value setters in generated code (#11495) 2025-10-23 20:01:23 -07:00
Jesse Hills
3ac8eb7696 Merge branch 'release' into dev 2025-10-24 14:08:56 +13:00
Jesse Hills
6a478b9070 Merge pull request #11506 from esphome/bump-2025.10.3
2025.10.3
2025-10-24 14:08:12 +13:00
Jesse Hills
a32a1d11fb Bump version to 2025.10.3 2025-10-24 07:51:38 +13:00
Markus
daeb8ef88c [core] handle mixed IP and DNS addresses correctly in resolve_ip_address (#11503)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-24 07:51:38 +13:00
Anton Sergunov
febee437d6 [uart] Make rx pin respect pullup and pulldown settings (#9248) 2025-10-24 07:51:38 +13:00
Peter Zich
de2f475dbd [hdc1080] Make HDC1080_CMD_CONFIGURATION failure a warning (and log it) (#11355)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-24 07:51:38 +13:00
Markus
fa3ec6f732 [core] handle mixed IP and DNS addresses correctly in resolve_ip_address (#11503)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-23 11:32:07 -07:00
J. Nick Koston
dadf037037 Merge branch 'integration' into memory_api 2025-10-23 11:29:47 -07:00
J. Nick Koston
3379551b3c Merge branch 'fix_ip_dns_mix' into integration 2025-10-23 11:29:41 -07:00
J. Nick Koston
190bd47657 Merge branch 'redundant_setters' into integration 2025-10-23 11:29:33 -07:00
J. Nick Koston
c76e446895 tweaks 2025-10-23 11:14:24 -07:00
J. Nick Koston
6dab0b4b49 tweaks 2025-10-23 11:12:57 -07:00
J. Nick Koston
267b715bfa safer 2025-10-23 11:11:45 -07:00
J. Nick Koston
3e6d1d551d tweak 2025-10-23 11:06:09 -07:00
Links2004
8b67b9f35d add unit tests for mixed IP and hostname resolution with proper handling of exceptions
fix up address handling for mixed IP and hostname resolution
2025-10-23 17:54:50 +00:00
dependabot[bot]
e490aec6b4 Bump ruamel-yaml from 0.18.15 to 0.18.16 (#11482)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-23 10:25:36 -07:00
Links2004
af321edf80 [core] handle mixed IP and DNS addresses correctly in resolve_ip_address
do not raise error if some addresses are IPs and
the mDNS / DNS resolution fails for others

fix: #11501
2025-10-23 17:15:45 +00:00
J. Nick Koston
8da8095a6a [tests] Isolate gps component to prevent TinyGPSPlus millis() conflicts (#11499) 2025-10-23 10:11:13 -07:00
Patrick
ab14c0cd72 [pipsolar] improve sensor readout in HA, set unknown state on timeout / error (#10292)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-23 11:32:02 -04:00
J. Nick Koston
fdd453e88a fix 2025-10-23 09:02:08 -06:00
J. Nick Koston
cce5b58de4 Revert "[tests] Fix millis() ambiguity in component tests with gps component"
This reverts commit f9b08491cc.
2025-10-23 08:19:48 -06:00
J. Nick Koston
ba4ce200d8 Merge branch 'qualify_millis_tests_tinygps' into redundant_setters 2025-10-23 06:51:05 -06:00
J. Nick Koston
f9b08491cc [tests] Fix millis() ambiguity in component tests with gps component 2025-10-23 06:50:24 -06:00
J. Nick Koston
ba3fd5fdb5 Merge branch 'integration' into memory_api 2025-10-22 19:50:57 -10:00
J. Nick Koston
41dab22014 Merge branch 'redundant_setters' into integration 2025-10-22 19:50:50 -10:00
J. Nick Koston
b61cc2003f [core][sensor] Eliminate redundant default value setters in generated code 2025-10-22 19:49:27 -10:00
J. Nick Koston
6a009d0945 Merge branch 'integration' into memory_api 2025-10-22 19:21:09 -10:00
J. Nick Koston
dd5b840895 Merge branch 'http_request_no_copy' into integration 2025-10-22 19:21:00 -10:00
J. Nick Koston
a89511f3ae [http_request] Pass collect_headers by const reference instead of by value 2025-10-22 19:01:21 -10:00
J. Nick Koston
f66a526d2e [http_request] Pass collect_headers by const reference instead of by value 2025-10-22 19:00:58 -10:00
J. Nick Koston
917deac7cb [scheduler] Remove unused <deque> include after defer queue optimization (#11491) 2025-10-23 04:02:19 +00:00
dependabot[bot]
3d21adecd3 Bump aioesphomeapi from 42.2.0 to 42.3.0 (#11493)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-23 02:58:09 +00:00
J. Nick Koston
5b023f9369 [ethernet] Add RMII GPIO pin conflict validation (#11488) 2025-10-22 16:37:50 -10:00
dependabot[bot]
6c2ce5cacf Bump bleak from 1.0.1 to 1.1.1 (#11492)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-22 16:36:30 -10:00
J. Nick Koston
d23e25f099 [api] Fix clang-tidy modernize-use-emplace warning for light effects (#11490) 2025-10-22 21:31:51 -05:00
J. Nick Koston
af428fd7c5 Merge remote-tracking branch 'origin/memory_api' into memory_api 2025-10-22 16:26:03 -10:00
J. Nick Koston
d434f0c641 Merge branch 'integration' into memory_api 2025-10-22 16:25:47 -10:00
J. Nick Koston
d15dbabae4 Merge branch 'climate_overhead' into integration 2025-10-22 16:25:35 -10:00
optimusprimespace
9b78098eec [hdc2010] New component (#6674)
Co-authored-by: Keith Burzinski <kbx81x@gmail.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>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-22 22:24:17 -04:00
J. Nick Koston
6338326d10 use helper to fix flakey test 2025-10-22 16:18:57 -10:00
J. Nick Koston
87c630cf45 Merge branch 'memory_api' of https://github.com/esphome/esphome into memory_api 2025-10-22 16:14:53 -10:00
J. Nick Koston
fe7ebbc33e Merge branch 'integration' into memory_api 2025-10-22 16:14:46 -10:00
J. Nick Koston
19edaf97de Merge branch 'ethernet_pin_validate' into integration 2025-10-22 16:14:41 -10:00
J. Nick Koston
ceba2fad15 Merge branch 'integration' of https://github.com/esphome/esphome into integration 2025-10-22 16:14:35 -10:00
J. Nick Koston
f5b995a454 preen 2025-10-22 16:11:37 -10:00
J. Nick Koston
3112c06f1d handle p4 2025-10-22 16:07:46 -10:00
J. Nick Koston
b276bc0867 Merge branch 'dev' into climate_overhead 2025-10-22 15:24:26 -10:00
Keith Burzinski
7e5b82c5f3 [improv_serial] Various optimizations (#11473)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-23 14:24:08 +13:00
J. Nick Koston
2864e989bd [light] Extract ColorModeMask into generic FiniteSetMask helper (#11472)
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>
2025-10-23 14:22:46 +13:00
J. Nick Koston
6efe346cc5 [light] Use std::initializer_list for add_effects to reduce flash overhead (#11485) 2025-10-23 14:21:53 +13:00
J. Nick Koston
f2f6c597ef [light] Store effect names in flash (const char*) to save RAM (#11487)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-23 14:17:57 +13:00
J. Nick Koston
7a033edbc2 Merge branch 'integration' into memory_api 2025-10-22 15:17:38 -10:00
J. Nick Koston
ec93a932ae Merge branch 'ethernet_pin_validate' into integration 2025-10-22 15:17:33 -10:00
J. Nick Koston
a050ff6ac3 preen 2025-10-22 15:17:23 -10:00
J. Nick Koston
48643cd2de Merge branch 'integration' into memory_api 2025-10-22 15:09:10 -10:00
J. Nick Koston
8737f5d670 Merge branch 'ethernet_pin_validate' into integration 2025-10-22 15:09:01 -10:00
J. Nick Koston
c6de86bfb1 tests 2025-10-22 15:08:12 -10:00
J. Nick Koston
64e3e1ef82 preen 2025-10-22 15:00:36 -10:00
J. Nick Koston
6a2b305eb2 [ethernet] Add RMII GPIO pin conflict validation 2025-10-22 14:57:32 -10:00
tomaszduda23
b91b12d77a [nrf52] support BLE --device for logging (#9861)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-22 14:55:34 -10:00
J. Nick Koston
ae41ae80ca Fix light_call.cpp to use first_value_from_mask instead of first_mode_from_mask
The generic FiniteSetMask uses first_value_from_mask, not first_mode_from_mask.
This aligns with the enum_mask_helper implementation.
2025-10-22 14:33:48 -10:00
J. Nick Koston
d8cb5d4aa4 Fix light_traits.h to use correct FiniteSetMask API
- Use count() instead of contains() (std::set compatible API)
- Use has_capability() free function instead of method
- Matches enum_mask_helper implementation
2025-10-22 14:33:02 -10:00
J. Nick Koston
416ce17c92 Merge branch 'climate_overhead' into memory_api 2025-10-22 14:31:45 -10:00
J. Nick Koston
4d86bbda79 Merge branch 'integration' into memory_api 2025-10-22 14:23:17 -10:00
J. Nick Koston
6e8997dcee Merge branch 'fan_fixed' into integration 2025-10-22 14:23:10 -10:00
J. Nick Koston
cdbf9682b1 Merge branch 'integration' into memory_api 2025-10-22 14:12:29 -10:00
J. Nick Koston
dff7e90d10 Merge branch 'light_effects_rom' into integration 2025-10-22 14:12:23 -10:00
J. Nick Koston
c55c031882 missed some 2025-10-22 13:55:44 -10:00
J. Nick Koston
272858dfca [light] Store effect names in flash (const char*) to save RAM 2025-10-22 13:48:23 -10:00
J. Nick Koston
091c12cb48 preen 2025-10-22 13:29:14 -10:00
J. Nick Koston
39b93079e5 simp 2025-10-22 13:26:53 -10:00
J. Nick Koston
93c555ae87 reset 2025-10-22 13:18:14 -10:00
J. Nick Koston
42a7385f98 Merge branch 'integration' into memory_api 2025-10-22 12:32:37 -10:00
J. Nick Koston
b5e7e0e442 Merge branch 'light_effects' into integration 2025-10-22 12:32:33 -10:00
J. Nick Koston
977dd9dd34 manual copy 2025-10-22 12:29:23 -10:00
J. Nick Koston
fe6f877185 manual copy 2025-10-22 12:28:51 -10:00
J. Nick Koston
c7aef0016a manual copy 2025-10-22 12:27:29 -10:00
J. Nick Koston
c69e7f4e78 init 2025-10-22 12:25:35 -10:00
J. Nick Koston
6d1ee10742 manual copy 2025-10-22 12:24:47 -10:00
J. Nick Koston
77f97270d6 [light] Use std::initializer_list for add_effects to reduce flash overhead 2025-10-22 12:20:50 -10:00
J. Nick Koston
e822aa1e3d Merge branch 'integration' into memory_api 2025-10-22 12:14:08 -10:00
J. Nick Koston
4ed33b5659 Merge branch 'enum_mask_helper' into integration 2025-10-22 12:14:03 -10:00
J. Nick Koston
516889f35e Merge remote-tracking branch 'origin/fan_fixed' into fan_fixed 2025-10-22 12:02:31 -10:00
J. Nick Koston
26e4754673 fixed 2025-10-22 12:02:20 -10:00
J. Nick Koston
a3b3032319 Merge branch 'dev' into fan_fixed 2025-10-22 11:56:27 -10:00
J. Nick Koston
7f567bdfbe [fan] Add basic fan compile tests (#11484) 2025-10-23 10:53:15 +13:00
J. Nick Koston
b0f764a37e fixed 2025-10-22 11:52:15 -10:00
J. Nick Koston
5c7029623e fixed 2025-10-22 11:44:42 -10:00
J. Nick Koston
fdb23a2c13 fixed 2025-10-22 11:42:31 -10:00
J. Nick Koston
43bcd98649 fixed 2025-10-22 11:41:15 -10:00
J. Nick Koston
274c0505f7 fixed 2025-10-22 11:38:52 -10:00
J. Nick Koston
eaf0a367b4 fixed 2025-10-22 11:37:19 -10:00
J. Nick Koston
657e6f0bce fixed 2025-10-22 11:28:53 -10:00
J. Nick Koston
935acc7d5e fixed 2025-10-22 11:24:12 -10:00
J. Nick Koston
acd24402dd reduce scope 2025-10-22 11:16:28 -10:00
J. Nick Koston
ac36b97262 reduce scope 2025-10-22 11:16:13 -10:00
J. Nick Koston
828f2addcd Merge remote-tracking branch 'origin/fan_fixed' into fan_fixed 2025-10-22 11:09:23 -10:00
J. Nick Koston
f11e8e36b5 missed 2025-10-22 11:09:10 -10:00
Daniel Stiner
f2de8df556 [openthread] Fix OTA by populating CORE.address with device's mDNS address (#11095)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-22 11:07:01 -10:00
J. Nick Koston
788c402cfe Merge branch 'fan_base_tests' into fan_fixed 2025-10-22 11:05:09 -10:00
J. Nick Koston
04d127015c Add basic fan compile tests
baseline for https://github.com/esphome/esphome/pull/11483
2025-10-22 11:04:38 -10:00
J. Nick Koston
f559fad4fc [fan] Use FixedVector for preset modes, preserve config order (breaking) 2025-10-22 11:03:32 -10:00
J. Nick Koston
f58b90a67c preen 2025-10-22 10:34:44 -10:00
J. Nick Koston
42a86fe333 merge 2025-10-22 10:18:51 -10:00
J. Nick Koston
3dfb2ba70e tidy 2025-10-22 10:18:26 -10:00
J. Nick Koston
771501ccbb Merge branch 'integration' into memory_api 2025-10-22 10:13:54 -10:00
J. Nick Koston
8daab8350c Merge branch 'enum_mask_helper' into integration 2025-10-22 10:13:49 -10:00
J. Nick Koston
1bebdb2c00 fix refactoring error 2025-10-22 10:12:58 -10:00
J. Nick Koston
4c6cd05b7b Merge branch 'integration' into memory_api 2025-10-22 10:08:53 -10:00
J. Nick Koston
a4073ffc7b Merge branch 'enum_mask_helper' into integration 2025-10-22 10:08:45 -10:00
J. Nick Koston
a284a06916 policy 2025-10-22 10:08:27 -10:00
J. Nick Koston
94809c4687 merge 2025-10-22 10:07:36 -10:00
J. Nick Koston
22070ac78f review feedback 2025-10-22 10:07:16 -10:00
J. Nick Koston
349dc7227e Merge branch 'integration' into memory_api 2025-10-22 09:59:39 -10:00
J. Nick Koston
ceb2231a9f Merge branch 'enum_mask_helper' into integration 2025-10-22 09:59:28 -10:00
J. Nick Koston
7c7f1e755d merge 2025-10-22 09:55:10 -10:00
J. Nick Koston
bc7cc066a5 backmerge 2025-10-22 09:54:47 -10:00
J. Nick Koston
8e9a438c46 reduce 2025-10-22 09:51:15 -10:00
J. Nick Koston
73944d4077 reduce 2025-10-22 09:48:39 -10:00
J. Nick Koston
56d084bcff reduce 2025-10-22 09:47:31 -10:00
J. Nick Koston
ce80baa3c9 reduce 2025-10-22 09:46:13 -10:00
J. Nick Koston
d7f32bf27f reduce 2025-10-22 09:44:14 -10:00
J. Nick Koston
1c67a61945 [ci] Fix WiFi testing mode validation and component splitter for variant-only tests (#11481) 2025-10-23 08:10:24 +13:00
pre-commit-ci-lite[bot]
a335aa0713 [pre-commit.ci lite] apply automatic fixes 2025-10-22 18:56:11 +00:00
J. Nick Koston
02a8024e94 Update esphome/components/light/color_mode.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-22 08:54:21 -10:00
J. Nick Koston
35afa7ae05 migrate 2025-10-22 08:52:27 -10:00
J. Nick Koston
0572344c08 revert 2025-10-22 08:48:25 -10:00
J. Nick Koston
753662feaa preen 2025-10-22 08:47:18 -10:00
J. Nick Koston
daef2a81b7 Merge remote-tracking branch 'upstream/dev' into enum_mask_helper 2025-10-22 08:44:47 -10:00
J. Nick Koston
c70a3cf405 feedback 2025-10-22 08:44:08 -10:00
J. Nick Koston
92a812e154 optimize 2025-10-22 08:30:17 -10:00
Jonathan Swoboda
77141d3e83 [esp32] Set the location of the IDF component manager cache (#11467) 2025-10-22 14:28:18 -04:00
J. Nick Koston
f592f79bce [ci] Fix component splitter for components with only variant tests (#11476) 2025-10-22 07:30:27 -10:00
J. Nick Koston
6edbb94529 [ci] Fix test detection for components with only variant tests (#11474) 2025-10-22 00:06:14 -10:00
J. Nick Koston
3fda73bcf2 bot review 2025-10-22 00:05:06 -10:00
J. Nick Koston
0d2eb794c7 Merge branch 'integration' into memory_api 2025-10-21 23:57:40 -10:00
J. Nick Koston
55d7f5e8be Merge branch 'enum_mask_helper' into integration 2025-10-21 23:57:33 -10:00
J. Nick Koston
44c2410017 preen 2025-10-21 22:48:42 -10:00
J. Nick Koston
50eaf522b9 Merge branch 'dev' into enum_mask_helper 2025-10-21 22:48:22 -10:00
J. Nick Koston
7310d75579 minimize changes 2025-10-21 22:39:11 -10:00
J. Nick Koston
ae1af5f16e minimize changes 2025-10-21 22:38:44 -10:00
J. Nick Koston
0d256e12a6 [climate] Remove redundant initializer_list overloads from haier and midea
EnumBitmask and std::vector already handle initializer_list via
implicit conversion, so explicit overloads are unnecessary.
2025-10-21 22:37:48 -10:00
J. Nick Koston
0ad42ec79b minimize changes 2025-10-21 22:37:19 -10:00
J. Nick Koston
1eca67bb4c [climate] Remove redundant initializer_list overloads
EnumBitmask already has a constructor that takes initializer_list,
so the explicit overloads are unnecessary and add code duplication.
2025-10-21 22:36:33 -10:00
J. Nick Koston
d8e8c2832e minimize changes 2025-10-21 22:34:58 -10:00
J. Nick Koston
55d1b823e8 minimize changes 2025-10-21 22:34:45 -10:00
J. Nick Koston
2debf04a48 [climate] Use std::set API for EnumBitmask
- Change .add() to .insert()
- Change .remove() to .erase()
- Change .contains() to .count() > 0
- Consistent with std::set API
2025-10-21 22:32:58 -10:00
J. Nick Koston
e9e6b9ddf9 minimize changes 2025-10-21 22:32:36 -10:00
J. Nick Koston
7eff1c31fd adjust 2025-10-21 22:30:27 -10:00
J. Nick Koston
9d1ceba18f [core] Use std::set API for EnumBitmask
- Replace .contains()/.add()/.remove() with .count()/.insert()/.erase()
- Makes EnumBitmask a true drop-in replacement for std::set
- Update all usages in light component
2025-10-21 22:28:59 -10:00
J. Nick Koston
f8f967b25c wi 2025-10-21 22:25:57 -10:00
J. Nick Koston
1119b4e11e [core] Add std::set compatibility aliases to EnumBitmask
- Add insert() as alias for add()
- Add erase() as alias for remove()
- Add count() as alias for contains()
- Makes EnumBitmask a true drop-in replacement for std::set
- Update documentation to reflect compatibility
2025-10-21 22:23:37 -10:00
Jeff Brown
d37eb59fd7 [light] Eliminate dimming undershoot during addressable light transition (#11471) 2025-10-22 08:22:33 +00:00
J. Nick Koston
c6711fc354 adjust 2025-10-21 22:19:07 -10:00
J. Nick Koston
8fd3719f38 merge 2025-10-21 22:10:09 -10:00
Jeff Brown
e2b3617df3 [climate] Fix restore state for fan mode, preset, and swing mode (#11126)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-21 22:08:40 -10:00
J. Nick Koston
15d4e30df2 merge 2025-10-21 22:04:46 -10:00
J. Nick Koston
960e6da4f7 [gree] Use EnumBitmask add() instead of insert() for climate traits 2025-10-21 22:02:53 -10:00
J. Nick Koston
4dba685898 merge 2025-10-21 22:01:39 -10:00
J. Nick Koston
379d76b397 Merge branch 'enum_mask_helper' into climate_overhead 2025-10-21 22:01:27 -10:00
J. Nick Koston
777e73fd04 Extract ColorModeMask into EnumBitmask helper 2025-10-21 21:54:44 -10:00
J. Nick Koston
e1c851cab8 [wifi] Optimize WiFi network storage with FixedVector (#11458)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-22 05:23:10 +00:00
J. Nick Koston
146b067d62 [light] Add compile test for addressable lights (#11465) 2025-10-22 16:59:39 +13:00
J. Nick Koston
5b15827009 [CI] Fix component detection when core files change in determine-jobs (#11461) 2025-10-22 16:58:40 +13:00
J. Nick Koston
0de79ba291 [event] Replace std::set with FixedVector for event type storage (#11463) 2025-10-22 16:57:18 +13:00
J. Nick Koston
e3aaf6a144 [wifi] Test multiple stas in wifi compile tests (#11460) 2025-10-22 16:55:46 +13:00
J. Nick Koston
78ffeb30fb [binary_sensor] Optimize MultiClickTrigger with FixedVector (#11453)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-22 16:55:13 +13:00
J. Nick Koston
d3927fe33f fix compile 2025-10-21 17:35:24 -10:00
J. Nick Koston
f7a4578390 fix compile 2025-10-21 17:27:01 -10:00
J. Nick Koston
f3bf25d203 fix compile 2025-10-21 17:25:20 -10:00
J. Nick Koston
bbce28c18d fix compile 2025-10-21 17:21:59 -10:00
J. Nick Koston
dfa51a5137 merge 2025-10-21 17:16:04 -10:00
J. Nick Koston
a59fdd8e04 wip 2025-10-21 16:58:15 -10:00
J. Nick Koston
bc296d05fb wip 2025-10-21 16:57:18 -10:00
J. Nick Koston
46afd21738 Merge branch 'integration' into memory_api 2025-10-21 15:58:37 -10:00
J. Nick Koston
740a66a4c0 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-21 15:58:30 -10:00
Jesse Hills
2c1927fd12 [api] Allow clearing noise psk if dynamically set (#11429) 2025-10-22 14:24:56 +13:00
Jesse Hills
c6ae1a5909 [core] Stop clang-format "fixing" a single line (#11462) 2025-10-22 01:00:27 +00:00
J. Nick Koston
f562454f8e Merge branch 'integration' into memory_api 2025-10-21 14:17:00 -10:00
J. Nick Koston
ad2e6d1454 Merge branch 'event_types' into integration 2025-10-21 14:16:55 -10:00
J. Nick Koston
ece0619070 [event] Replace std::set with FixedVector for event type storage 2025-10-21 14:05:43 -10:00
J. Nick Koston
033325d354 Merge branch 'integration' into memory_api 2025-10-21 13:45:01 -10:00
J. Nick Koston
73a3665b86 Merge branch 'wifi_sta_fixed' into integration 2025-10-21 13:44:55 -10:00
J. Nick Koston
35f3c6b098 preen 2025-10-21 13:44:46 -10:00
J. Nick Koston
f9fe2d21e5 tweaks 2025-10-21 13:25:51 -10:00
J. Nick Koston
0bde964441 Merge branch 'integration' into memory_api 2025-10-21 13:12:20 -10:00
J. Nick Koston
753e011d73 Merge branch 'wifi_sta_fixed' into integration 2025-10-21 13:12:12 -10:00
J. Nick Koston
9c712744be [light] Replace std::vector with FixedVector in strobe and color_wipe effects (#11455) 2025-10-22 11:40:19 +13:00
J. Nick Koston
9b1ac8f83d Merge branch 'wifi_multi_sta_tests' into wifi_sta_fixed 2025-10-21 12:26:12 -10:00
J. Nick Koston
d79af2d0e9 Merge branch 'dev' into wifi_multi_sta_tests 2025-10-21 12:25:57 -10:00
Javier Peletier
ae50a09b4e C++ components unit test framework (#9284)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-21 22:21:22 +00:00
J. Nick Koston
f15da08acc Merge branch 'wifi_multi_sta_tests' into wifi_sta_fixed 2025-10-21 12:17:51 -10:00
J. Nick Koston
3f76a67c65 [wifi] Test multiple stas in wifi compile tests 2025-10-21 12:17:16 -10:00
Jeff Brown
1ea80594c6 [light] Improve gamma correction precision (#11141)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-21 22:11:11 +00:00
J. Nick Koston
02e1ed2130 multiple networks 2025-10-21 11:57:06 -10:00
J. Nick Koston
8500323d39 [esp32] Add advanced options to disable unused VFS features (saves ~8.7 KB flash) (#11441) 2025-10-22 10:47:31 +13:00
J. Nick Koston
2948264917 try to avoid some of the ram 2025-10-21 11:46:30 -10:00
J. Nick Koston
660411ac42 try to avoid some of the ram 2025-10-21 11:44:56 -10:00
J. Nick Koston
88e3f02c9c try to avoid some of the ram 2025-10-21 11:40:48 -10:00
J. Nick Koston
6f7db2f5f7 [gpio] Optimize switch interlock with FixedVector (#11448)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-21 11:35:34 -10:00
J. Nick Koston
9922c65912 Add compile tests for binary_sensor MultiClickTrigger (#11454)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-22 10:32:48 +13:00
J. Nick Koston
f2469077d9 [light] Add tests for AddressableColorWipeEffectColor/StrobeLightEffectColor (#11456) 2025-10-22 10:31:18 +13:00
J. Nick Koston
f3f419077b [wifi] Optimize WiFi network storage with FixedVector 2025-10-21 11:29:27 -10:00
Jesse Hills
742eca92d8 [CI] Add auto label for chained PRs (#11457) 2025-10-21 11:22:56 -10:00
J. Nick Koston
fead1a8c22 Merge branch 'integration' into memory_api 2025-10-21 11:16:06 -10:00
J. Nick Koston
ec08579eab Merge branch 'light_fixed' into integration 2025-10-21 11:15:46 -10:00
J. Nick Koston
805b5aef20 Merge branch 'binary_sensor_multi_click_fixed_vector' into integration 2025-10-21 11:15:38 -10:00
J. Nick Koston
548913b471 Add gpio switch interlock compile tests (#11449) 2025-10-22 10:12:32 +13:00
Anton Sergunov
a05c5ea240 [uart] Make rx pin respect pullup and pulldown settings (#9248) 2025-10-22 10:10:25 +13:00
J. Nick Koston
d6961610c7 [light] Replace std::vector with FixedVector in strobe and color_wipe effects 2025-10-21 11:10:02 -10:00
J. Nick Koston
9e693335b6 [binary_sensor] Optimize MultiClickTrigger with FixedVector 2025-10-21 10:50:33 -10:00
Jeff Brown
8e8a2bde95 [light] Decouple AddressableLight and Light transition classes (#11166)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-21 10:37:29 -10:00
Petr Kejval
80265a6bd2 [sensor] Add optimistic option to heartbeat filter (#10993)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-21 09:17:07 -04:00
J. Nick Koston
c47d9345ea Merge branch 'integration' into memory_api 2025-10-20 23:38:37 -10:00
J. Nick Koston
e7e96abcba Merge branch 'gpio_switch_fixed_vector' into integration 2025-10-20 23:38:26 -10:00
J. Nick Koston
8f4cb740f3 Merge branch 'gpio_switch_interlock_tests' into integration 2025-10-20 23:38:18 -10:00
J. Nick Koston
87e9a7a1bd [climate] Remove unnecessary vector allocations in state save/restore (#11445) 2025-10-21 04:35:18 -05:00
J. Nick Koston
53d0f589ba Add gpio switch interlock compile tests 2025-10-20 23:34:16 -10:00
J. Nick Koston
3aedfe8be3 [binary_sensor] Optimize AutorepeatFilter with FixedVector (#11444) 2025-10-21 04:30:13 -05:00
J. Nick Koston
245f083a5c Add gpio switch interlock compile tests 2025-10-20 23:29:15 -10:00
J. Nick Koston
f9f0d895f7 [gpio] Optimize switch interlock with FixedVector 2025-10-20 23:28:23 -10:00
J. Nick Koston
7f2cc47ed6 [binary_sensor] Add compile test for auto repeat (#11443) 2025-10-21 04:25:59 -05:00
J. Nick Koston
811cd4582e Merge branch 'integration' into memory_api 2025-10-20 22:49:57 -10:00
J. Nick Koston
c88861d6ba Merge branch 'remove_climate_temp_vectors' into integration 2025-10-20 22:49:49 -10:00
J. Nick Koston
51678fe4a4 [climate] Remove unnecessary vector allocations in state save/restore 2025-10-20 22:36:10 -10:00
J. Nick Koston
c2c55ac648 Merge branch 'integration' into memory_api 2025-10-20 22:23:39 -10:00
J. Nick Koston
f1f1017cce Merge branch 'auto_repeat_fixed' into integration 2025-10-20 22:23:33 -10:00
J. Nick Koston
4bb4a309e7 [binary_sensor] Optimize AutorepeatFilter with FixedVector 2025-10-20 22:09:46 -10:00
J. Nick Koston
375adbb86f [binary_sensor] Optimize AutorepeatFilter with FixedVector 2025-10-20 22:09:22 -10:00
J. Nick Koston
5b13814a9e Merge branch 'integration' into memory_api 2025-10-20 21:58:42 -10:00
J. Nick Koston
71af6dbb04 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-20 21:58:30 -10:00
J. Nick Koston
a5542e0d2b [sensor] Optimize calibration and Or filters with FixedVector (#11437) 2025-10-20 21:38:05 -10:00
J. Nick Koston
110f23caff fix 2025-10-20 21:34:14 -10:00
Keith Burzinski
66afe4a9be [climate] Add some integration tests (#11439) 2025-10-21 02:26:18 -05:00
J. Nick Koston
faff196f1b Merge branch 'integration' into memory_api 2025-10-20 21:25:34 -10:00
J. Nick Koston
e3c3acebde Merge branch 'disable_unused_vfs_esp32' into integration 2025-10-20 21:25:28 -10:00
J. Nick Koston
abcb2ce4e7 conditional 2025-10-20 21:17:48 -10:00
J. Nick Koston
c3fbfca844 conditional 2025-10-20 21:15:23 -10:00
J. Nick Koston
888db4c784 Merge branch 'integration' into memory_api 2025-10-20 20:59:26 -10:00
J. Nick Koston
b2fe8bb25d Merge branch 'disable_unused_vfs_esp32' into integration 2025-10-20 20:59:18 -10:00
J. Nick Koston
572af76bee [esp32] Add advanced options to disable unused VFS features (saves ~5 KB flash) 2025-10-20 20:49:12 -10:00
J. Nick Koston
0ae9009e41 [ci] Fix clang-tidy split mode for core file changes (#11434) 2025-10-20 20:39:50 -10:00
J. Nick Koston
0b2f5fcd7e Add additional sensor filter tests (#11438) 2025-10-20 20:39:21 -10:00
J. Nick Koston
7a2887e2ed [analyze-memory] Improve symbol categorization accuracy (#11440) 2025-10-20 20:39:05 -10:00
J. Nick Koston
45460c3165 Merge branch 'integration' into memory_api 2025-10-20 20:25:25 -10:00
J. Nick Koston
3533ff50bd Merge branch 'improve_analyze_memory_symbols' into integration 2025-10-20 20:25:05 -10:00
J. Nick Koston
bc572aeec5 preen 2025-10-20 20:21:27 -10:00
J. Nick Koston
c6370bb410 more cleanup 2025-10-20 20:17:40 -10:00
J. Nick Koston
b006f03080 more cleanup 2025-10-20 20:17:40 -10:00
J. Nick Koston
226d9a4796 more cleanup 2025-10-20 20:17:39 -10:00
J. Nick Koston
b9efaabdf0 more cleanup 2025-10-20 20:15:12 -10:00
J. Nick Koston
5b4e50d279 more cleanup 2025-10-20 20:13:20 -10:00
J. Nick Koston
8c115ab07b more cleanup 2025-10-20 20:12:51 -10:00
J. Nick Koston
cd2d3f061d [espnow] Fix compilation error with initializer_list after #11433 (#11436) 2025-10-20 19:58:24 -10:00
J. Nick Koston
ed94822174 Merge branch 'integration' into memory_api 2025-10-20 19:21:50 -10:00
J. Nick Koston
d36d695024 Merge remote-tracking branch 'upstream/esphome_missed' into integration 2025-10-20 19:21:43 -10:00
J. Nick Koston
f7bcf87213 more filter cleanups 2025-10-20 19:13:20 -10:00
J. Nick Koston
9ee0e20aa8 [espnow] Fix compilation error with initializer_list after #11433 2025-10-20 19:11:16 -10:00
J. Nick Koston
1808d43fce Merge branch 'integration' into memory_api 2025-10-20 18:47:01 -10:00
J. Nick Koston
3ccc1aea03 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-20 18:46:44 -10:00
J. Nick Koston
73f5d01c2d [core] Optimize automation actions memory usage with std::initializer_list (#11433) 2025-10-21 04:32:58 +00:00
Jesse Hills
0938609f7a [improv] Put next_url behind defines to save flash (#11420)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-21 16:58:26 +13:00
J. Nick Koston
77203f0cb4 [text_sensor] Optimize filters with FixedVector (1.6KB flash savings) (#11423)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-21 03:24:51 +00:00
J. Nick Koston
ec7c3add9b Merge branch 'integration' into memory_api 2025-10-20 17:07:00 -10:00
J. Nick Koston
e2da893bf3 Merge branch 'automations_init' into integration 2025-10-20 17:06:54 -10:00
J. Nick Koston
6fe533eddb [core] Optimize automation actions memory usage with std::initializer_list 2025-10-20 17:04:32 -10:00
J. Nick Koston
040130e357 [ci] Fix memory impact workflow for new components (#11421) 2025-10-21 16:02:07 +13:00
J. Nick Koston
85959e3004 [sensor,text_sensor,binary_sensor] Optimize filter parameters with std::initializer_list (#11426) 2025-10-21 15:47:13 +13:00
Jonathan Swoboda
a809a13729 [core] Add support for extern "C" includes (#11422) 2025-10-21 15:46:50 +13:00
J. Nick Koston
3b6ff615e8 [ci] Fix clang-tidy split decision to account for component dependencies (#11430) 2025-10-21 15:39:15 +13:00
J. Nick Koston
05216db5f0 ESP8266: Complete testing mode memory patches with DRAM and Flash (#11427) 2025-10-21 15:26:49 +13:00
J. Nick Koston
9f668b0c4b Add basic text_sensor tests (#11424) 2025-10-21 15:26:41 +13:00
J. Nick Koston
fe0b2daec1 Merge branch 'integration' into memory_api 2025-10-20 15:34:39 -10:00
J. Nick Koston
b6f8f2ac8d Merge branch 'sensor_init_cleanup' into integration 2025-10-20 15:34:33 -10:00
J. Nick Koston
1758008b91 Merge branch 'esp8266_size_testing_mode' into integration 2025-10-20 15:34:26 -10:00
J. Nick Koston
c2147a57f1 bot review 2025-10-20 15:30:04 -10:00
J. Nick Koston
4e629dfd89 wip 2025-10-20 15:21:40 -10:00
J. Nick Koston
09951d190c wip 2025-10-20 15:21:11 -10:00
J. Nick Koston
6a042188c1 wip 2025-10-20 15:19:40 -10:00
J. Nick Koston
5bd7342ff4 wip 2025-10-20 15:19:06 -10:00
J. Nick Koston
ce6d0cd846 tweak 2025-10-20 15:17:49 -10:00
J. Nick Koston
5b56807329 wip 2025-10-20 15:11:43 -10:00
J. Nick Koston
3847989c0f wip 2025-10-20 15:10:49 -10:00
J. Nick Koston
b698b45809 [sensor,text_sensor,binary_sensor] Optimize filter parameters with std::initializer_list 2025-10-20 14:11:49 -10:00
J. Nick Koston
a91fe2c4c3 Merge branch 'integration' into memory_api 2025-10-20 13:39:58 -10:00
J. Nick Koston
0daeb0ae34 Merge branch 'text_sensor_filters' into integration 2025-10-20 13:39:53 -10:00
J. Nick Koston
54b925e325 Merge remote-tracking branch 'upstream/text_sensor_filters' into text_sensor_filters 2025-10-20 13:27:51 -10:00
J. Nick Koston
6c8c049c08 dry 2025-10-20 13:27:36 -10:00
J. Nick Koston
aa7da775f1 Merge branch 'text_sensor_tests' into text_sensor_filters 2025-10-20 13:01:02 -10:00
J. Nick Koston
d13b50077f Add basic text_sensor tests 2025-10-20 13:00:15 -10:00
J. Nick Koston
c34a57df7b text_sensor filters 2025-10-20 12:48:27 -10:00
J. Nick Koston
6a239f4d1c [ci] Prefer platform-specific tests for memory impact analysis (#11398) 2025-10-21 10:25:33 +13:00
J. Nick Koston
ffb0e854b6 [ci] Optimize clang-tidy for small PRs by avoiding unnecessary job spitting (#11402)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 10:24:46 +13:00
Jonathan Swoboda
6fbd0e3385 [esp32_hosted] Bump esp hosted (#11414) 2025-10-20 11:12:07 -10:00
dependabot[bot]
426511e78d Bump actions/download-artifact from 4.3.0 to 5.0.0 (#11419)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-20 11:11:15 -10:00
dependabot[bot]
97d91fee85 Bump pylint from 4.0.1 to 4.0.2 (#11418)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-20 11:10:33 -10:00
J. Nick Koston
0f4b54aa82 [esp32_improv, improv_base] Reduce flash usage by 352 bytes (#11406) 2025-10-20 11:07:39 -10:00
J. Nick Koston
1706a69fad [sensor] Optimize filter memory usage with ValueListFilter base class (#11407)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 09:38:49 +13:00
J. Nick Koston
e23d66a8cf [esp32] Automatic CONFIG_LWIP_MAX_SOCKETS configuration based on component needs (#11378) 2025-10-21 09:38:34 +13:00
J. Nick Koston
46101fd830 Add tests for FilterOutValueFilter and ThrottleWithPriorityFilter (#11408)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-20 09:25:03 -10:00
J. Nick Koston
e988905c2f [json] Add basic compile tests (#11409)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-21 07:31:59 +13:00
Patrick
abb57f08f5 [pipsolar] cleanup / refactoring (#10291)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-20 17:08:31 +00:00
EasilyBoredEngineer
ca2fe994a1 [espnow] Add transport platform for packet_transport (#11025)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-20 10:44:20 -04:00
Peter Zich
03def13917 [hdc1080] Make HDC1080_CMD_CONFIGURATION failure a warning (and log it) (#11355)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-20 09:13:13 -04:00
Keith Burzinski
63f100a8ca [bang_bang] Various clean-up (#11356) 2025-10-19 22:56:25 -10:00
Juan Antonio Aldea
ea4e5fd7bd [climate] Migrate components to the new API (#11369)
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
2025-10-19 22:20:39 -10:00
Enrico Galli
12e9c5e60e [epaper_spi] Fix busy pin logic (#11349)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-20 19:11:09 +13:00
Aman kumar
3d82c5baf7 [esp32_improv]: add next_url support for WiFi provisioning (#10757)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-20 19:10:38 +13:00
Keith Burzinski
6f5e36ffc3 [climate] First pass at some optimization (#11366)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-19 23:42:54 -05:00
Grant Le Roux
118b1d8593 MQTT Light - Min/Max Color Temperature (#11103)
Co-authored-by: Cram42 <5396871+cram42@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-20 17:05:05 +13:00
Jesse Hills
319ba4a504 [cover] Clean up deprecated functions from 2021.9 (#11391) 2025-10-20 04:03:09 +00:00
J. Nick Koston
ae8336c268 [esp32][ci] Fix IRAM overflow in grouped component tests for ESP32-IDF (#11386) 2025-10-20 03:58:03 +00:00
J. Nick Koston
1b38518c63 [tests] Fix flaky test_noise_corrupt_encrypted_frame integration test (#11405) 2025-10-20 03:45:44 +00:00
J. Nick Koston
c00977df54 [climate] Add basic compile tests for climate component (#11404) 2025-10-20 03:27:04 +00:00
J. Nick Koston
255b5a3abd [ci] Skip memory analysis when only Python/config files change in core (#11397) 2025-10-20 16:13:08 +13:00
Clyde Stubbs
dd732dd155 [mipi_rgb] Add Waveshare 5" 1024x600 (#11206) 2025-10-20 14:09:36 +11:00
Jesse Hills
22fec4329f [fan] Clean up deprecated code from 2022.2 (#11392) 2025-10-20 03:02:03 +00:00
Stefan Rado
8f1c4634ec [uponor_smatrix] Use combined 32 bit addresses instead of separate 16 bit system and device addresses (#11066)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-19 16:49:06 -10:00
tomaszduda23
c15f1a9be8 [nrf52] add missing defines for tests (#11384)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-19 16:11:44 -10:00
J. Nick Koston
11b53096a6 [ci] Fix fork PR workflow failing to find PRs from forks (#11396) 2025-10-19 15:58:05 -10:00
J. Nick Koston
6a18367949 [cli] Add analyze-memory command (#11395)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-20 14:26:37 +13:00
Javier Peletier
a59b1494d8 [substitutions] Recursive substitutions and better jinja error handling and debug help (#10806) 2025-10-20 14:17:16 +13:00
Jesse Hills
e6ce5c58d1 Merge branch 'release' into dev 2025-10-20 13:43:31 +13:00
Jesse Hills
ebc0f5f7c9 Merge pull request #11387 from esphome/bump-2025.10.2
2025.10.2
2025-10-20 13:42:48 +13:00
Juan Antonio Aldea
0f87e7508b remove hexencode due 2022.1 deprecation (#11383) 2025-10-19 13:09:28 -10:00
J. Nick Koston
862bbb7fe1 [ci] Fix memory impact analysis failing on fork PRs (#11380)
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>
2025-10-19 13:09:09 -10:00
J. Nick Koston
e7ba19b3ea Merge branch 'integration' into memory_api 2025-10-19 12:53:45 -10:00
J. Nick Koston
0dc08941f4 Merge branch 'dev' into integration 2025-10-19 12:53:31 -10:00
Jesse Hills
020cea80b2 [nextion] Clean up deprecated code from 1.20 (#11393) 2025-10-19 22:16:50 +00:00
Jesse Hills
9c146a7070 [climate] Clean up deprecated functions from 1.20 (#11388) 2025-10-19 22:11:35 +00:00
Jesse Hills
afbd3f77af [light] Clean up deprecated functions from 1.21 (#11389) 2025-10-19 22:08:30 +00:00
Javier Peletier
1e1fefbd0a [substitutions] !extend and !remove now support substitutions and jinja (#11203) 2025-10-20 10:31:25 +13:00
Juan Antonio Aldea
1a2057df30 Migrate from hexencode() to format_hex_pretty() in Kuntze component (#11372) 2025-10-20 10:15:17 +13:00
J. Nick Koston
87ca8784ef [openthread] Backport address resolution support to prevent OTA crash (#11312)
Co-authored-by: Daniel Stiner <danstiner@gmail.com>
2025-10-20 10:12:56 +13:00
Jesse Hills
a186c1062f Bump version to 2025.10.2 2025-10-20 10:06:43 +13:00
Jonathan Swoboda
ea38237f29 [esp32] Fix OTA rollback (#11300)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-20 10:06:43 +13:00
J. Nick Koston
6aff1394ad [core] Fix IndexError when OTA devices cannot be resolved (#11311) 2025-10-20 10:06:43 +13:00
Spectre5
0e34d1b64d Change all temperature offsets to temperature_delta (#11347) 2025-10-20 10:06:43 +13:00
tomaszduda23
1483cee0fb [dashboard] fix migration to Path (#11342)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-20 10:06:43 +13:00
J. Nick Koston
8c1bd2fd85 [dashboard] Fix binary download with packages using secrets after Path migration (#11313) 2025-10-20 10:06:43 +13:00
Daniel Stiner
ea609dc0f6 [const] Add CONF_OPENTHREAD (#11318) 2025-10-20 10:06:42 +13:00
Jonathan Swoboda
913095f6be [esp32] Reduce tx power on Arduino (#11304) 2025-10-20 10:06:42 +13:00
Jonathan Swoboda
bb24ad4a30 [htu21d] Revert register address change (#11291) 2025-10-20 10:06:42 +13:00
Jonathan Swoboda
0d612fecfc [core] Add ESP32 ROM functions to reserved ids (#11293) 2025-10-20 10:06:42 +13:00
J. Nick Koston
9c235b4140 [datetime] Fix DateTimeStateTrigger compilation when time component is not used (#11287) 2025-10-20 10:06:42 +13:00
J. Nick Koston
70cb1793f3 [wifi] Optimize WiFi scan results with in-place construction (#11330) 2025-10-19 19:53:05 +00:00
J. Nick Koston
3bdd351d49 [wifi] Convert fast_connect to compile-time define, save 156-1024 bytes flash (#11328) 2025-10-19 19:52:33 +00:00
Jonathan Swoboda
b0ea3f57de [esp32] Fix OTA rollback (#11300)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-19 09:49:05 -10:00
J. Nick Koston
c9312d5c27 [script] Fix unbounded queue growth, optimize queued mode (default max_runs=5) (#11308)
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>
2025-10-19 09:42:17 -10:00
J. Nick Koston
82f7b7f0d5 debug 2025-10-19 09:41:04 -10:00
J. Nick Koston
db5c78acb9 preen 2025-10-19 09:36:55 -10:00
J. Nick Koston
0b45e1d608 Merge branch 'integration' into memory_api 2025-10-19 09:36:02 -10:00
J. Nick Koston
aa6b7664f4 Merge branch 'dev' into integration 2025-10-19 09:35:53 -10:00
J. Nick Koston
33fea90c19 [wifi] Optimize WiFi scanning to reduce copies and heap allocations (#11323) 2025-10-19 19:26:18 +00:00
J. Nick Koston
25f3b6a959 [mqtt] Reduce flash usage by optimizing ArduinoJson assignments (#11340) 2025-10-19 19:17:33 +00:00
J. Nick Koston
e993312640 [core] Fix IndexError when OTA devices cannot be resolved (#11311) 2025-10-20 08:15:47 +13:00
J. Nick Koston
85babe85e4 [sensor] Optimize sliding window filters to eliminate heap fragmentation (#11282) 2025-10-20 07:59:47 +13:00
J. Nick Koston
0266c897c9 [mdns] Use std::unique_ptr for TXT records to reduce ESP32 flash usage (#11362) 2025-10-20 07:53:00 +13:00
J. Nick Koston
bda7676e3a [bluetooth_proxy] Merge duplicate loops in get_connection_() (#11359) 2025-10-20 07:51:41 +13:00
J. Nick Koston
57e98ec3fc [wifi] Replace std::vector with std::unique_ptr for WiFi scan buffer (#11364) 2025-10-20 07:49:58 +13:00
J. Nick Koston
09b2ad071b [esp32_ble_client] Remove duplicate MAC address extraction in set_address() (#11358) 2025-10-20 07:49:13 +13:00
J. Nick Koston
fdecda3d65 [light] Use bitmask instead of std::set for color modes (#11348) 2025-10-20 07:48:14 +13:00
J. Nick Koston
453a668cfb Merge branch 'integration' into memory_api 2025-10-19 08:46:39 -10:00
J. Nick Koston
4e234c354b Merge branch 'max_socket_listen' into integration 2025-10-19 08:46:32 -10:00
J. Nick Koston
a0922bc8b0 [ci] Add automated memory impact analysis for pull requests (#11242)
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>
2025-10-20 07:43:38 +13:00
J. Nick Koston
4fa908d0b8 preen 2025-10-19 08:43:30 -10:00
J. Nick Koston
148a78aa01 preen 2025-10-19 08:41:21 -10:00
J. Nick Koston
7107f5d984 preen 2025-10-19 08:40:01 -10:00
J. Nick Koston
55473991a9 preen 2025-10-19 08:37:43 -10:00
J. Nick Koston
1586a185a0 [esp32] Automatic CONFIG_LWIP_MAX_SOCKETS configuration based on component needs 2025-10-19 08:34:38 -10:00
J. Nick Koston
f25af18655 [scheduler] Replace defer queue deque with vector to avoid 512-byte upfront allocation (#11305) 2025-10-20 07:34:34 +13:00
J. Nick Koston
5db07c2d70 [api][time] Refactor timezone update logic for cleaner code (#11327) 2025-10-20 07:31:40 +13:00
J. Nick Koston
ae0c3875fc Merge branch 'integration' into memory_api 2025-10-19 08:02:39 -10:00
J. Nick Koston
a0bd7d100b Merge remote-tracking branch 'upstream/dev' into integration 2025-10-19 08:02:33 -10:00
Juan Antonio Aldea
40823df7bc make types sensors_t and sensor_type_t internal to StatsdComponent. (#11345) 2025-10-19 07:47:31 -10:00
tomaszduda23
5e1019a6fa [nrf52, ble_nus] add logging over BLE (#9846) 2025-10-19 07:41:19 -10:00
tomaszduda23
f3cdbd0a05 [nrf52] fix task names in logs (#11367) 2025-10-19 07:39:48 -10:00
J. Nick Koston
c3b652b977 Merge branch 'integration' into memory_api 2025-10-18 22:43:58 -10:00
J. Nick Koston
4de6bf9d3d Merge branch 'unbound_queued_script_fix' into integration 2025-10-18 22:43:36 -10:00
J. Nick Koston
428240d538 Merge branch 'min_filter_ring_buffer' into integration 2025-10-18 22:43:27 -10:00
J. Nick Koston
3da9139db4 Merge branch 'ci_impact_analysis' into integration 2025-10-18 22:43:24 -10:00
J. Nick Koston
504c2b9dfd Merge branch 'ci_impact_analysis' into memory_api 2025-10-18 22:43:09 -10:00
J. Nick Koston
314fe77b8d Merge branch 'min_filter_ring_buffer' into memory_api 2025-10-18 22:42:55 -10:00
J. Nick Koston
8686d05d05 Merge branch 'unbound_queued_script_fix' into memory_api 2025-10-18 22:42:50 -10:00
J. Nick Koston
be3dacfe64 Merge branch 'mqtt_reduce_json_assign' into memory_api 2025-10-18 22:42:45 -10:00
J. Nick Koston
3f7e22e271 Merge branch 'integration' into memory_api 2025-10-18 22:24:32 -10:00
J. Nick Koston
714fafff4c Merge remote-tracking branch 'upstream/dev' into integration 2025-10-18 22:24:24 -10:00
J. Nick Koston
a28b85c3fa Merge branch 'dev' of https://github.com/esphome/esphome into memory_api 2025-10-18 22:23:32 -10:00
J. Nick Koston
1010006b5e Merge branch 'dev' into mqtt_reduce_json_assign 2025-10-18 22:16:33 -10:00
J. Nick Koston
9fc3ad1fa5 bot 2025-10-18 22:16:09 -10:00
Keith Burzinski
ddf1b67e49 [prometheus] Update to use new climate API (#11361) 2025-10-18 22:11:44 -10:00
Keith Burzinski
b4d9fddd07 [mqtt] Update to use new climate API (#11360) 2025-10-18 22:11:10 -10:00
Keith Burzinski
25f03074ab [web_server] Update to use new climate API (#11363) 2025-10-18 22:10:07 -10:00
J. Nick Koston
70479dec0d suggestions 2025-10-18 21:57:19 -10:00
J. Nick Koston
acdecafeef suggestions 2025-10-18 21:55:25 -10:00
J. Nick Koston
bf40bc3b25 Merge remote-tracking branch 'upstream/unbound_queued_script_fix' into unbound_queued_script_fix 2025-10-18 21:54:27 -10:00
J. Nick Koston
32a1e45842 suggestions 2025-10-18 21:54:20 -10:00
J. Nick Koston
498dece382 suggestions 2025-10-18 21:54:05 -10:00
pre-commit-ci-lite[bot]
e0477e3bb1 [pre-commit.ci lite] apply automatic fixes 2025-10-19 07:53:21 +00:00
J. Nick Koston
7bb222a574 Update esphome/components/script/script.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-18 21:51:51 -10:00
J. Nick Koston
9a3b5ec090 Merge remote-tracking branch 'upstream/dev' into min_filter_ring_buffer 2025-10-18 21:49:13 -10:00
J. Nick Koston
f5e5f4ef06 preen 2025-10-18 21:47:03 -10:00
J. Nick Koston
8d338610a9 Merge remote-tracking branch 'upstream/unbound_queued_script_fix' into unbound_queued_script_fix 2025-10-18 21:45:16 -10:00
J. Nick Koston
0e513b41e4 preen 2025-10-18 21:45:02 -10:00
J. Nick Koston
f7ebef83f2 Merge branch 'dev' into unbound_queued_script_fix 2025-10-18 21:34:51 -10:00
J. Nick Koston
f387d9ec50 unique ptr 2025-10-18 21:33:38 -10:00
J. Nick Koston
fc2c55b642 Merge branch 'integration' into memory_api 2025-10-18 21:26:22 -10:00
J. Nick Koston
fd0384eec4 Merge branch 'esp32_mdns_fixed_vector' into integration 2025-10-18 21:26:12 -10:00
J. Nick Koston
13292809a2 Merge branch 'dev' into esp32_mdns_fixed_vector 2025-10-18 21:22:50 -10:00
J. Nick Koston
f036e894c8 adjust 2025-10-18 21:18:11 -10:00
J. Nick Koston
0a17893686 Merge remote-tracking branch 'upstream/ci_impact_analysis' into ci_impact_analysis 2025-10-18 21:08:39 -10:00
J. Nick Koston
7dd7a23977 Merge remote-tracking branch 'upstream/dev' into ci_impact_analysis 2025-10-18 21:08:26 -10:00
J. Nick Koston
cfcc6e22e0 Merge branch 'integration' into memory_api 2025-10-18 21:01:21 -10:00
J. Nick Koston
4ea4359553 Merge branch 'wifi_no_vector_for_simple_array' into integration 2025-10-18 21:01:12 -10:00
J. Nick Koston
53d7b4f433 [wifi] Replace std::vector with std::unique_ptr for WiFi scan buffer 2025-10-18 21:00:45 -10:00
J. Nick Koston
e52eeb528d Merge branch 'integration' into memory_api 2025-10-18 20:45:19 -10:00
J. Nick Koston
61adb2545e Merge branch 'esp32_mdns_fixed_vector' into integration 2025-10-18 20:45:01 -10:00
J. Nick Koston
6d1288c806 [mdns] Use FixedVector for TXT records to reduce ESP32 flash usage 2025-10-18 20:44:36 -10:00
J. Nick Koston
c8b2cf1ceb Merge branch 'integration' into memory_api 2025-10-18 20:21:22 -10:00
J. Nick Koston
4b6384c63b Merge branch 'get_connection_single_loop' into integration 2025-10-18 20:21:16 -10:00
J. Nick Koston
071bdfa67f [bluetooth_proxy] Merge duplicate loops in get_connection_() 2025-10-18 20:20:51 -10:00
Keith Burzinski
590f6ff70b [api] Update to use new climate API (#11357) 2025-10-19 06:20:11 +00:00
J. Nick Koston
a236f1c6d1 Merge branch 'integration' into memory_api 2025-10-18 20:05:56 -10:00
J. Nick Koston
d600cbf42a Merge branch 'esp32_ble_client_dupe_mac_build' into integration 2025-10-18 20:05:49 -10:00
J. Nick Koston
b378038253 [esp32_ble_client] Remove duplicate MAC address extraction in set_address() 2025-10-18 20:05:22 -10:00
J. Nick Koston
d695c99dbe Merge branch 'integration' into memory_api 2025-10-18 19:50:34 -10:00
J. Nick Koston
b230551bb3 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-18 19:50:26 -10:00
Keith Burzinski
a33ed5e47b [thermostat] Add humidity support (#11286) 2025-10-18 17:25:53 -10:00
J. Nick Koston
48718ffe06 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-18 16:56:40 -10:00
Spectre5
c11a9bb97f Change all temperature offsets to temperature_delta (#11347) 2025-10-18 21:13:57 -04:00
J. Nick Koston
84b69a5766 Merge branch 'dev' into ci_impact_analysis 2025-10-18 15:12:46 -10:00
J. Nick Koston
eb45427d07 Merge branch 'integration' into memory_api 2025-10-18 14:58:13 -10:00
J. Nick Koston
d817461f11 Merge branch 'light_bitmask' into integration 2025-10-18 14:58:06 -10:00
J. Nick Koston
f7d52a342b review comments 2025-10-18 14:42:12 -10:00
J. Nick Koston
76ad649bf9 review comments 2025-10-18 14:41:59 -10:00
J. Nick Koston
35f8dc528d Merge branch 'integration' into memory_api 2025-10-18 14:26:11 -10:00
J. Nick Koston
d0fa64e419 Merge branch 'light_bitmask' into integration 2025-10-18 14:26:06 -10:00
J. Nick Koston
437dd503ca more cover 2025-10-18 14:21:52 -10:00
J. Nick Koston
1381db37ad preen 2025-10-18 14:18:17 -10:00
J. Nick Koston
32eb43fd02 preen 2025-10-18 14:14:48 -10:00
J. Nick Koston
764428870d reduce diff 2025-10-18 14:11:23 -10:00
J. Nick Koston
f2d01ecd6c dry 2025-10-18 13:58:52 -10:00
J. Nick Koston
f1086b13af Merge branch 'dev' into light_bitmask 2025-10-18 13:53:38 -10:00
J. Nick Koston
2cdfd04204 dry 2025-10-18 13:53:05 -10:00
J. Nick Koston
a249c9c282 preen 2025-10-18 13:46:49 -10:00
J. Nick Koston
8545b5231b preen 2025-10-18 13:38:45 -10:00
J. Nick Koston
1c8b60891c simplify 2025-10-18 13:32:48 -10:00
J. Nick Koston
44d3f355a5 overkill 2025-10-18 13:16:52 -10:00
J. Nick Koston
cc6b798f2b overkill 2025-10-18 13:15:47 -10:00
J. Nick Koston
80fd51e198 preen 2025-10-18 13:14:05 -10:00
J. Nick Koston
ec8d8538f6 preen 2025-10-18 13:12:48 -10:00
dependabot[bot]
acef2085d9 Bump aioesphomeapi from 42.1.0 to 42.2.0 (#11352)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-18 23:11:36 +00:00
J. Nick Koston
89c719d71d preen 2025-10-18 13:10:41 -10:00
J. Nick Koston
89903929f3 preen 2025-10-18 13:05:59 -10:00
J. Nick Koston
3ef402ef64 cover 2025-10-18 12:38:02 -10:00
J. Nick Koston
e7bc2b0a44 Merge branch 'light_bitmask' into memory_api 2025-10-18 12:35:33 -10:00
J. Nick Koston
e27472b87d fixes 2025-10-18 12:35:13 -10:00
J. Nick Koston
f3c1733662 Merge branch 'integration' into memory_api 2025-10-18 12:07:32 -10:00
J. Nick Koston
f3777b6171 Merge branch 'light_bitmask' into integration 2025-10-18 12:07:19 -10:00
J. Nick Koston
753bebdde8 fix 2025-10-18 12:02:52 -10:00
J. Nick Koston
f88cc33cfc fix 2025-10-18 12:01:57 -10:00
J. Nick Koston
02b626ae1a fix 2025-10-18 12:00:29 -10:00
J. Nick Koston
94414e767c Merge remote-tracking branch 'origin/light_bitmask' into light_bitmask 2025-10-18 11:56:57 -10:00
J. Nick Koston
ef52ce4d76 [api_protobuf] Address copilot review: add bounds checking and clarify 32-bit loop intent
- Add bounds checking in decode_varint_content to prevent undefined behavior if decoded enum value exceeds 31
- Add clarifying comments that 32-bit loops in encode_content and get_size_calculation are intentional to support the full range of enum_as_bitmask (enums with up to 32 values)
- The uint32_t storage type supports general-purpose enum_as_bitmask, not just ColorMode's 10 values
2025-10-18 11:56:40 -10:00
J. Nick Koston
018e28a137 Merge branch 'dev' into light_bitmask 2025-10-18 11:48:38 -10:00
dependabot[bot]
865663ce5f Bump aioesphomeapi from 42.0.0 to 42.1.0 (#11350)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-18 11:48:25 -10:00
J. Nick Koston
efc98e9a2c Merge branch 'integration' into memory_api 2025-10-18 11:10:35 -10:00
J. Nick Koston
6632cfc177 Merge branch 'light_bitmask' into integration 2025-10-18 11:10:10 -10:00
J. Nick Koston
27b876df93 preen 2025-10-18 10:52:42 -10:00
J. Nick Koston
596ce59991 dead code 2025-10-18 10:42:51 -10:00
J. Nick Koston
13e9d0c851 fix 2025-10-18 10:41:52 -10:00
J. Nick Koston
a0008d6f44 fix 2025-10-18 10:41:37 -10:00
J. Nick Koston
bb03d73106 Merge branch 'integration' into memory_api 2025-10-18 10:36:13 -10:00
J. Nick Koston
654dd64850 Merge branch 'light_bitmask' into integration 2025-10-18 10:36:08 -10:00
J. Nick Koston
98df9fd2ff preen 2025-10-18 10:32:20 -10:00
J. Nick Koston
cfb061abc4 preen 2025-10-18 10:29:08 -10:00
J. Nick Koston
957b5e98a7 comment 2025-10-18 10:18:34 -10:00
J. Nick Koston
599e636468 comment 2025-10-18 10:17:52 -10:00
J. Nick Koston
2dc6c56edc align 2025-10-18 10:15:32 -10:00
J. Nick Koston
c0c30ba22d tweak 2025-10-18 10:02:45 -10:00
J. Nick Koston
b01ab914f3 tweak 2025-10-18 10:01:39 -10:00
J. Nick Koston
c76e386a79 no vector 2025-10-18 09:59:24 -10:00
J. Nick Koston
6a96e0ee90 [light] Use bitmask instead of std::set for color modes 2025-10-18 09:38:37 -10:00
tomaszduda23
ae010fd6f1 [dashboard] fix migration to Path (#11342)
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-18 17:32:12 +00:00
J. Nick Koston
455e8bb059 Merge branch 'dev' into min_filter_ring_buffer 2025-10-18 06:47:44 -10:00
J. Nick Koston
91a10d0e36 [total_daily_energy] Fix ID conflicts in component test configuration (#11337) 2025-10-18 08:36:30 -04:00
J. Nick Koston
5ad22620c9 [mqtt] Reduce flash usage by optimizing ArduinoJson assignments 2025-10-17 23:35:52 -10:00
J. Nick Koston
e200f82d7a fixes 2025-10-17 21:48:03 -10:00
J. Nick Koston
d18a0888e9 Merge branch 'integration' into memory_api 2025-10-17 21:44:48 -10:00
J. Nick Koston
f2a63a7a56 Merge branch 'ci_impact_analysis' into integration
Resolved conflict in esphome/platformio_api.py:
- Kept refactored objdump_path and readelf_path from ci_impact_analysis
- Preserved analyze_memory_usage function from integration branch
2025-10-17 21:44:21 -10:00
J. Nick Koston
4dd1f51246 Merge branch 'integration' into memory_api 2025-10-17 21:41:47 -10:00
J. Nick Koston
74c9d0586a Merge branch 'min_filter_ring_buffer' into integration 2025-10-17 21:41:40 -10:00
Juan Antonio Aldea
d5c36eaf2a [tests] Remove superfluous else-blocks from lambdas (#11322)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-17 21:40:54 -10:00
J. Nick Koston
fd32f6930e Merge remote-tracking branch 'upstream/dev' into min_filter_ring_buffer 2025-10-17 21:04:24 -10:00
J. Nick Koston
b4ae85cf0f cleanup sorting 2025-10-17 21:03:51 -10:00
J. Nick Koston
7f38987c60 Merge branch 'integration' into memory_api 2025-10-17 19:24:31 -10:00
J. Nick Koston
d13ca46a30 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-17 19:24:23 -10:00
J. Nick Koston
e70cb098ae whitespace 2025-10-17 18:50:07 -10:00
J. Nick Koston
7f2d8a2c11 whitespace 2025-10-17 18:46:41 -10:00
J. Nick Koston
4f4da1de22 preen 2025-10-17 18:41:12 -10:00
J. Nick Koston
f9807db08a preen 2025-10-17 18:37:24 -10:00
J. Nick Koston
541fb8b27c update test 2025-10-17 18:32:22 -10:00
J. Nick Koston
85e0a4fbf9 update test 2025-10-17 18:29:36 -10:00
J. Nick Koston
7e54803ede update test 2025-10-17 18:25:41 -10:00
J. Nick Koston
a078486a87 update test 2025-10-17 18:21:28 -10:00
J. Nick Koston
ba18bb6a4f template all the things 2025-10-17 18:18:15 -10:00
J. Nick Koston
07ad32968e template all the things 2025-10-17 18:15:46 -10:00
J. Nick Koston
0b077bdfc6 preen 2025-10-17 18:08:52 -10:00
J. Nick Koston
1f00617738 Merge remote-tracking branch 'upstream/ci_impact_analysis' into ci_impact_analysis 2025-10-17 18:06:44 -10:00
J. Nick Koston
9cf1fd24fd preen 2025-10-17 18:06:13 -10:00
pre-commit-ci-lite[bot]
bbd636a8cc [pre-commit.ci lite] apply automatic fixes 2025-10-18 03:59:23 +00:00
J. Nick Koston
322dc530a9 Merge remote-tracking branch 'origin/ci_impact_analysis' into ci_impact_analysis 2025-10-17 17:58:05 -10:00
J. Nick Koston
0b09e50685 preen 2025-10-17 17:57:42 -10:00
J. Nick Koston
a96cc5e6f2 Update esphome/analyze_memory/__init__.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-17 17:57:33 -10:00
J. Nick Koston
9a4288d81a Update script/determine-jobs.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-17 17:56:41 -10:00
J. Nick Koston
b95999aca7 Update esphome/analyze_memory/__init__.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-17 17:55:37 -10:00
J. Nick Koston
c70937ed01 dry 2025-10-17 17:55:05 -10:00
J. Nick Koston
3151606d50 Merge branch 'dev' into ci_impact_analysis 2025-10-17 17:47:36 -10:00
J. Nick Koston
5080698c3a no memory when tatget branch does not have 2025-10-17 17:34:16 -10:00
J. Nick Koston
931e3f80f0 no memory when tatget branch does not have 2025-10-17 17:25:14 -10:00
J. Nick Koston
85f1019d90 [tests] Migrate remote_transmitter/receiver to common bus definitions (#11325) 2025-10-17 17:21:38 -10:00
J. Nick Koston
cd93f7f55a tweak 2025-10-17 17:13:24 -10:00
J. Nick Koston
d98b00f56d tweak 2025-10-17 17:10:28 -10:00
J. Nick Koston
8fd43f1d96 tweak 2025-10-17 17:09:05 -10:00
J. Nick Koston
0475ec5533 preen 2025-10-17 17:01:20 -10:00
J. Nick Koston
6fe5a0c736 preen 2025-10-17 16:44:38 -10:00
J. Nick Koston
1ec9383abe preen 2025-10-17 16:39:10 -10:00
J. Nick Koston
5e1ee92754 add tests 2025-10-17 16:34:25 -10:00
J. Nick Koston
558d4eb9dd preen 2025-10-17 16:19:50 -10:00
J. Nick Koston
c6ecfd0c55 esp32 only platforms 2025-10-17 16:15:46 -10:00
J. Nick Koston
3b8b2c0754 esp32 only platforms 2025-10-17 16:13:30 -10:00
J. Nick Koston
f5d69a2539 esp32 only platforms 2025-10-17 16:11:28 -10:00
J. Nick Koston
29b9073d62 esp32 only platforms 2025-10-17 16:08:16 -10:00
J. Nick Koston
a45e94cd06 preen 2025-10-17 16:02:08 -10:00
J. Nick Koston
71f2fb8353 preen 2025-10-17 15:56:13 -10:00
J. Nick Koston
0fcae15c25 preen 2025-10-17 15:53:03 -10:00
J. Nick Koston
a1d6bac21a preen 2025-10-17 15:44:36 -10:00
J. Nick Koston
db69ce24ae fix 2025-10-17 15:41:20 -10:00
J. Nick Koston
293400ee14 fix 2025-10-17 15:35:51 -10:00
J. Nick Koston
57bf3f968f fix 2025-10-17 15:34:17 -10:00
J. Nick Koston
922c2bcd5a fix 2025-10-17 15:26:55 -10:00
J. Nick Koston
5e9b972831 fix 2025-10-17 15:24:49 -10:00
J. Nick Koston
3bc0041b94 fix 2025-10-17 15:22:06 -10:00
J. Nick Koston
daa03e5b3c fix 2025-10-17 15:17:28 -10:00
J. Nick Koston
62ce39e430 fix 2025-10-17 15:17:15 -10:00
J. Nick Koston
a9e5e4d6d2 tweak 2025-10-17 15:14:00 -10:00
Leonardo Rivera
bfeade1e2b [remote_base] Add Symphony IR protocol (encode/decode) with command_repeats support (#10777) 2025-10-17 21:13:33 -04:00
J. Nick Koston
95a0c9594f tweak 2025-10-17 15:12:36 -10:00
J. Nick Koston
8762d7cf0e Merge remote-tracking branch 'upstream/dev' into ci_impact_analysis 2025-10-17 15:06:15 -10:00
J. Nick Koston
84316d62f9 tweak 2025-10-17 15:04:19 -10:00
J. Nick Koston
e1e047c53f tweak 2025-10-17 15:02:09 -10:00
J. Nick Koston
b0ada914bc tweak 2025-10-17 14:57:45 -10:00
J. Nick Koston
e2101f5a20 tweak 2025-10-17 14:52:07 -10:00
Niall Douglas
b134d42e3b [xgzp68xx] Add oversampling config and tidy up implementation. (#10306)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-18 00:47:18 +00:00
J. Nick Koston
f87c969b43 tweak 2025-10-17 14:40:45 -10:00
J. Nick Koston
f011c44130 merge 2025-10-17 14:26:44 -10:00
J. Nick Koston
843f590db4 fix 2025-10-17 14:13:25 -10:00
J. Nick Koston
2c86ebaf7f merge 2025-10-17 14:10:23 -10:00
J. Nick Koston
25fe4a1476 merge 2025-10-17 14:09:08 -10:00
J. Nick Koston
86c12079b4 merge 2025-10-17 14:05:24 -10:00
J. Nick Koston
79aafe2cd5 merge 2025-10-17 14:01:21 -10:00
J. Nick Koston
a5d6e39b2f merge 2025-10-17 14:01:07 -10:00
J. Nick Koston
a78a7dfa4e merge 2025-10-17 13:58:59 -10:00
J. Nick Koston
7879df4dd1 merge 2025-10-17 13:57:57 -10:00
J. Nick Koston
43c62297e8 merge 2025-10-17 13:56:31 -10:00
J. Nick Koston
5049c7227d reduce 2025-10-17 13:50:15 -10:00
J. Nick Koston
256d3b119b relo 2025-10-17 13:44:30 -10:00
J. Nick Koston
6d2c700c43 relo 2025-10-17 13:43:05 -10:00
J. Nick Koston
9d081795e8 relo 2025-10-17 13:41:55 -10:00
J. Nick Koston
59848a2c8a tweak 2025-10-17 13:31:04 -10:00
J. Nick Koston
c7c408e667 tweak 2025-10-17 13:28:13 -10:00
J. Nick Koston
acfa325f23 merge 2025-10-17 13:22:01 -10:00
J. Nick Koston
cb97271704 Merge remote-tracking branch 'upstream/dev' into ci_impact_analysis 2025-10-17 13:19:47 -10:00
J. Nick Koston
b3b65316f0 [ci] Fix test_build_components missing test files with hyphen naming pattern (#11329) 2025-10-17 13:05:44 -10:00
J. Nick Koston
54163bb520 Merge branch 'integration' into memory_api 2025-10-17 12:39:47 -10:00
J. Nick Koston
fe2e598cfb Merge branch 'wifi_in_place' into integration 2025-10-17 12:39:39 -10:00
J. Nick Koston
ce1d10eff0 [wifi] Optimize WiFi scan results with in-place construction 2025-10-17 12:39:14 -10:00
J. Nick Koston
879ba5e090 Merge branch 'integration' into memory_api 2025-10-17 11:48:09 -10:00
J. Nick Koston
a0d9b4fdf9 Merge branch 'ci_missed_files' into integration 2025-10-17 11:48:04 -10:00
J. Nick Koston
de5894ca1a [ci] Fix test_build_components missing test files with hyphen naming pattern 2025-10-17 11:29:17 -10:00
J. Nick Koston
c26125c732 Merge branch 'integration' into memory_api 2025-10-17 11:20:53 -10:00
J. Nick Koston
1867831ff5 Merge branch 'fast_connect_cond_compile' into integration 2025-10-17 11:20:46 -10:00
J. Nick Koston
00dd48d1f8 tweak 2025-10-17 11:17:31 -10:00
J. Nick Koston
35bcc6ff8a missing guard 2025-10-17 10:54:50 -10:00
J. Nick Koston
63f9e1fde8 missing guard 2025-10-17 10:54:39 -10:00
J. Nick Koston
16a8645833 Merge branch 'integration' into memory_api 2025-10-17 10:41:20 -10:00
J. Nick Koston
320df90b6b Merge branch 'fast_connect_cond_compile' into integration 2025-10-17 10:41:15 -10:00
J. Nick Koston
3fce283053 [wifi] Convert fast_connect to compile-time define, save 608-1024 bytes flash 2025-10-17 10:40:28 -10:00
J. Nick Koston
2eeb9d097f Merge branch 'integration' into memory_api 2025-10-17 09:40:31 -10:00
J. Nick Koston
4f4714cec2 Merge branch 'set_timezone_cleanup' into integration 2025-10-17 09:40:26 -10:00
J. Nick Koston
6dd0020bf6 [api][time] Refactor timezone update logic for cleaner code 2025-10-17 09:39:51 -10:00
J. Nick Koston
2ad80d2208 tweak 2025-10-17 09:29:58 -10:00
dependabot[bot]
b61cec8e77 Bump github/codeql-action from 4.30.8 to 4.30.9 (#11326)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-17 09:14:45 -10:00
J. Nick Koston
7220d25a4d Merge branch 'integration' into memory_api 2025-10-17 09:07:34 -10:00
J. Nick Koston
c769b6fdf7 Merge branch 'ota_fix' into integration 2025-10-17 09:07:25 -10:00
J. Nick Koston
5918db6012 Merge branch 'integration' into memory_api 2025-10-17 09:01:59 -10:00
J. Nick Koston
f65235be3a Merge branch 'wifi_scans_less_copies' into integration 2025-10-17 09:01:53 -10:00
Jonathan Swoboda
24243fb22c [tests] Add i2c_id to mcp47a1 & mcp4725 and remove from isolation (#11324) 2025-10-17 08:23:49 -10:00
J. Nick Koston
ba6c8c87c2 [dashboard] Fix binary download with packages using secrets after Path migration (#11313) 2025-10-17 08:20:55 -10:00
J. Nick Koston
f5774cc138 [debug] Replace std::map with struct array for ESP32 chip features (#11307) 2025-10-17 08:20:31 -10:00
J. Nick Koston
6722e5c8d8 [wifi] Optimize WiFi scanning to reduce copies and heap allocations 2025-10-17 07:43:24 -10:00
B48D81EFCC
6d09e68b2e [bh1900nux] Add bh1900nux temperature Sensor (#8631)
Co-authored-by: Jesse Hills <3060199+jesserockz@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: Andreas Riehl <andreas.riehl@acp.de>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-17 11:11:51 -04:00
tomaszduda23
fe9db75c27 [nrf52] add xiao_ble board (#10698)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-17 09:02:37 -04:00
mrtoy-me
2b832e9ee8 [cap1188] remove delays in setup (#11317)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-17 08:55:07 -04:00
exotime
661e9f9991 [toshiba] Add support for RAS-2819T air conditioner (#9490)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
2025-10-17 03:33:50 -05:00
esphomebot
39e23c323d Synchronise Device Classes from Home Assistant (#11285) 2025-10-17 07:49:10 +00:00
J. Nick Koston
bdfbac0301 [tests] Fix ESP32-C3 component test binary size by using larger partition table (#11319) 2025-10-17 20:20:00 +13:00
J. Nick Koston
6e3cc21c34 Merge branch 'integration' into memory_api 2025-10-16 21:18:51 -10:00
J. Nick Koston
6a5abb0a9d Merge remote-tracking branch 'upstream/dev' into integration 2025-10-16 21:18:39 -10:00
Daniel Stiner
9646653e57 [const] Add CONF_OPENTHREAD (#11318) 2025-10-16 21:02:28 -10:00
J. Nick Koston
62e5b5cd2b Merge branch 'integration' into memory_api 2025-10-16 16:31:27 -10:00
Daniel Stiner
f9e53453f2 [openthread] Backport address resolution support to prevent OTA crash
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-16 16:31:20 -10:00
J. Nick Koston
05844afe97 Merge branch 'unbound_queued_script_fix' into integration 2025-10-16 16:31:03 -10:00
Joshua M. Boniface
c6c202e4f7 [ina2xx_base] add device reset-on-boot disablement option (#10787)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-16 21:57:19 -04:00
J. Nick Koston
dd25080550 Merge remote-tracking branch 'upstream/dev' into unbound_queued_script_fix 2025-10-16 15:52:26 -10:00
J. Nick Koston
2e30a4953a address review comments 2025-10-16 15:51:01 -10:00
J. Nick Koston
75b6fd4b43 Merge branch 'integration' into memory_api 2025-10-16 14:13:58 -10:00
J. Nick Koston
fbca7bca04 Merge branch 'choose_upload_no_devices_fix' into integration 2025-10-16 14:13:53 -10:00
J. Nick Koston
8b5509328e adjust tesdts 2025-10-16 14:12:55 -10:00
J. Nick Koston
076313b850 [core] Fix IndexError when OTA devices cannot be resolved 2025-10-16 14:09:09 -10:00
J. Nick Koston
237504f4e8 Merge branch 'integration' into memory_api 2025-10-16 13:24:18 -10:00
J. Nick Koston
b933154d6a Merge branch 'unbound_queued_script_fix' into integration 2025-10-16 13:24:12 -10:00
J. Nick Koston
f2ec2c3fbf max_runs was actually correct after re-testing dev 2025-10-16 13:20:42 -10:00
J. Nick Koston
353d8b8fb2 update var name to specify what it really is 2025-10-16 13:11:17 -10:00
J. Nick Koston
9de34901f9 tidy up 2025-10-16 13:06:38 -10:00
J. Nick Koston
532e6acbed fix assumptions 2025-10-16 13:00:16 -10:00
J. Nick Koston
8340bb8566 test 2025-10-16 12:53:08 -10:00
J. Nick Koston
283c9a208f max_runs for queued 2025-10-16 12:23:01 -10:00
J. Nick Koston
e96b66a9d7 [script] BREAKING: Fix unbounded queue growth, optimize queued mode (default max_runs=5) 2025-10-16 12:15:31 -10:00
Jonathan Swoboda
62f73c768e [esp32] Reduce tx power on IDF in the event of a brownout (#11306) 2025-10-16 17:43:15 -04:00
J. Nick Koston
e48371a36d Merge branch 'integration' into memory_api 2025-10-16 11:18:40 -10:00
J. Nick Koston
b53b2cbf41 Merge branch 'debug_esp32_map' into integration 2025-10-16 11:18:33 -10:00
J. Nick Koston
4ae737fc7b [debug] Replace std::map with struct array for ESP32 chip features 2025-10-16 11:08:28 -10:00
Jonathan Swoboda
cd1215347e [esp32] Reduce tx power on Arduino (#11304) 2025-10-16 16:55:30 -04:00
dependabot[bot]
b8353b3117 Bump ruff from 0.14.0 to 0.14.1 (#11303)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-16 20:52:22 +00:00
J. Nick Koston
b0cc53fe7d Merge branch 'integration' into memory_api 2025-10-16 10:29:58 -10:00
J. Nick Koston
4514876953 Merge branch 'scheduler_defer_drains_each_loop' into integration 2025-10-16 10:29:05 -10:00
J. Nick Koston
fed833cd27 cleanup 2025-10-16 10:23:40 -10:00
J. Nick Koston
90c9cb98c6 nullptr 2025-10-16 10:23:01 -10:00
J. Nick Koston
b0cefbe507 nullptr 2025-10-16 10:20:28 -10:00
J. Nick Koston
819e155939 Merge branch 'integration' into memory_api 2025-10-16 10:19:27 -10:00
J. Nick Koston
0ba56171f9 Merge branch 'scheduler_defer_drains_each_loop' into integration 2025-10-16 10:19:13 -10:00
J. Nick Koston
9baa5fc47c nullptr 2025-10-16 10:19:04 -10:00
J. Nick Koston
0430fea572 nullptr 2025-10-16 10:16:32 -10:00
J. Nick Koston
a1b366b699 Merge branch 'integration' into memory_api 2025-10-16 09:58:42 -10:00
J. Nick Koston
e0c39fcc4c Merge branch 'scheduler_defer_drains_each_loop' into integration 2025-10-16 09:58:34 -10:00
J. Nick Koston
da551a9257 Merge branch 'integration' into memory_api 2025-10-16 09:53:43 -10:00
J. Nick Koston
de0c1c6d0c Merge remote-tracking branch 'upstream/dev' into integration 2025-10-16 09:53:28 -10:00
J. Nick Koston
94704f5bd1 vector for defer 2025-10-16 09:40:15 -10:00
Jonathan Swoboda
ea33d7db2d Mark build as valid 2025-10-16 13:50:31 -04:00
J. Nick Koston
1118ef32c3 preen 2025-10-16 06:16:37 -10:00
J. Nick Koston
0cff6acdf4 fix flakey 2025-10-16 06:09:44 -10:00
J. Nick Koston
7be04916ac fix flakey 2025-10-16 06:09:38 -10:00
J. Nick Koston
b5c4dc13e0 fix flakey 2025-10-16 06:07:41 -10:00
J. Nick Koston
0200d7c358 fix flakey 2025-10-16 06:05:39 -10:00
J. Nick Koston
44ad787cb3 fix flakey 2025-10-16 06:04:42 -10:00
J. Nick Koston
699da1adc1 Merge remote-tracking branch 'upstream/min_filter_ring_buffer' into min_filter_ring_buffer 2025-10-16 06:02:03 -10:00
J. Nick Koston
4d7e8ffd0a Merge remote-tracking branch 'upstream/dev' into min_filter_ring_buffer 2025-10-16 06:01:57 -10:00
J. Nick Koston
3ba2212cfc fix flakey 2025-10-16 06:01:32 -10:00
Jonathan Swoboda
5d3574c81f [htu21d] Revert register address change (#11291) 2025-10-16 11:29:05 -04:00
Jonathan Swoboda
364e5ffd79 [core] Add ESP32 ROM functions to reserved ids (#11293) 2025-10-16 11:28:52 -04:00
Jesse Hills
c38c2a1daf Merge branch 'release' into dev 2025-10-16 23:00:45 +13:00
Jesse Hills
070b0882b8 Merge pull request #11284 from esphome/bump-2025.10.1
2025.10.1
2025-10-16 23:00:00 +13:00
J. Nick Koston
7c6351b5d7 Merge branch 'integration' into memory_api 2025-10-15 23:51:56 -10:00
J. Nick Koston
dde5382b51 Merge branch 'min_filter_ring_buffer' into integration 2025-10-15 23:51:44 -10:00
J. Nick Koston
bb2be9869d Merge branch 'dev' into min_filter_ring_buffer 2025-10-15 23:45:55 -10:00
J. Nick Koston
7e2ccb7bc3 [datetime] Fix DateTimeStateTrigger compilation when time component is not used (#11287) 2025-10-15 23:45:42 -10:00
J. Nick Koston
b4ba2aff30 remove dead unreachable code 2025-10-15 23:30:45 -10:00
J. Nick Koston
febe075bb2 helper 2025-10-15 23:17:08 -10:00
J. Nick Koston
453d56fd13 Merge branch 'integration' into memory_api 2025-10-15 22:13:38 -10:00
J. Nick Koston
32ac20bc99 Merge branch 'min_filter_ring_buffer' into integration 2025-10-15 22:13:26 -10:00
J. Nick Koston
baf117b411 fix flakey test 2025-10-15 22:03:22 -10:00
J. Nick Koston
55e03036e2 preen 2025-10-15 21:46:00 -10:00
J. Nick Koston
af45dc206f Merge remote-tracking branch 'origin/datetime_guard_not_needed' into min_filter_ring_buffer 2025-10-15 21:45:13 -10:00
J. Nick Koston
7027ae9833 race 2025-10-15 21:44:38 -10:00
J. Nick Koston
784183ca8d [datetime] Fix DateTimeStateTrigger compilation when time component is not used 2025-10-15 21:38:02 -10:00
J. Nick Koston
855df423ee add 2025-10-15 19:58:18 -10:00
J. Nick Koston
f75f11b550 add 2025-10-15 19:57:29 -10:00
J. Nick Koston
a999349fa5 tweak 2025-10-15 19:29:55 -10:00
J. Nick Koston
92d54ffb09 tweak 2025-10-15 19:28:51 -10:00
J. Nick Koston
589c25e65a tweak 2025-10-15 19:24:44 -10:00
J. Nick Koston
5a8558e1c5 tweak 2025-10-15 19:23:35 -10:00
J. Nick Koston
a72c494b75 tweak 2025-10-15 19:23:01 -10:00
J. Nick Koston
e3089ff0f6 tweak 2025-10-15 19:21:33 -10:00
J. Nick Koston
a4b14902db perf 2025-10-15 18:44:37 -10:00
J. Nick Koston
4ff39ee82c Merge remote-tracking branch 'origin/min_filter_ring_buffer' into min_filter_ring_buffer 2025-10-15 18:27:33 -10:00
J. Nick Koston
447ee3da39 tests 2025-10-15 18:26:23 -10:00
J. Nick Koston
9b6707c1c0 tests 2025-10-15 18:25:42 -10:00
Jesse Hills
7f1173fcba Bump version to 2025.10.1 2025-10-16 17:17:07 +13:00
J. Nick Koston
a75ccf841c [substitutions] Fix AttributeError when using packages with substitutions (#11274)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 17:17:07 +13:00
Jonathan Swoboda
56eb605ec9 [wifi] Fix enterprise wifi (#11276)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-16 17:17:07 +13:00
J. Nick Koston
2c4818de00 [tests] Fix OTA password test assertions after merge collision (#11275) 2025-10-16 17:17:06 +13:00
Jesse Hills
2b94de8732 [ota.esphome] Handle blank password the same as no password defined (#11271) 2025-10-16 17:17:06 +13:00
J. Nick Koston
f71aed3a5c [ota] Fix MQTT resolution when static IP appears first in device list (#11272) 2025-10-16 17:17:06 +13:00
Clyde Stubbs
353e097085 [mipi_spi] Rotation fixes (#11226) 2025-10-16 17:17:06 +13:00
J. Nick Koston
0c18dd872b Merge branch 'dev' into min_filter_ring_buffer 2025-10-15 18:05:02 -10:00
J. Nick Koston
b074ca8a1e fix 2025-10-15 18:00:33 -10:00
J. Nick Koston
4c24545b82 fix 2025-10-15 17:51:08 -10:00
J. Nick Koston
cd252a33f9 fix 2025-10-15 17:51:03 -10:00
J. Nick Koston
36f8511309 fix 2025-10-15 17:50:32 -10:00
J. Nick Koston
12874187dd fix 2025-10-15 17:50:27 -10:00
J. Nick Koston
d7832c44bc [sensor] Fix sliding window filter memory fragmentation with FixedVector ring buffer 2025-10-15 17:45:37 -10:00
J. Nick Koston
14d76e9e4e [ci] Merge components with different buses to reduce CI time (#11251)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-16 16:36:03 +13:00
J. Nick Koston
f2e0a412db [substitutions] Fix AttributeError when using packages with substitutions (#11274)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-16 16:23:20 +13:00
J. Nick Koston
6943b1d985 [api] Use FixedVector for ExecuteServiceRequest/Argument arrays to eliminate reallocations (#11270) 2025-10-16 16:22:08 +13:00
J. Nick Koston
18062d154f [esp32_ble_tracker] Refactor to use CORE.data instead of module-level globals (#11220) 2025-10-16 16:18:30 +13:00
J. Nick Koston
2b0b82b2fb [esp32_ble] Refactor to use CORE.data instead of module-level globals (#11222) 2025-10-16 16:17:16 +13:00
J. Nick Koston
3e1c8f37c5 [i2s_audio] Refactor to use CORE.data instead of module-level globals (#11223) 2025-10-16 16:16:28 +13:00
Keith Burzinski
236ca12d3e [api, climate, thermostat] Implement feature_flags for climate (#10987)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-15 21:59:55 -05:00
J. Nick Koston
42f1b61e31 [git] Automatically recover from broken git repositories in external_components (#11246) 2025-10-16 15:58:58 +13:00
J. Nick Koston
708f8a95e5 [api] Use FixedVector for HomeAssistantServiceCallAction to reduce flash usage and avoid realloc (#11277) 2025-10-16 02:48:38 +00:00
J. Nick Koston
10ca86ae8d [api] Use std::unique_ptr for fixed-size byte buffers in Noise protocol (#11278) 2025-10-16 02:41:25 +00:00
J. Nick Koston
a49aed2dcb Merge branch 'integration' into memory_api 2025-10-15 16:19:52 -10:00
J. Nick Koston
322b141e51 Merge branch 'fixed_vector_HomeAssistantServiceCallAction' into integration 2025-10-15 16:19:47 -10:00
J. Nick Koston
295ac4b1b8 protect 2025-10-15 16:19:36 -10:00
J. Nick Koston
0a7a3bae8b protect 2025-10-15 16:19:22 -10:00
J. Nick Koston
a5c955f9a5 bot comments 2025-10-15 16:16:27 -10:00
J. Nick Koston
b7fbc728f8 Merge branch 'integration' into memory_api 2025-10-15 16:08:38 -10:00
J. Nick Koston
052b4b44e8 Merge branch 'noise_no_vec_uint8t' into integration 2025-10-15 16:08:32 -10:00
J. Nick Koston
628d781fe8 [api] Use std::unique_ptr for fixed-size byte buffers in Noise protocol 2025-10-15 16:08:07 -10:00
J. Nick Koston
8156c8ccf5 Merge branch 'integration' into memory_api 2025-10-15 15:51:19 -10:00
J. Nick Koston
f4d228b314 Merge branch 'execute_fixed_vector' into integration 2025-10-15 15:51:07 -10:00
J. Nick Koston
b39976ce35 no more magic 3 2025-10-15 15:47:26 -10:00
J. Nick Koston
5e5620fb49 bot comments 2025-10-15 15:43:34 -10:00
J. Nick Koston
98c1c2d9af Merge branch 'integration' into memory_api 2025-10-15 15:40:17 -10:00
J. Nick Koston
f0ba401c74 Merge branch 'fixed_vector_HomeAssistantServiceCallAction' into integration 2025-10-15 15:40:09 -10:00
J. Nick Koston
e3d5ca1375 [api] Use FixedVector for HomeAssistantServiceCallAction to reduce flash and avoid reallocations 2025-10-15 15:38:32 -10:00
Jonathan Swoboda
22056e0809 [wifi] Fix enterprise wifi (#11276)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-16 01:24:56 +00:00
J. Nick Koston
ec31f0b13b Merge branch 'memory_api' of https://github.com/esphome/esphome into memory_api 2025-10-15 15:21:05 -10:00
J. Nick Koston
d443d3037b Merge branch 'integration' into memory_api 2025-10-15 15:20:48 -10:00
J. Nick Koston
2aa2f4bb17 Merge branch 'execute_fixed_vector' into integration 2025-10-15 15:20:39 -10:00
J. Nick Koston
8de406c633 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-15 15:20:28 -10:00
J. Nick Koston
fe4857fabb [tests] Fix OTA password test assertions after merge collision (#11275) 2025-10-16 13:28:19 +13:00
Jesse Hills
3054c2bc29 [ota.esphome] Handle blank password the same as no password defined (#11271) 2025-10-16 13:07:37 +13:00
J. Nick Koston
b190f37ae7 [ota] Fix MQTT resolution when static IP appears first in device list (#11272) 2025-10-16 13:06:02 +13:00
dependabot[bot]
28454b8219 Bump aioesphomeapi from 41.18.0 to 42.0.0 (#11273)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 14:00:27 -10:00
J. Nick Koston
922b0bb324 Merge remote-tracking branch 'upstream/dev' into execute_fixed_vector 2025-10-15 12:29:41 -10:00
J. Nick Koston
332f52e149 [api] Use FixedVector for ListEntitiesServicesResponse args (#11230) 2025-10-15 12:28:56 -10:00
J. Nick Koston
ce6718eeaa [api] Use FixedVector for ExecuteServiceRequest/Argument arrays to eliminate reallocations 2025-10-15 10:29:53 -10:00
Clyde Stubbs
ae1f54d398 [mipi_spi] Rotation fixes (#11226) 2025-10-16 07:09:52 +11:00
J. Nick Koston
95f5b18fe2 Merge branch 'dev' into ListEntitiesServicesArgument_FixedVector 2025-10-15 10:00:15 -10:00
J. Nick Koston
7a0ea74ec6 Merge branch 'integration' into memory_api 2025-10-15 09:45:21 -10:00
J. Nick Koston
2001ae1d41 Merge remote-tracking branch 'origin/integration' into memory_api 2025-10-15 09:45:15 -10:00
J. Nick Koston
42d53b301c Merge branch 'integration' of https://github.com/esphome/esphome into integration 2025-10-15 09:44:42 -10:00
J. Nick Koston
9355a3592c Merge remote-tracking branch 'upstream/dev' into integration 2025-10-15 09:43:58 -10:00
J. Nick Koston
2b3e7f38d2 [esp32] Add option to disable libc locks in IRAM, saving ~1.3KB RAM (#10930)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-15 09:34:14 -10:00
dependabot[bot]
5510ece6ac Bump pylint from 4.0.0 to 4.0.1 (#11267)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 09:34:01 -10:00
Jonathan Swoboda
e19a85b523 [esp32_ble] Add support for hosted BLE (#11167) 2025-10-15 15:19:08 -04:00
Jonathan Swoboda
cf02a08209 [esp32] Bump IDF version to 5.5.1 and Arduino version to 3.3.2 (#9839) 2025-10-15 08:45:33 -10:00
Jonathan Swoboda
90e8c12df1 [ci] Isolate openthread (#11259) 2025-10-15 06:45:06 -10:00
Jonathan Swoboda
42bf5840c9 [esp32_rmt_led_strip] Don't send reset if duration is zero (#11235) 2025-10-15 07:49:28 -04:00
Thane Gill
47817485e7 [esp32] Remove kconfiglib from requirements.txt (#11210) 2025-10-15 07:48:26 -04:00
Jonathan Swoboda
ded98ff705 [esp32_hosted] Bump hosted components (#11170)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-15 07:48:05 -04:00
J. Nick Koston
7f8ca5ddef [ci] Add Python 3.14 testing and streamline version matrix (#11238) 2025-10-14 19:49:48 -10:00
J. Nick Koston
1b0ca3360e [ci] Group all PR builds, isolate direct changes for full validation on dev (#11193) 2025-10-14 19:49:14 -10:00
Jesse Hills
66263b40e1 Merge branch 'release' into dev 2025-10-15 17:31:16 +13:00
Jesse Hills
9a29dec6d9 Merge pull request #11245 from esphome/bump-2025.10.0
2025.10.0
2025-10-15 17:30:30 +13:00
Stuart Parmenter
6d5e41ef7f [const] Add CONF_ROWS (#11249) 2025-10-15 17:29:41 +13:00
Stuart Parmenter
fedfda6c29 [core] Fix regression from #10654 (#11248) 2025-10-15 16:57:47 +13:00
J. Nick Koston
9ce3847a56 Merge branch 'dev' into ListEntitiesServicesArgument_FixedVector 2025-10-14 17:29:41 -10:00
dependabot[bot]
6e2088f836 Bump aioesphomeapi from 41.17.0 to 41.18.0 (#11247)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 03:12:34 +00:00
J. Nick Koston
62774bfd70 Merge branch 'dev' into ListEntitiesServicesArgument_FixedVector 2025-10-14 16:25:06 -10:00
J. Nick Koston
9b00ab5fe4 Merge branch 'integration' into memory_api 2025-10-14 16:24:24 -10:00
J. Nick Koston
5bfc2b95d1 Merge branch 'recover_broken_git_repo' into integration 2025-10-14 16:24:19 -10:00
J. Nick Koston
b927cea0d6 [git] Automatically recover from broken git repositories in external_components 2025-10-14 16:23:06 -10:00
J. Nick Koston
7a82379c88 [mdns] Use FixedVector for txt_records to reduce flash usage (#11228) 2025-10-15 02:16:59 +00:00
J. Nick Koston
c983581b6c [api] Convert HomeassistantActionRequest vectors to FixedVector for flash savings (#11229) 2025-10-14 21:10:04 -05:00
J. Nick Koston
0a738b23f1 Merge branch 'integration' into memory_api 2025-10-14 16:06:16 -10:00
J. Nick Koston
1edda6e632 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-14 16:06:04 -10:00
J. Nick Koston
f0ac61f247 [light] Use FixedVector for LightState effects list (#11232)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-14 16:00:22 -10:00
Jesse Hills
63b113d823 Bump version to 2025.10.0 2025-10-15 14:01:02 +13:00
J. Nick Koston
85420b0606 [web_server_idf] Use std::vector instead of std::set for SSE sessions (#11233) 2025-10-14 19:50:40 -05:00
J. Nick Koston
00230f7cc6 [wifi] Use FixedVector for scan results to reduce flash usage (#11216) 2025-10-15 00:45:28 +00:00
J. Nick Koston
63a87a5ef3 [core] Use FixedVector for automation condition vectors to save 384 bytes flash (#11237) 2025-10-14 14:27:10 -10:00
J. Nick Koston
d75ae357c2 [wifi] Free scan results memory after connection (saves up to 1.2KB RAM) (#11205) 2025-10-14 14:25:31 -10:00
Jesse Hills
88d223d03a Merge branch 'beta' into dev 2025-10-15 12:44:49 +13:00
Jesse Hills
0381644605 Merge pull request #11241 from esphome/bump-2025.10.0b4
2025.10.0b4
2025-10-15 12:44:15 +13:00
J. Nick Koston
8e6ee2bed1 debug 2025-10-14 13:43:58 -10:00
J. Nick Koston
354f46f7c0 debug 2025-10-14 13:38:41 -10:00
Jesse Hills
48a557b005 [netlify] Pin python version (#11244) 2025-10-15 12:37:55 +13:00
Jesse Hills
b927b29a0a [netlify] Pin python version (#11244) 2025-10-15 12:37:27 +13:00
J. Nick Koston
7b6acd3c00 tidy 2025-10-14 13:33:31 -10:00
J. Nick Koston
11f5f7683c tidy 2025-10-14 13:32:21 -10:00
J. Nick Koston
5da589abd0 fix 2025-10-14 13:27:13 -10:00
J. Nick Koston
daa39a489d fix tests 2025-10-14 13:20:31 -10:00
J. Nick Koston
3bb95a190d fix 2025-10-14 13:15:44 -10:00
J. Nick Koston
25a6202bb9 [ci] Automatic Flash/RAM impact analysis 2025-10-14 13:09:01 -10:00
J. Nick Koston
c4eeed7f7e [ci] Automatic Flash/RAM impact analysis 2025-10-14 13:05:02 -10:00
Jesse Hills
780ece73ff Bump version to 2025.10.0b4 2025-10-15 11:35:52 +13:00
J. Nick Koston
d7fcf8d57b [pzemac, pzemdc, sdm_meter] Fix pin conflicts in ESP32-IDF tests (#11240) 2025-10-15 11:35:52 +13:00
TJQ
82a3ca575f [mipi_dsi] Update waveshare P4-86 display parameters (#10562) 2025-10-15 11:35:52 +13:00
dependabot[bot]
5913da5a89 Bump aioesphomeapi from 41.16.0 to 41.16.1 (#11221)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 11:35:52 +13:00
dependabot[bot]
8c13105ce1 Bump aioesphomeapi from 41.14.0 to 41.16.0 (#11215)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-15 11:35:52 +13:00
J. Nick Koston
72ec9b672e [pzemac, pzemdc, sdm_meter] Fix pin conflicts in ESP32-IDF tests (#11240) 2025-10-15 11:33:19 +13:00
J. Nick Koston
e2327b46e6 Merge branch 'integration' into memory_api 2025-10-14 12:30:06 -10:00
J. Nick Koston
cd836e7594 Merge branch 'pin_conflits_fix' into integration 2025-10-14 12:30:00 -10:00
J. Nick Koston
837a0bf6df [pzemac, pzemdc, sdm_meter] Fix pin conflicts in ESP32-IDF tests 2025-10-14 12:18:12 -10:00
J. Nick Koston
8f49b1da54 Bump pillow to 11.3.0 (#11239) 2025-10-14 11:49:39 -10:00
dependabot[bot]
9ff6f344ab Bump ruamel-yaml-clib from 0.2.12 to 0.2.14 (#10842)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-14 10:49:30 -10:00
J. Nick Koston
7598900cc2 Merge branch 'integration' into memory_api 2025-10-14 09:39:00 -10:00
J. Nick Koston
07fd35a7a0 Merge branch 'fixed_vectors_for_automations' into integration 2025-10-14 09:38:54 -10:00
J. Nick Koston
793e75a093 [core] Use FixedVector for automation condition vectors to save 384 bytes flash 2025-10-14 09:28:56 -10:00
J. Nick Koston
138c0fdf91 Merge branch 'integration' into memory_api 2025-10-14 09:17:14 -10:00
J. Nick Koston
577f9a39f4 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-14 09:17:03 -10:00
J. Nick Koston
0e703ddbba [docs] Add embedded systems optimization best practices to AI instructions (#11225) 2025-10-15 07:54:16 +13:00
TJQ
2175c2909b [mipi_dsi] Update waveshare P4-86 display parameters (#10562) 2025-10-14 22:28:06 +11:00
J. Nick Koston
41d5122a57 Merge branch 'integration' into memory_api 2025-10-13 22:51:25 -10:00
J. Nick Koston
b1c7cc6b06 Merge branch 'web_server_idf_vector_sessions' into integration 2025-10-13 22:51:19 -10:00
J. Nick Koston
3cf24a259c [web_server_idf] Use std::vector instead of std::set for SSE sessions 2025-10-13 22:46:45 -10:00
J. Nick Koston
5c3379120f Merge branch 'integration' into memory_api 2025-10-13 22:31:55 -10:00
J. Nick Koston
7291502ff3 Merge branch 'light_effects_fixed_vector' into integration 2025-10-13 22:31:49 -10:00
J. Nick Koston
87ae07e7be [light] Use FixedVector for LightState effects list 2025-10-13 22:27:41 -10:00
dependabot[bot]
cbdb9d4a56 Bump aioesphomeapi from 41.16.1 to 41.17.0 (#11231)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-14 08:06:18 +00:00
J. Nick Koston
3dff1d02d2 Merge branch 'integration' into memory_api 2025-10-13 21:59:26 -10:00
J. Nick Koston
a2d555c54d Merge branch 'ListEntitiesServicesArgument_FixedVector' into integration 2025-10-13 21:59:18 -10:00
J. Nick Koston
7572951bc5 Merge branch 'integration' into memory_api 2025-10-13 21:58:53 -10:00
J. Nick Koston
00760ff183 Merge branch 'fixed_vector_mdns_txt_records' into integration 2025-10-13 21:58:43 -10:00
J. Nick Koston
1acd7d4672 Update esphome/core/helpers.h
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-13 21:56:11 -10:00
J. Nick Koston
ce3bd55a38 [api] Use FixedVector for ListEntitiesServicesResponse args 2025-10-13 21:52:24 -10:00
J. Nick Koston
a8b6a56467 Merge branch 'integration' into memory_api 2025-10-13 21:46:14 -10:00
J. Nick Koston
c808998ba7 Merge branch 'fixed_vector_HomeassistantServiceMap' into integration 2025-10-13 21:46:09 -10:00
J. Nick Koston
5ebb68b719 fixed 2025-10-13 21:45:52 -10:00
J. Nick Koston
66d859bfae Merge branch 'integration' into memory_api 2025-10-13 21:42:24 -10:00
J. Nick Koston
dcde6b1cdf Merge branch 'fixed_vector_HomeassistantServiceMap' into integration 2025-10-13 21:42:18 -10:00
J. Nick Koston
95aab61e58 Merge branch 'ai_instructions_embedded_systems' into integration 2025-10-13 21:42:14 -10:00
J. Nick Koston
0fca842afe preen 2025-10-13 21:41:57 -10:00
J. Nick Koston
e241e43064 preen 2025-10-13 21:41:49 -10:00
J. Nick Koston
92a6aade17 fixes 2025-10-13 21:35:26 -10:00
J. Nick Koston
ef766f81e9 Merge upstream/dev and address Copilot review comments
- Resolved merge conflict between embedded systems optimization and state management sections
- Added StaticVector (compile-time max size) and FixedVector (runtime size) documentation
- Clarified std::unique_ptr<uint8_t[]> lacks bounds checking and iterator support
- Added nuance to linear search vs hashing tradeoffs for small datasets
- Updated detection patterns to include _M_realloc_insert and _M_default_append
2025-10-13 21:31:47 -10:00
J. Nick Koston
17c44504da Merge branch 'dev' into fixed_vector_mdns_txt_records 2025-10-13 21:17:37 -10:00
J. Nick Koston
2316f3a5e3 Merge branch 'integration' into memory_api 2025-10-13 21:14:52 -10:00
J. Nick Koston
19c8a638f4 Merge branch 'fixed_vector_mdns_txt_records' into integration 2025-10-13 21:14:46 -10:00
J. Nick Koston
05efb6e925 refactor to avoid move 2025-10-13 21:14:32 -10:00
J. Nick Koston
baa010583e [docs] Add state management best practices to CLAUDE.md (#11224) 2025-10-14 20:09:48 +13:00
J. Nick Koston
1479f48636 Merge branch 'fixed_vector_HomeassistantServiceMap' into memory_api 2025-10-13 19:31:38 -10:00
J. Nick Koston
240fe97d20 Merge branch 'fixed_vector_HomeassistantServiceMap' into integration 2025-10-13 19:31:29 -10:00
J. Nick Koston
43d8386c4a tidy 2025-10-13 19:31:13 -10:00
J. Nick Koston
adc0e986a2 Merge branch 'integration' into memory_api 2025-10-13 19:28:36 -10:00
J. Nick Koston
6c5ba7d394 Merge branch 'fixed_vector_HomeassistantServiceMap' into integration 2025-10-13 19:28:21 -10:00
J. Nick Koston
7492d7a437 [api] Convert HomeassistantActionRequest vectors to FixedVector for flash savings 2025-10-13 19:27:33 -10:00
J. Nick Koston
1c6dd52e9f Merge branch 'integration' into memory_api 2025-10-13 19:15:55 -10:00
J. Nick Koston
62497a43fb Merge branch 'fixed_vector_mdns_txt_records' into integration 2025-10-13 19:15:49 -10:00
J. Nick Koston
24a7426a2a rename to fix shadow 2025-10-13 19:15:39 -10:00
J. Nick Koston
b7af2d7f4c Merge branch 'integration' into memory_api 2025-10-13 19:07:08 -10:00
J. Nick Koston
2132427fe7 Merge branch 'fixed_vector_mdns_txt_records' into integration 2025-10-13 19:07:01 -10:00
J. Nick Koston
fc30326e60 preen 2025-10-13 19:06:02 -10:00
J. Nick Koston
45014db027 preen 2025-10-13 19:05:26 -10:00
J. Nick Koston
ac35c97a44 we need copy now 2025-10-13 18:59:46 -10:00
J. Nick Koston
541c697a42 [mdns] Use FixedVector for txt_records to reduce flash usage 2025-10-13 18:52:49 -10:00
J. Nick Koston
96dd348f9a Merge branch 'integration' into memory_api 2025-10-13 18:32:24 -10:00
J. Nick Koston
6d5dcf109e Merge remote-tracking branch 'upstream/dev' into integration 2025-10-13 18:32:01 -10:00
J. Nick Koston
01c41fc57c Merge branch 'i2s_core_data' into integration 2025-10-13 18:29:11 -10:00
J. Nick Koston
97d3cae81e Merge branch 'esp32_ble_core_data' into integration 2025-10-13 18:29:07 -10:00
J. Nick Koston
60e59b98d5 Merge branch 'esp32_ble_tracker_core_data' into integration 2025-10-13 18:29:03 -10:00
J. Nick Koston
0f43f4cbbf [docs] Add embedded systems optimization and state management best practices to CLAUDE.md 2025-10-13 18:26:45 -10:00
dependabot[bot]
8e9a68a107 Bump aioesphomeapi from 41.16.0 to 41.16.1 (#11221)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 18:12:52 -10:00
J. Nick Koston
18d5fd160a [i2s_audio] Refactor to use CORE.data instead of module-level globals 2025-10-13 18:11:34 -10:00
J. Nick Koston
dd0699305e [esp32_ble] Refactor to use CORE.data instead of module-level globals 2025-10-13 18:08:52 -10:00
J. Nick Koston
5bdd6dac97 [esp32_ble_tracker] Refactor to use CORE.data instead of module-level globals 2025-10-13 18:02:28 -10:00
J. Nick Koston
4c688a4b00 [network] Optimize get_use_address() to return const reference instead of a copy (#11218)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-14 03:54:33 +00:00
J. Nick Koston
98132cb950 Merge branch 'integration' into memory_api 2025-10-13 17:50:00 -10:00
J. Nick Koston
7629309e76 Merge branch 'clear_scan_result_done' into integration 2025-10-13 17:49:47 -10:00
J. Nick Koston
5c30c1b691 core.data 2025-10-13 17:49:07 -10:00
Jesse Hills
9eef281895 Merge branch 'beta' into dev 2025-10-14 16:35:50 +13:00
Jesse Hills
c3fd07f8bc Merge pull request #11219 from esphome/bump-2025.10.0b3
2025.10.0b3
2025-10-14 16:35:13 +13:00
J. Nick Koston
8a15c18066 [bluetooth_proxy] Use FixedVector for GATT characteristics and descriptors (#11214)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-14 16:05:13 +13:00
J. Nick Koston
a674727fa6 Merge branch 'integration' into memory_api 2025-10-13 16:51:04 -10:00
J. Nick Koston
f54db515bc Merge branch 'get_use_address' into integration 2025-10-13 16:50:58 -10:00
Jesse Hills
d02ed41eb4 Bump version to 2025.10.0b3 2025-10-14 15:38:15 +13:00
J. Nick Koston
07504c8208 Fix log retrieval with FQDN when mDNS is disabled (#11202) 2025-10-14 15:38:15 +13:00
Jonathan Swoboda
b666b8e261 [core] Properly clean the build dir in the HA addon (#11208) 2025-10-14 15:38:15 +13:00
dependabot[bot]
8627b56e36 Bump esphome-dashboard from 20251009.0 to 20251013.0 (#11212)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-14 15:38:15 +13:00
Jesse Hills
69df07ddcf [media_player.speaker] Dynamic auto load (#11084)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-14 15:38:15 +13:00
J. Nick Koston
5bb69a968c [esp32_ble] Replace handler vectors with StaticVector for 560B-2KB memory savings (#11200)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-14 15:33:33 +13:00
J. Nick Koston
c5076e69f0 host platform 2025-10-13 15:52:00 -10:00
J. Nick Koston
9945c4b350 Merge branch 'integration' into memory_api 2025-10-13 15:41:57 -10:00
J. Nick Koston
9f9abd2259 Merge branch 'get_use_address' into integration 2025-10-13 15:41:47 -10:00
J. Nick Koston
6b8d5be528 Update esphome/components/network/util.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-13 15:41:17 -10:00
J. Nick Koston
044b3c07ef Merge branch 'integration' into memory_api 2025-10-13 15:30:38 -10:00
J. Nick Koston
3439f38ebf Merge branch 'fixed_vector_wifi' into integration 2025-10-13 15:30:29 -10:00
J. Nick Koston
2626a851fb cleanup 2025-10-13 15:30:18 -10:00
J. Nick Koston
9775274007 preen 2025-10-13 15:25:47 -10:00
J. Nick Koston
d5ba16f13a merge 2025-10-13 15:22:52 -10:00
J. Nick Koston
e17cdffc78 merge 2025-10-13 15:04:40 -10:00
J. Nick Koston
7c02f2f10a [socket] Split LWIP socket classes to reduce memory overhead on ESP8266/RP2040 (#11172) 2025-10-14 14:00:49 +13:00
J. Nick Koston
910aff6589 Merge branch 'integration' into memory_api 2025-10-13 14:51:27 -10:00
J. Nick Koston
84d42aeeaf Merge branch 'fixed_vector_wifi' into integration 2025-10-13 14:51:18 -10:00
J. Nick Koston
fa830cfd39 fix 2025-10-13 14:50:55 -10:00
J. Nick Koston
d82bcea106 Merge branch 'integration' into memory_api 2025-10-13 14:39:08 -10:00
J. Nick Koston
e9766603b7 Merge branch 'get_use_address' into integration 2025-10-13 14:39:02 -10:00
J. Nick Koston
2881f32b08 [network] Optimize get_use_address() to return const reference instead of copy 2025-10-13 14:37:10 -10:00
J. Nick Koston
10724f411b [network] Optimize get_use_address() to return const reference instead of copy 2025-10-13 14:32:17 -10:00
J. Nick Koston
99a5a6f3a6 Merge branch 'integration' into memory_api 2025-10-13 14:20:29 -10:00
J. Nick Koston
9d04878a0c Merge branch 'fixed_vector_wifi' into integration 2025-10-13 14:20:17 -10:00
J. Nick Koston
5a11a2e5b2 Merge branch 'fixed_vector_bluetooth_services' into integration 2025-10-13 14:20:12 -10:00
J. Nick Koston
7b5a86e4df fixes 2025-10-13 14:15:37 -10:00
J. Nick Koston
453ab0adb8 backmerge 2025-10-13 14:10:56 -10:00
J. Nick Koston
de10d78125 dry 2025-10-13 14:10:41 -10:00
J. Nick Koston
b878aa0270 fix 2025-10-13 14:09:44 -10:00
J. Nick Koston
c9a1664398 merge 2025-10-13 14:08:27 -10:00
J. Nick Koston
bb2f568f3d merge 2025-10-13 14:07:52 -10:00
J. Nick Koston
7792a115c2 merge 2025-10-13 14:05:31 -10:00
J. Nick Koston
ce46f16308 merge 2025-10-13 14:05:19 -10:00
J. Nick Koston
d5234e3357 merge 2025-10-13 14:04:39 -10:00
J. Nick Koston
ddf6e0a7b6 revert 2025-10-13 14:04:15 -10:00
J. Nick Koston
fbef9b1264 revert 2025-10-13 14:03:59 -10:00
J. Nick Koston
eb545127c0 Merge branch 'fixed_vector_bluetooth_services' into fixed_vector_wifi 2025-10-13 14:03:34 -10:00
J. Nick Koston
8aa832ab08 Merge remote-tracking branch 'upstream/fixed_vector_bluetooth_services' into fixed_vector_bluetooth_services 2025-10-13 14:03:21 -10:00
J. Nick Koston
22370c0ad1 merge 2025-10-13 14:03:08 -10:00
J. Nick Koston
3fd9c42d82 Merge branch 'wifi_fixed_vector' into fixed_vector_wifi 2025-10-13 14:02:41 -10:00
J. Nick Koston
e9448d7126 Merge branch 'dev' into fixed_vector_bluetooth_services 2025-10-13 14:02:06 -10:00
dependabot[bot]
fe07c34246 Bump aioesphomeapi from 41.14.0 to 41.16.0 (#11215)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-14 00:00:45 +00:00
J. Nick Koston
3847e8aa73 Merge remote-tracking branch 'upstream/dev' into fixed_vector_bluetooth_services 2025-10-13 13:25:58 -10:00
dependabot[bot]
c652aa375a Bump pylint from 3.3.9 to 4.0.0 (#11211)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 13:10:46 -10:00
J. Nick Koston
7231b0cb5c Merge branch 'integration' into memory_api 2025-10-13 11:41:49 -10:00
J. Nick Koston
494ffb8c48 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-13 11:41:35 -10:00
J. Nick Koston
9fb254fdc2 Fix log retrieval with FQDN when mDNS is disabled (#11202) 2025-10-14 10:23:44 +13:00
Jonathan Swoboda
3df4dbd3a6 [core] Properly clean the build dir in the HA addon (#11208) 2025-10-13 17:12:45 -04:00
J. Nick Koston
6372099df3 [http_request] Pass parameters by const reference to reduce flash usage (#11184) 2025-10-14 09:53:11 +13:00
J. Nick Koston
8d8fcfeda2 [core] Add make_name_with_suffix helper to optimize string concatenation (#11176)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-14 09:39:38 +13:00
J. Nick Koston
0f356fcc79 [core] Optimize looping_components_ with FixedVector to save flash (#11183) 2025-10-14 09:20:43 +13:00
dependabot[bot]
aec60d122b Bump esphome-dashboard from 20251009.0 to 20251013.0 (#11212)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 09:34:12 -10:00
J. Nick Koston
c10f68ef0c [mdns] Conditionally store services to reduce RAM usage by 200-464 bytes (#11180) 2025-10-14 07:24:57 +13:00
J. Nick Koston
bcc424afed [web_server] Reduce code duplication in JSON generation with helper functions (#11117) 2025-10-14 07:21:19 +13:00
J. Nick Koston
be2c859df3 [web_server] Consolidate duplicate client connection checks (saves 288 bytes of flash) (#11116) 2025-10-14 07:01:47 +13:00
J. Nick Koston
dd09897a1d Update esphome/components/wifi_info/text_sensor.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-12 20:46:36 -10:00
J. Nick Koston
e28599b403 Merge branch 'integration' into memory_api 2025-10-12 20:22:31 -10:00
J. Nick Koston
71bf274214 Merge branch 'clear_scan_result_done' into integration 2025-10-12 20:22:23 -10:00
J. Nick Koston
d191d1e99a preen 2025-10-12 20:21:56 -10:00
J. Nick Koston
987d616846 Merge branch 'integration' into memory_api 2025-10-12 20:20:49 -10:00
J. Nick Koston
299cbdd411 Merge branch 'clear_scan_result_done' into integration 2025-10-12 20:20:42 -10:00
J. Nick Koston
4d55c8f309 preen 2025-10-12 20:20:17 -10:00
J. Nick Koston
ba408a10bb Merge branch 'integration' into memory_api 2025-10-12 20:15:20 -10:00
J. Nick Koston
9435a3a1fc Merge branch 'clear_scan_result_done' into integration 2025-10-12 20:15:11 -10:00
J. Nick Koston
6f3a996698 [wifi] Free scan results memory after successful connection 2025-10-12 20:12:34 -10:00
J. Nick Koston
347501d895 wifi fixed vector 2025-10-12 19:39:55 -10:00
J. Nick Koston
a9fd0a3b26 fixed_vector, bluetooth services 2025-10-12 18:21:14 -10:00
Jesse Hills
59f728488e [media_player.speaker] Dynamic auto load (#11084)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-13 12:58:30 +13:00
J. Nick Koston
767b5a11ef Merge branch 'integration' into memory_api 2025-10-12 12:55:42 -10:00
J. Nick Koston
b1eb65da7d Merge branch 'logs_fqdn_fix' into integration 2025-10-12 12:55:31 -10:00
J. Nick Koston
7c8f8e282d Fix log retrieval with FQDN when mDNS is disabled 2025-10-12 12:52:38 -10:00
Jesse Hills
04a0de556d Merge branch 'beta' into dev 2025-10-13 10:56:08 +13:00
Jesse Hills
13cfa30c67 Merge pull request #11199 from esphome/bump-2025.10.0b2
2025.10.0b2
2025-10-13 10:55:34 +13:00
J. Nick Koston
a2254a6d55 Merge branch 'integration' into memory_api 2025-10-12 11:29:04 -10:00
J. Nick Koston
d3806d790d Merge branch 'ble_handlers_static' into integration 2025-10-12 11:28:54 -10:00
J. Nick Koston
26ebfa4906 cleaner 2025-10-12 11:19:58 -10:00
J. Nick Koston
2c6828eb84 Merge branch 'integration' into memory_api 2025-10-12 11:16:36 -10:00
J. Nick Koston
7070204b00 Merge branch 'ble_handlers_static' into integration 2025-10-12 11:16:27 -10:00
J. Nick Koston
6f2c7c0e5d fixes 2025-10-12 11:13:14 -10:00
J. Nick Koston
2a94463ac1 [esp32_ble] Replace handler vectors with StaticVector for 2KB memory savings 2025-10-12 11:07:01 -10:00
J. Nick Koston
a635db726d Merge branch 'integration' into memory_api 2025-10-12 10:32:11 -10:00
J. Nick Koston
41860c312e Merge remote-tracking branch 'upstream/dev' into integration 2025-10-12 10:31:59 -10:00
Jesse Hills
da1959ab5d Bump version to 2025.10.0b2 2025-10-13 08:49:29 +13:00
J. Nick Koston
2b42903e9c [usb_host] Fix transfer slot exhaustion at high data rates and add configurable max_transfer_requests (#11174)
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>
2025-10-13 08:49:29 +13:00
J. Nick Koston
742c9cbb53 [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal (#11181) 2025-10-13 08:49:29 +13:00
J. Nick Koston
e4bc465a3d [ota] Increase handshake timeout to 20s now that auth is non-blocking (#11186) 2025-10-13 08:49:29 +13:00
J. Nick Koston
5cec0941f8 [wifi] Fix missed string literal in flash on ESP8266 (#11187) 2025-10-13 08:49:29 +13:00
J. Nick Koston
72a7aeb430 [ci] Dynamic runner allocation: 8 for releases, 4 for dev (#11191) 2025-10-13 08:49:29 +13:00
J. Nick Koston
53e6b28092 [mipi_rgb] Fix pin conflicts introduced by shared SPI bus in #11134 (#11185) 2025-10-13 08:49:28 +13:00
dependabot[bot]
7f3c7bb5c6 Bump aioesphomeapi from 41.13.0 to 41.14.0 (#11188)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 08:49:28 +13:00
Jonathan Swoboda
c02c0b2a96 [esp32] Change Arduino dev & latest to 3.3.2 (#11169) 2025-10-13 08:49:28 +13:00
J. Nick Koston
5f5092e29f [ci] Filter out components without tests from CI test jobs (#11134 followup) (#11178) 2025-10-13 08:49:28 +13:00
J. Nick Koston
2864bf1674 Group component tests to reduce CI time (#11134) 2025-10-13 08:49:28 +13:00
J. Nick Koston
132e949927 [mdns] Restore mdns_txt_record() public API for external components (#11158) 2025-10-13 08:49:28 +13:00
J. Nick Koston
8fa44e471d [esp32_ble] Partial revert of #10862 - Fix GATT client notifications (#11171) 2025-10-13 08:49:28 +13:00
J. Nick Koston
ccedcfb600 [json] Fix PSRAM allocator dangling pointer crash (#11165) 2025-10-13 08:49:28 +13:00
J. Nick Koston
8b0ec0afe3 [ci][tests] Remove all redundant ESP32-C3 Arduino tests (#11154) 2025-10-13 08:49:28 +13:00
J. Nick Koston
dca29ed89b [datetime][ci][tests] Replace test.all.yaml with minimal platform cover (#11151) 2025-10-13 08:49:28 +13:00
J. Nick Koston
728726e29e [ci][tests] Remove redundant ESP32-C3 Arduino tests for non-variant-specific components (#11152) 2025-10-13 08:49:28 +13:00
J. Nick Koston
79f4ca20b8 [opentherm][ci][tests] Remove redundant ESP32 Arduino tests and simplify conditionals (#11149) 2025-10-13 08:49:28 +13:00
J. Nick Koston
3eca72e0b8 [ci][logger][tests] Remove redundant ESP32 Arduino test files (#11144) 2025-10-13 08:49:28 +13:00
J. Nick Koston
22c0f55cef [ci][debug][tests] Remove redundant ESP32 variant Arduino test files (#11146) 2025-10-13 08:49:28 +13:00
J. Nick Koston
fd8ecc9608 [ci][time][tests] Remove redundant ESP32 Arduino test files (#11147) 2025-10-13 08:49:27 +13:00
J. Nick Koston
ac96a59d58 [network][ci][tests] Remove redundant ESP32 Arduino test files (#11148) 2025-10-13 08:49:27 +13:00
J. Nick Koston
dceed992d8 [esp32_ble_beacon, esp32_ble_tracker] Remove unused Arduino includes and redundant tests (#11140) 2025-10-13 08:49:27 +13:00
J. Nick Koston
b0c66c1c09 [ci][mdns][tests] Remove redundant ESP32 Arduino test files (#11143) 2025-10-13 08:49:27 +13:00
J. Nick Koston
8f04a5b944 [esp32] Update migration warning for Arduino-as-IDF-component transition (#11142) 2025-10-13 08:49:27 +13:00
Jonathan Swoboda
e6c21df30b [esp32] Update IDF 5.5 and Arduino 3.3 to use 55.03.31-1 (#11120) 2025-10-13 08:49:27 +13:00
J. Nick Koston
842cb9033a [mdns] Store TXT record values in flash to reduce heap usage (#11114) 2025-10-13 08:49:27 +13:00
J. Nick Koston
a2cb415dfa [ci][improv_serial][tests] Remove redundant ESP32 Arduino test files (#11138) 2025-10-13 08:49:27 +13:00
J. Nick Koston
1fac193535 [ci][ethernet][tests] Remove redundant Arduino tests for ethernet PHYs (#11137) 2025-10-13 08:49:27 +13:00
J. Nick Koston
34632f78cf [ci][tests] Remove redundant ESP32 Arduino test files (#11136) 2025-10-13 08:49:27 +13:00
J. Nick Koston
b93c60e85a [canbus][mcp23xxx_base] Mark virtual methods as pure virtual to fix linker errors (#11133) 2025-10-13 08:49:27 +13:00
dependabot[bot]
60dc055509 Bump esphome-dashboard from 20250904.0 to 20251009.0 (#11123)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-13 08:49:27 +13:00
J. Nick Koston
1f13d44c1b [usb_host] Fix transfer slot exhaustion at high data rates and add configurable max_transfer_requests (#11174)
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>
2025-10-13 08:04:30 +13:00
J. Nick Koston
9ebfa9aaa8 [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal (#11181) 2025-10-13 07:30:58 +13:00
J. Nick Koston
6bc9ed0810 [ota] Increase handshake timeout to 20s now that auth is non-blocking (#11186) 2025-10-13 07:27:43 +13:00
J. Nick Koston
9b6e8b4b41 [wifi] Fix missed string literal in flash on ESP8266 (#11187) 2025-10-13 07:26:28 +13:00
J. Nick Koston
cad747c672 [ci] Dynamic runner allocation: 8 for releases, 4 for dev (#11191) 2025-10-13 07:25:35 +13:00
J. Nick Koston
660adccda3 [mipi_rgb] Fix pin conflicts introduced by shared SPI bus in #11134 (#11185) 2025-10-12 08:58:56 -04:00
dependabot[bot]
51fbc4f7a3 Bump aioesphomeapi from 41.13.0 to 41.14.0 (#11188)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-12 08:12:52 +00:00
J. Nick Koston
dc53831b27 Merge branch 'integration' into memory_api 2025-10-11 22:03:51 -10:00
J. Nick Koston
e8397704fb Merge branch 'wifi_missed_string_lit' into integration 2025-10-11 22:03:40 -10:00
J. Nick Koston
ddc7a15302 [wifi] Fix missed string literal in flash on ESP8266 2025-10-11 22:02:59 -10:00
J. Nick Koston
6a0bcdf4f6 Merge branch 'integration' into memory_api 2025-10-11 21:26:37 -10:00
J. Nick Koston
cc63edcf7a Merge branch 'flakey_ota_first_connect' into integration 2025-10-11 21:26:29 -10:00
J. Nick Koston
072662c395 timeout 2025-10-11 21:26:13 -10:00
J. Nick Koston
cebc8a3867 Merge branch 'integration' into memory_api 2025-10-11 21:23:51 -10:00
J. Nick Koston
2795d67787 Merge branch 'flakey_ota_first_connect' into integration 2025-10-11 21:23:37 -10:00
J. Nick Koston
66c8c045f2 [ota] Increase handshake timeout to 20s now that auth is non-blocking 2025-10-11 21:23:02 -10:00
J. Nick Koston
91dbdffea5 [mipi_rgb] Fix pin conflicts introduced by shared SPI bus in #11134 2025-10-11 19:56:05 -10:00
J. Nick Koston
2fc5afc79e Merge branch 'integration' into memory_api 2025-10-11 17:36:14 -10:00
J. Nick Koston
e0933e0094 Merge branch 'http_request_const' into integration 2025-10-11 17:36:02 -10:00
J. Nick Koston
0c0ed8c4fd Merge branch 'loop_fix_vec' into integration 2025-10-11 17:35:57 -10:00
J. Nick Koston
4c00861760 add comments for bot 2025-10-11 17:35:31 -10:00
J. Nick Koston
2ff3e7fb2b add comments for bot 2025-10-11 17:34:51 -10:00
J. Nick Koston
fdc9ea285d [http_request] Pass parameters by const reference to reduce flash usage 2025-10-11 17:30:30 -10:00
J. Nick Koston
34d891761a Merge branch 'integration' into memory_api 2025-10-11 17:00:46 -10:00
J. Nick Koston
e64111345c Merge branch 'loop_fix_vec' into integration 2025-10-11 17:00:34 -10:00
J. Nick Koston
d6239398ed Merge branch 'loop_fix_vec' into memory_api 2025-10-11 17:00:25 -10:00
J. Nick Koston
b0c20d7adb [core] Optimize looping_components_ with FixedVector to save flash 2025-10-11 16:54:40 -10:00
J. Nick Koston
d2a31b95c4 preen 2025-10-11 16:08:47 -10:00
J. Nick Koston
0d3489df3f Merge branch 'integration' into memory_api 2025-10-11 15:34:42 -10:00
J. Nick Koston
6b2ef78787 preen 2025-10-11 15:34:31 -10:00
J. Nick Koston
153f01ef77 preen 2025-10-11 15:34:15 -10:00
J. Nick Koston
e69013317d Update esphome/core/helpers.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-11 15:33:46 -10:00
J. Nick Koston
3f65f261ab Merge branch 'helper_for_name_suffix' of https://github.com/esphome/esphome into helper_for_name_suffix 2025-10-11 15:33:28 -10:00
J. Nick Koston
5fe319fcc5 preen 2025-10-11 15:33:22 -10:00
J. Nick Koston
21c2c6e782 Update esphome/config_validation.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-11 15:33:19 -10:00
J. Nick Koston
6ecdb395fd Merge branch 'dev' into helper_for_name_suffix 2025-10-11 15:27:41 -10:00
J. Nick Koston
3d328d7233 Merge remote-tracking branch 'origin/helper_for_name_suffix' into helper_for_name_suffix 2025-10-11 15:24:11 -10:00
J. Nick Koston
9f20c48a24 adjust 2025-10-11 15:23:51 -10:00
Jonathan Swoboda
2cc5e24b38 [esp32] Change Arduino dev & latest to 3.3.2 (#11169) 2025-10-11 20:44:44 -04:00
J. Nick Koston
069893abb9 Merge branch 'integration' into memory_api 2025-10-11 13:46:07 -10:00
J. Nick Koston
edd73ed192 Merge branch 'improv_cap_portal_fix' into integration 2025-10-11 13:45:59 -10:00
J. Nick Koston
10c231e872 Merge remote-tracking branch 'upstream/improv_cap_portal_fix' into improv_cap_portal_fix 2025-10-11 13:45:36 -10:00
J. Nick Koston
3758b4c801 preen 2025-10-11 13:45:22 -10:00
J. Nick Koston
5bd87906af Merge branch 'dev' into improv_cap_portal_fix 2025-10-11 13:42:41 -10:00
J. Nick Koston
c8b2a74a7e Merge branch 'dev' into helper_for_name_suffix 2025-10-11 13:37:43 -10:00
J. Nick Koston
3afa73b449 [ci] Filter out components without tests from CI test jobs (#11134 followup) (#11178) 2025-10-11 18:27:18 -05:00
J. Nick Koston
678a93cc56 fix 2025-10-11 13:08:10 -10:00
J. Nick Koston
5a0184cb35 [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal 2025-10-11 13:01:19 -10:00
J. Nick Koston
c63902781b [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal 2025-10-11 12:57:13 -10:00
J. Nick Koston
a193d5b40e [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal 2025-10-11 12:56:28 -10:00
J. Nick Koston
ff6191cfd4 [esp32_improv] Fix state not transitioning to PROVISIONED when WiFi configured via captive portal 2025-10-11 12:55:03 -10:00
J. Nick Koston
b7b2b296a0 Merge branch 'integration' into memory_api 2025-10-11 12:39:33 -10:00
J. Nick Koston
b032ba9bd4 Merge branch 'mdns_store' into integration 2025-10-11 12:39:27 -10:00
J. Nick Koston
0975dbfb01 cleanup 2025-10-11 12:38:12 -10:00
J. Nick Koston
0c8c99dbf8 [mdns] Conditionally store services to reduce RAM usage by 200-464 bytes 2025-10-11 12:27:39 -10:00
J. Nick Koston
c241258dfe Merge branch 'integration' into memory_api 2025-10-11 11:26:19 -10:00
J. Nick Koston
417f574cff Merge branch 'helper_for_name_suffix' into integration 2025-10-11 11:26:09 -10:00
J. Nick Koston
5e1848854e tweak for bot 2025-10-11 11:25:19 -10:00
J. Nick Koston
19c541f1e6 Merge branch 'integration' into memory_api 2025-10-11 11:11:46 -10:00
J. Nick Koston
4ad3f9d962 Merge branch 'helper_for_name_suffix' into integration 2025-10-11 11:11:39 -10:00
J. Nick Koston
81b7f41dd5 Merge branch 'fix_ci_only_test_comp_with_tests' into helper_for_name_suffix 2025-10-11 11:09:41 -10:00
J. Nick Koston
1acbb007dd [ci] Filter out components without tests from CI test jobs (#11134 followup) 2025-10-11 11:08:47 -10:00
J. Nick Koston
245ccb02fa Merge branch 'integration' into memory_api 2025-10-11 10:52:51 -10:00
J. Nick Koston
ce6b51e27d Merge branch 'helper_for_name_suffix' into integration 2025-10-11 10:52:36 -10:00
J. Nick Koston
6273380407 [core] Add make_name_with_suffix helper to optimize string concatenation 2025-10-11 10:51:17 -10:00
J. Nick Koston
69888af408 Merge branch 'integration' into memory_api 2025-10-11 09:32:00 -10:00
J. Nick Koston
2572157fc3 Merge remote-tracking branch 'upstream/integration' into integration 2025-10-11 09:31:48 -10:00
J. Nick Koston
a012557911 Merge branch 'integration' into memory_api 2025-10-11 09:31:08 -10:00
J. Nick Koston
3187e045d2 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-11 09:30:48 -10:00
J. Nick Koston
dcf2697a2a Group component tests to reduce CI time (#11134) 2025-10-12 07:21:45 +13:00
J. Nick Koston
6a11700a6b [mdns] Restore mdns_txt_record() public API for external components (#11158) 2025-10-12 07:21:37 +13:00
J. Nick Koston
d63af64282 Merge branch 'integration' into memory_api 2025-10-11 06:27:06 -10:00
J. Nick Koston
4a7a0bbc93 Merge branch 'usb_host_keep_up' into integration 2025-10-11 06:26:59 -10:00
J. Nick Koston
fa69b74e6c tweak comments 2025-10-11 06:25:44 -10:00
J. Nick Koston
ec71669bff tweak comments 2025-10-11 06:24:35 -10:00
J. Nick Koston
2796cac972 compile tests 2025-10-11 06:17:36 -10:00
J. Nick Koston
442a60766d missing defines 2025-10-11 06:02:49 -10:00
J. Nick Koston
dd6085456a tweak 2025-10-11 06:00:57 -10:00
J. Nick Koston
460c41d9b8 [usb_host] Fix transfer slot exhaustion at high data rates and add configurable max_transfer_requests 2025-10-11 05:53:14 -10:00
J. Nick Koston
9bd9b043c8 [esp32_ble_tracker] Replace std::vector with StaticVector for listeners and clients (#11173) 2025-10-11 05:47:42 -10:00
J. Nick Koston
cb602c9b1a [esp32_ble] Partial revert of #10862 - Fix GATT client notifications (#11171) 2025-10-11 05:47:23 -10:00
J. Nick Koston
c524e6c2b3 Merge branch 'integration' into memory_api 2025-10-10 21:00:54 -10:00
J. Nick Koston
5d7731b39d Merge branch 'static_vector_esp32_ble_tracker' into integration 2025-10-10 21:00:48 -10:00
J. Nick Koston
dacead836f [esp32_ble_tracker] Replace std::vector with StaticVector for listeners and clients 2025-10-10 20:59:34 -10:00
J. Nick Koston
2184c1fde6 Merge branch 'integration' into memory_api 2025-10-10 20:04:45 -10:00
J. Nick Koston
1df2896796 Merge branch 'raw_tcp_mem' into integration 2025-10-10 20:04:39 -10:00
J. Nick Koston
3f49a61b03 tweak 2025-10-10 20:01:16 -10:00
J. Nick Koston
ec44856537 Merge branch 'integration' into memory_api 2025-10-10 19:44:02 -10:00
J. Nick Koston
a00cda32c7 Merge branch 'raw_tcp_mem' into integration 2025-10-10 19:43:53 -10:00
J. Nick Koston
8a4bd0f21c [socket] Split LWIP socket classes to reduce memory overhead on ESP8266/RP2040 2025-10-10 19:42:41 -10:00
J. Nick Koston
ee3af3904f Merge remote-tracking branch 'origin/memory_api' into memory_api 2025-10-10 17:39:56 -10:00
J. Nick Koston
02de8f9f80 merge 2025-10-10 17:39:37 -10:00
J. Nick Koston
9722c8eb60 Merge remote-tracking branch 'origin/integration' into memory_api 2025-10-10 17:39:14 -10:00
J. Nick Koston
29fb40a89f Merge branch 'integration' into memory_api 2025-10-10 17:39:01 -10:00
J. Nick Koston
1c7ff84e6a Merge branch 'partial_revert_10862' into integration 2025-10-10 17:38:53 -10:00
J. Nick Koston
632cd929ac adj 2025-10-10 17:38:26 -10:00
J. Nick Koston
3ea929eeb2 adj 2025-10-10 17:37:36 -10:00
J. Nick Koston
36ab68c1ea [esp32_ble] Partial revert of #10862 - Fix GATT client notifications 2025-10-10 17:31:13 -10:00
dependabot[bot]
b54beb357a Bump github/codeql-action from 4.30.7 to 4.30.8 (#11163)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-10 13:46:27 -10:00
J. Nick Koston
6abc2efd96 [json] Fix PSRAM allocator dangling pointer crash (#11165) 2025-10-10 21:18:57 +00:00
J. Nick Koston
e972767a11 Merge branch 'integration' into memory_api 2025-10-09 22:48:13 -10:00
J. Nick Koston
4890720c0e Merge branch 'mdns_back_compat' into integration 2025-10-09 22:48:05 -10:00
J. Nick Koston
cdc87a4445 [mdns] Restore mdns_txt_record() public API for external components 2025-10-09 22:46:45 -10:00
J. Nick Koston
be51093a7e [ci][tests] Remove all redundant ESP32-C3 Arduino tests (#11154) 2025-10-10 16:02:18 +13:00
J. Nick Koston
06a0ab6839 Merge branch 'integration' into memory_api 2025-10-09 16:04:24 -10:00
J. Nick Koston
6cc5b7c3af Merge remote-tracking branch 'upstream/dev' into integration 2025-10-09 16:04:16 -10:00
J. Nick Koston
52219c4dcc [datetime][ci][tests] Replace test.all.yaml with minimal platform cover (#11151) 2025-10-09 13:45:59 -10:00
J. Nick Koston
590cae13c0 [ci][tests] Remove redundant ESP32-C3 Arduino tests for non-variant-specific components (#11152) 2025-10-09 18:41:50 -05:00
J. Nick Koston
e15429b0f5 [opentherm][ci][tests] Remove redundant ESP32 Arduino tests and simplify conditionals (#11149) 2025-10-09 23:38:34 +00:00
J. Nick Koston
b5cc668a45 [ci][logger][tests] Remove redundant ESP32 Arduino test files (#11144) 2025-10-09 13:30:05 -10:00
Jonathan Swoboda
a1b0ae78e0 [stale] Increase operations-per-run (#11135)
CI passed, stuck on status
2025-10-09 19:10:09 -04:00
J. Nick Koston
88082911e9 [opentherm][ci][tests] Remove redundant ESP32 Arduino tests and fix conditionals 2025-10-09 12:24:37 -10:00
J. Nick Koston
fcc8a809e6 [ci][debug][tests] Remove redundant ESP32 variant Arduino test files (#11146) 2025-10-09 16:57:40 -05:00
J. Nick Koston
48474c0f8c [ci][time][tests] Remove redundant ESP32 Arduino test files (#11147) 2025-10-09 16:57:11 -05:00
J. Nick Koston
9f9c95dd09 [network][ci][tests] Remove redundant ESP32 Arduino test files (#11148) 2025-10-09 16:56:53 -05:00
J. Nick Koston
a74fcbc8b6 [esp32_ble_beacon, esp32_ble_tracker] Remove unused Arduino includes and redundant tests (#11140) 2025-10-09 11:42:25 -10:00
J. Nick Koston
c8b898f9c5 [ci][mdns][tests] Remove redundant ESP32 Arduino test files (#11143) 2025-10-09 11:40:47 -10:00
J. Nick Koston
81bf2688b4 [esp32] Update migration warning for Arduino-as-IDF-component transition (#11142) 2025-10-09 11:36:31 -10:00
Jonathan Swoboda
87d2c9868f [esp32] Update IDF 5.5 and Arduino 3.3 to use 55.03.31-1 (#11120) 2025-10-09 21:27:36 +00:00
J. Nick Koston
968d1e2647 Merge branch 'integration' into memory_api 2025-10-09 10:41:47 -10:00
J. Nick Koston
5a4f1dd2da Merge branch 'esp32_remove_esp32_ard_apis' into integration 2025-10-09 10:41:40 -10:00
J. Nick Koston
d8af6e0c75 fix 2025-10-09 10:40:02 -10:00
J. Nick Koston
36bcd8c204 fix 2025-10-09 10:39:51 -10:00
J. Nick Koston
5b146e1f12 fix 2025-10-09 10:39:41 -10:00
J. Nick Koston
de8a4ff6b0 Merge branch 'integration' into memory_api 2025-10-09 10:33:08 -10:00
J. Nick Koston
d837a001db Merge branch 'esp32_remove_esp32_ard_apis' into integration 2025-10-09 10:33:01 -10:00
J. Nick Koston
df71198a24 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-09 10:32:58 -10:00
J. Nick Koston
5a5bebe71e Merge branch 'integration' of https://github.com/esphome/esphome into integration 2025-10-09 10:32:52 -10:00
J. Nick Koston
8853593a7b [esp32_ble*] Remove Arduino BLE wrapper dependencies 2025-10-09 10:32:04 -10:00
J. Nick Koston
5ca407e27c [mdns] Store TXT record values in flash to reduce heap usage (#11114) 2025-10-10 09:01:58 +13:00
dependabot[bot]
5bbc2ab482 Bump pyupgrade from 3.20.0 to 3.21.0 (#11139)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-09 19:40:40 +00:00
J. Nick Koston
309e8b4c92 [ci][improv_serial][tests] Remove redundant ESP32 Arduino test files (#11138) 2025-10-09 19:17:04 +00:00
Jesse Hills
eee2987c99 Merge branch 'beta' into dev 2025-10-10 07:53:53 +13:00
J. Nick Koston
061e55f8c5 [ci][ethernet][tests] Remove redundant Arduino tests for ethernet PHYs (#11137) 2025-10-09 08:45:45 -10:00
Jesse Hills
9ad462d8c6 Merge pull request #11115 from esphome/bump-2025.10.0b1
2025.10.0b1
2025-10-10 07:28:02 +13:00
J. Nick Koston
56334b7832 [ci][tests] Remove redundant ESP32 Arduino test files (#11136) 2025-10-10 07:26:41 +13:00
J. Nick Koston
a4b7e0c700 [canbus][mcp23xxx_base] Mark virtual methods as pure virtual to fix linker errors (#11133) 2025-10-09 07:41:49 -10:00
Jeff Brown
84ad7ee0e4 [esp32] Accept more framework URL schemes as sources (#11125) 2025-10-09 13:10:48 -04:00
dependabot[bot]
d006008539 Bump esphome-dashboard from 20250904.0 to 20251009.0 (#11123)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-09 09:26:38 -04:00
J. Nick Koston
f1af9d978c [ci] Reduce component test group size to 10 to prevent runner disk exhaustion (#11122) 2025-10-09 10:36:13 +13:00
J. Nick Koston
6bb1e4c9c0 [ci] Reduce component test group size to 10 to prevent runner disk exhaustion (#11122) 2025-10-09 10:35:52 +13:00
J. Nick Koston
c756e132a7 Merge branch 'integration' into memory_api 2025-10-08 09:28:07 -10:00
J. Nick Koston
e5a0a1d143 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-08 09:27:34 -10:00
J. Nick Koston
785df05631 [ci] Reduce component test group size to prevent runner disk exhaustion (#11121) 2025-10-09 07:53:49 +13:00
J. Nick Koston
82bdb08884 [ci] Reduce component test group size to prevent runner disk exhaustion (#11121) 2025-10-08 14:24:26 -04:00
J. Nick Koston
98e68c32ee Merge branch 'integration' into memory_api 2025-10-08 05:50:03 -10:00
J. Nick Koston
b33b68b885 Merge branch 'webserver_helpers' into integration 2025-10-08 05:49:55 -10:00
J. Nick Koston
9ac48b162b tweak 2025-10-08 05:48:56 -10:00
J. Nick Koston
41d07701ee tweak 2025-10-08 05:46:20 -10:00
J. Nick Koston
fed252d1d3 wip 2025-10-08 05:40:31 -10:00
J. Nick Koston
2b8fdfb6a6 [web_server] Reduce code duplication in JSON generation with helper functions 2025-10-08 05:22:15 -10:00
J. Nick Koston
2ea32635c9 Merge branch 'integration' into memory_api 2025-10-08 05:12:32 -10:00
J. Nick Koston
8c876ec07d Merge branch 'webserver_dupe_checks' into integration 2025-10-08 05:12:22 -10:00
J. Nick Koston
576cf8ed6d [web_server] Consolidate duplicate client connection checks (saves 288 bytes flash) 2025-10-08 05:11:34 -10:00
J. Nick Koston
48799517eb Merge branch 'integration' into memory_api 2025-10-07 22:55:15 -10:00
J. Nick Koston
3e8672f351 Merge branch 'mdns_value_flash' into integration 2025-10-07 22:55:08 -10:00
J. Nick Koston
16f7de29eb Merge remote-tracking branch 'upstream/dev' into mdns_value_flash 2025-10-07 22:51:06 -10:00
J. Nick Koston
b1e950e785 better cond 2025-10-07 22:45:54 -10:00
J. Nick Koston
a0d9098f41 Merge branch 'integration' into memory_api 2025-10-07 22:34:07 -10:00
J. Nick Koston
e1852bdd59 Merge branch 'mdns_value_flash' into integration 2025-10-07 22:34:00 -10:00
J. Nick Koston
6eef594110 Merge remote-tracking branch 'origin/mdns_value_flash' into mdns_value_flash 2025-10-07 22:33:48 -10:00
J. Nick Koston
b22e154284 just remove it 2025-10-07 22:33:37 -10:00
J. Nick Koston
a793690795 Merge branch 'dev' into mdns_value_flash 2025-10-07 22:23:27 -10:00
J. Nick Koston
fc0afa1793 Merge branch 'integration' into memory_api 2025-10-07 22:22:31 -10:00
J. Nick Koston
d80e7a5ab6 Merge branch 'mdns_value_flash' into integration 2025-10-07 22:22:26 -10:00
J. Nick Koston
f33d9a77f3 bot comments 2025-10-07 22:22:12 -10:00
Jesse Hills
b709ff84c3 Bump version to 2025.11.0-dev 2025-10-08 21:14:45 +13:00
Jesse Hills
93266ad08f Bump version to 2025.10.0b1 2025-10-08 21:14:44 +13:00
Jesse Hills
2fac813f18 [epaper_spi] New epaper component (#10462)
Co-authored-by: Keith Burzinski <kbx81x@gmail.com>
Co-authored-by: Tudor Sandu <tm.sandu@gmail.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-08 21:11:06 +13:00
J. Nick Koston
734a0f3998 static analysis 2025-10-07 22:01:22 -10:00
J. Nick Koston
21d4e090bf Merge branch 'integration' into memory_api 2025-10-07 21:52:06 -10:00
J. Nick Koston
fe8af38f62 Merge branch 'mdns_value_flash' into integration 2025-10-07 21:51:56 -10:00
J. Nick Koston
d7964c4068 Merge branch 'dev' into integration 2025-10-07 21:51:53 -10:00
J. Nick Koston
72087bf6ba store mdns values in flash 2025-10-07 21:48:18 -10:00
Jesse Hills
a62c7a03dd [api] Add support for getting action responses from home-assistant (#10948)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-08 20:47:36 +13:00
J. Nick Koston
f5bb79cbc4 goodbye strdup 2025-10-07 21:46:08 -10:00
J. Nick Koston
d9c3213ef6 goodbye strdup 2025-10-07 21:43:35 -10:00
J. Nick Koston
328c1a8469 goodbye strdup 2025-10-07 21:39:04 -10:00
J. Nick Koston
6c0a0334a8 preen 2025-10-07 21:26:56 -10:00
J. Nick Koston
1476dcf5c8 preen 2025-10-07 21:24:10 -10:00
J. Nick Koston
ac7bd4137f preen 2025-10-07 21:22:34 -10:00
J. Nick Koston
52f2826d38 preen 2025-10-07 21:21:22 -10:00
J. Nick Koston
55888b9bee store mdns values in flash 2025-10-07 21:19:35 -10:00
J. Nick Koston
ec63247ae0 [mdns] Fix delete/malloc bug and store string constants in flash (#11105) 2025-10-08 04:19:29 +00:00
carlessolegrau
0fe6e7169c [modbus_controller] courtesy response (#10027)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-08 16:40:49 +13:00
dependabot[bot]
a0f4de1bfb Bump aioesphomeapi from 41.12.0 to 41.13.0 (#11113)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-08 03:35:17 +00:00
Jesse Hills
a541549d23 [core] Fix dynamic auto load priority (#11112) 2025-10-07 17:05:09 -10:00
Jonathan Swoboda
b74715fe14 [esp32] Fix issue when framework source is set (#11106) 2025-10-07 22:55:59 -04:00
J. Nick Koston
181f360176 Merge branch 'integration' into memory_api 2025-10-07 16:21:40 -10:00
J. Nick Koston
4acbf03f4e Merge branch 'jesserockz-2025-457' into integration 2025-10-07 16:21:32 -10:00
J. Nick Koston
5e16d84e0c Merge branch 'dev' into jesserockz-2025-457 2025-10-07 21:12:50 -05:00
J. Nick Koston
58796141e9 Merge branch 'integration' into memory_api 2025-10-07 16:12:17 -10:00
J. Nick Koston
a554d8b122 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-07 16:11:56 -10:00
J. Nick Koston
5aff20a624 [api] Add message size limits to prevent memory exhaustion (#10936) 2025-10-08 00:47:31 +00:00
J. Nick Koston
76c8da03fe Merge branch 'integration' into memory_api 2025-10-07 14:10:20 -10:00
J. Nick Koston
b5ef87a1b8 Merge branch 'api_size_limits' into integration 2025-10-07 14:10:14 -10:00
J. Nick Koston
7f13080478 Merge branch 'mdns_esp32_cleanup' into integration 2025-10-07 14:10:10 -10:00
J. Nick Koston
2c408b7d78 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-07 14:10:03 -10:00
J. Nick Koston
43c7ebcab4 missed python 2025-10-07 14:06:28 -10:00
J. Nick Koston
e3fadb1858 missed python 2025-10-07 14:05:22 -10:00
J. Nick Koston
a991768772 missed python 2025-10-07 14:02:39 -10:00
Kevin Ahrendt
7682b4e9a3 [audio] Update esp-audio-libs 2.0.1 to use new FLAC decoder (#10974)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-07 23:35:42 +00:00
J. Nick Koston
b9e2a30a38 Update test_oversized_payloads.py 2025-10-07 18:17:17 -05:00
J. Nick Koston
cb578c2198 Update test_oversized_payloads.py 2025-10-07 18:16:20 -05:00
J. Nick Koston
3b06b3386f Merge branch 'integration' into memory_api 2025-10-07 17:47:36 -05:00
J. Nick Koston
3a68268f39 Merge branch 'api_size_limits' into integration 2025-10-07 17:47:04 -05:00
J. Nick Koston
ef1c12c21f adjust 2025-10-07 17:37:50 -05:00
J. Nick Koston
6107802d69 Merge remote-tracking branch 'upstream/dev' into memory_api 2025-10-07 17:17:47 -05:00
J. Nick Koston
f59d2d5aca Merge branch 'integration' into memory_api 2025-10-07 17:16:24 -05:00
J. Nick Koston
453eecb240 Merge branch 'mdns_esp32_cleanup' into integration 2025-10-07 17:16:15 -05:00
J. Nick Koston
fa66b3235d tidy 2025-10-07 16:58:59 -05:00
J. Nick Koston
7446c87267 tidy 2025-10-07 16:58:19 -05:00
J. Nick Koston
57bd6ec68c tidy 2025-10-07 16:46:26 -05:00
J. Nick Koston
95ecacc5f7 tidy 2025-10-07 16:39:40 -05:00
J. Nick Koston
2e1d5662ea tidy 2025-10-07 16:34:51 -05:00
J. Nick Koston
87a1040285 keep all 8266 in flash 2025-10-07 16:29:10 -05:00
Jonathan Swoboda
6eabf709c6 [esp32] Hide build warnings (#11102) 2025-10-08 10:27:56 +13:00
J. Nick Koston
71765f01e6 Merge branch 'dev' into api_size_limits 2025-10-07 16:18:23 -05:00
J. Nick Koston
6209d4b493 [api] Optimize frame helpers to eliminate double-move overhead (#11092) 2025-10-08 10:16:44 +13:00
J. Nick Koston
1a6aaedbb7 preen 2025-10-07 16:16:36 -05:00
J. Nick Koston
b49f60569e tidy 2025-10-07 15:50:51 -05:00
J. Nick Koston
63a94df74f tidy 2025-10-07 15:47:19 -05:00
J. Nick Koston
15968cd8be Merge branch 'integration' into memory_api 2025-10-07 15:42:36 -05:00
J. Nick Koston
7693545d86 Merge branch 'mdns_esp32_cleanup' into integration 2025-10-07 15:42:10 -05:00
J. Nick Koston
f10c361454 [esp32_ble] Refactor ESPBTUUID comparison with direct returns and memcmp (#11074) 2025-10-08 09:34:08 +13:00
J. Nick Koston
f0a7c6b0bb simplify 2025-10-07 15:32:59 -05:00
J. Nick Koston
27456c1370 [esp32_ble] Refactor ESPBTUUID::from_raw to use parse_hex helpers (#11073) 2025-10-08 09:32:47 +13:00
J. Nick Koston
711532465e simplify 2025-10-07 15:27:49 -05:00
J. Nick Koston
2e4722104e simplify 2025-10-07 15:25:13 -05:00
J. Nick Koston
c9a709675a simplify 2025-10-07 15:25:13 -05:00
J. Nick Koston
65b8148f2e simplify 2025-10-07 15:24:48 -05:00
J. Nick Koston
93d493004c simplify 2025-10-07 15:24:42 -05:00
J. Nick Koston
1aeefbe547 [light] Reduce flash usage by eliminating duplicate validation code (#11030)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-08 09:23:57 +13:00
J. Nick Koston
94eab93110 Merge branch 'integration' into memory_api 2025-10-07 14:59:21 -05:00
J. Nick Koston
762c141d93 Merge branch 'mdns_esp32_cleanup' into integration 2025-10-07 14:59:15 -05:00
J. Nick Koston
cf1ba30e90 just store key in flash 2025-10-07 14:54:28 -05:00
J. Nick Koston
7bc1f23d6c Merge branch 'dev' into jesserockz-2025-457 2025-10-07 14:52:47 -05:00
J. Nick Koston
9cecbee33a revise 2025-10-07 14:44:38 -05:00
J. Nick Koston
03884d05b4 fix test 2025-10-07 14:34:03 -05:00
dependabot[bot]
3f3bce7ef4 Bump ruff from 0.13.3 to 0.14.0 (#11107)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-07 19:27:21 +00:00
J. Nick Koston
0fa47e3bf5 Merge branch 'dev' into jesserockz-2025-457 2025-10-07 14:25:18 -05:00
Jesse Hills
0acc58d5a1 [core] Update helpers for new auto load functionality (#11097) 2025-10-07 14:24:28 -05:00
dependabot[bot]
0b4ef0fea2 Bump github/codeql-action from 3.30.6 to 4.30.7 (#11109)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-07 14:22:36 -05:00
dependabot[bot]
a067bdb769 Bump aioesphomeapi from 41.11.0 to 41.12.0 (#11108)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-07 14:21:35 -05:00
J. Nick Koston
cbd30ce37a as const object 2025-10-08 07:32:12 +13:00
J. Nick Koston
cd4c4eab35 remove std::map, only 1 or 2 callbacks in flight ever 2025-10-08 07:29:56 +13:00
J. Nick Koston
1f557b46b3 fix ifdefs 2025-10-08 07:28:35 +13:00
J. Nick Koston
b89c230e6a Merge branch 'integration' into memory_api 2025-10-07 11:14:50 -05:00
J. Nick Koston
afdc59acb4 Merge branch 'mdns_esp32_cleanup' into integration 2025-10-07 11:14:43 -05:00
J. Nick Koston
0dcc1baf41 [mdns] Fix undefined behavior from delete/malloc mismatch in ESP32 service registration 2025-10-07 10:52:46 -05:00
J. Nick Koston
4088dbfdb6 Merge branch 'integration' into memory_api 2025-10-07 09:50:11 -05:00
J. Nick Koston
646430a337 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-07 09:50:05 -05:00
Jesse Hills
301e7a7ac5 [const] Move CONF_CAPTURE_RESPONSE to const.py (#11096) 2025-10-07 03:15:56 -05:00
Jesse Hills
49b271747d Add missing ifdef 2025-10-07 20:11:43 +13:00
Jesse Hills
9608d8793c Fix order 2025-10-07 17:41:16 +13:00
Jesse Hills
5c49e8b984 Merge branch 'jesserockz-2025-477' into jesserockz-2025-457 2025-10-07 17:39:40 +13:00
Jesse Hills
5d73eab245 Merge branch 'jesserockz-2025-478' into jesserockz-2025-457 2025-10-07 17:39:28 +13:00
Jesse Hills
317ce77197 [core] Update helpers for new auto load functionality 2025-10-07 17:38:21 +13:00
Jesse Hills
635ef722b5 [const] Move CONF_CAPTURE_RESPONSE to const.py 2025-10-07 17:31:47 +13:00
Jesse Hills
f95b4bfce5 Update test 2025-10-07 17:26:44 +13:00
Jesse Hills
a11bef0558 Handle action status response without json 2025-10-07 17:25:35 +13:00
J. Nick Koston
b2699f5e37 Merge branch 'integration' into memory_api 2025-10-06 17:42:49 -05:00
J. Nick Koston
c80fd0c038 Merge branch 'fix_double_move' into integration 2025-10-06 17:42:43 -05:00
J. Nick Koston
a051cff931 preen 2025-10-06 17:37:49 -05:00
J. Nick Koston
517f59afe4 [api] Optimize frame helpers to eliminate double-move overhead 2025-10-06 17:27:05 -05:00
J. Nick Koston
1cf5290f28 Merge branch 'integration' into memory_api 2025-10-06 17:20:32 -05:00
J. Nick Koston
02ef1351fd Merge branch 'fix_double_move' into integration 2025-10-06 17:20:26 -05:00
J. Nick Koston
8821529f6e [api] Optimize frame helpers to eliminate double-move overhead 2025-10-06 17:19:10 -05:00
J. Nick Koston
ac566b7fd6 [clang-tidy] Include sdkconfig.defaults in hash calculation (#11091) 2025-10-06 22:06:30 +00:00
J. Nick Koston
e95be061b3 Merge branch 'dev' into jesserockz-2025-457 2025-10-06 15:54:29 -05:00
J. Nick Koston
fddb8b35f2 [esp32] Fix clang-tidy error for Arduino watchdog function declarations (#11085) 2025-10-06 16:54:13 -04:00
J. Nick Koston
242b81f3f0 Merge branch 'esp32_core' into jesserockz-2025-457 2025-10-06 15:45:54 -05:00
J. Nick Koston
38b727e0b8 Merge branch 'dev' into jesserockz-2025-457 2025-10-06 15:45:43 -05:00
J. Nick Koston
514830b372 sdkconfig instead 2025-10-06 15:41:48 -05:00
J. Nick Koston
39c1c9e837 Merge remote-tracking branch 'upstream/dev' into esp32_core 2025-10-06 15:41:34 -05:00
Jesse Hills
27e1095cd7 [core] Allow AUTO_LOAD to receive the component config to determine if it should load other components (#10961)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-06 15:36:27 -05:00
J. Nick Koston
b0e15cdabd oops they are bool 2025-10-06 15:24:57 -05:00
Mariusz Kryński
fa4541a4f3 [mcp2515] setup filters (#10486) 2025-10-06 16:10:46 -04:00
J. Nick Koston
3dbdcab7e5 try a forward dec 2025-10-06 15:06:26 -05:00
J. Nick Koston
0887164d38 Merge branch 'dev' into esp32_core 2025-10-06 14:34:50 -05:00
J. Nick Koston
24dcc1843e [time] Fix clang-tidy sign comparison errors (#11080) 2025-10-06 14:34:40 -05:00
J. Nick Koston
c4f0f14696 [esp32] Fix clang-tidy error for Arduino watchdog function declarations 2025-10-06 14:33:10 -05:00
J. Nick Koston
f670d775ac [api] Fix clang-tidy sign comparison error (#11081) 2025-10-06 19:26:58 +00:00
J. Nick Koston
cb8765a1dd Merge branch 'integration' into memory_api 2025-10-06 14:17:42 -05:00
J. Nick Koston
a76af3ca65 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-06 14:17:33 -05:00
J. Nick Koston
59a31adac2 [waveshare_epaper] Fix clang-tidy sign comparison errors (#11079) 2025-10-07 08:14:28 +13:00
dependabot[bot]
a3c0acc7c9 Bump pylint from 3.3.8 to 3.3.9 (#11082)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-06 14:13:48 -05:00
dependabot[bot]
ad2c5b96a9 Bump zeroconf from 0.147.2 to 0.148.0 (#11083)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-06 19:11:04 +00:00
Jesse Hills
8ef8a7eaaf Merge branch 'dev' into jesserockz-2025-457 2025-10-07 07:35:49 +13:00
J. Nick Koston
9adc3bd943 [veml7700] Fix clang-tidy sign comparison errors (#11078) 2025-10-06 18:24:05 +00:00
J. Nick Koston
ad296a7d74 [uponor_smatrix] Fix clang-tidy sign comparison errors (#11076) 2025-10-06 18:20:56 +00:00
J. Nick Koston
fdd422c42a [tormatic] Fix clang-tidy sign comparison error (#11075) 2025-10-06 13:14:52 -05:00
J. Nick Koston
553b65b998 Merge branch 'integration' into memory_api 2025-10-06 12:41:56 -05:00
J. Nick Koston
ce92b9b810 Merge branch 'uuid_compare_was_overly_complex' into integration 2025-10-06 12:41:51 -05:00
J. Nick Koston
d2cad4cae9 [esp32_ble] Refactor ESPBTUUID comparison with direct returns and memcmp 2025-10-06 12:40:04 -05:00
J. Nick Koston
5daccc92c6 Merge branch 'integration' into memory_api 2025-10-06 12:34:44 -05:00
J. Nick Koston
88230b9400 Merge branch 'espuuid_hex' into integration 2025-10-06 12:34:38 -05:00
J. Nick Koston
3d82301c3d [graph] Fix clang-tidy sign comparison error (#11051) 2025-10-06 13:28:43 -04:00
J. Nick Koston
2fa49be17d [haier] Fix clang-tidy sign comparison error (#11053) 2025-10-06 13:27:15 -04:00
J. Nick Koston
75867842ea [rtttl] Fix clang-tidy sign comparison error (#11065) 2025-10-06 13:26:59 -04:00
Stephen Kent
cba85c0925 [remote_receiver] Add signal demodulation support on ESP32 (#8711)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-06 13:24:58 -04:00
J. Nick Koston
42d1269aaf [esp32_ble_server] Use early returns in is_created() and is_failed() methods (#11072) 2025-10-06 17:16:25 +00:00
J. Nick Koston
f4df17673b [esp32_ble_server] Refactor property setters to reduce code duplication (#11071) 2025-10-06 12:15:06 -05:00
J. Nick Koston
c2d75bf29a [esp32_ble] Refactor ESPBTUUID::from_raw to use parse_hex helpers 2025-10-06 12:12:54 -05:00
J. Nick Koston
e340397b41 [mipi_spi] Fix clang-tidy sign comparison errors (#11070) 2025-10-06 13:10:41 -04:00
J. Nick Koston
4b09d3a11b Merge branch 'integration' into memory_api 2025-10-06 12:00:27 -05:00
J. Nick Koston
88ef521129 Merge branch 'esp32_ble_server_early_bail' into integration 2025-10-06 12:00:21 -05:00
J. Nick Koston
63a48dd1d8 adjust confusing comment 2025-10-06 11:59:34 -05:00
J. Nick Koston
fae8b5f16a Merge branch 'integration' into memory_api 2025-10-06 11:57:44 -05:00
J. Nick Koston
40da1b73cc Merge branch 'esp32_ble_server_early_bail' into integration 2025-10-06 11:57:37 -05:00
J. Nick Koston
2294bdd8f0 Merge branch 'esp32_ble_server_cleanup' into integration 2025-10-06 11:57:34 -05:00
J. Nick Koston
f4b3732ee1 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-06 11:57:24 -05:00
J. Nick Koston
c3ac3736cf [esp32_ble_server] Use early returns in is_created() and is_failed() methods 2025-10-06 11:55:04 -05:00
J. Nick Koston
abeadc7830 [remote_base] Fix clang-tidy sign comparison error (#11064) 2025-10-06 11:49:50 -05:00
J. Nick Koston
9280a8762c [esp32_ble_server] Refactor property setters to reduce code duplication 2025-10-06 11:47:16 -05:00
Beormund
8d4b347e5c [lm75b] Add LM75B temperature sensor component (#10534) 2025-10-06 12:36:33 -04:00
J. Nick Koston
a7f556c25f [esp32_ble] Fix clang-tidy sign comparison error (#11048) 2025-10-06 11:28:41 -05:00
J. Nick Koston
3f4250fcd7 [st7567_i2c] Fix clang-tidy sign comparison warning (#11067) 2025-10-06 12:27:34 -04:00
J. Nick Koston
b532e04ae4 [st7789v] Fix clang-tidy sign comparison errors (#11068)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 16:24:52 +00:00
Jesse Hills
697cab45dd [json] Add parse_json overload for const char * (#11039)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-06 11:19:31 -05:00
J. Nick Koston
a88182c8e3 [statsd] Fix clang-tidy sign comparison error (#11069) 2025-10-06 12:12:39 -04:00
J. Nick Koston
8cfb6578d1 [graphical_display_menu] Fix clang-tidy sign comparison errors (#11052) 2025-10-06 12:10:54 -04:00
J. Nick Koston
eb16d322cd [audio, i2s_audio] Fix clang-tidy sign comparison errors (#11044) 2025-10-06 12:07:44 -04:00
J. Nick Koston
22e06ba063 [matrix_keypad] Fix clang-tidy sign comparison error (#11059)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-06 11:53:24 -04:00
Mort
7147479f90 [qmc5883l] Added drdy_pin option to allow it to run max rate (#10901)
Co-authored-by: Lamer Mortification <lamer_mortification@yahoo.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-06 11:48:05 -04:00
J. Nick Koston
e55df1babc [key_collector] Fix clang-tidy sign comparison errors (#11056)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-06 11:34:18 -04:00
J. Nick Koston
4c8fc5f4e6 [pid] Fix clang-tidy sign comparison error (#11063) 2025-10-06 11:20:59 -04:00
J. Nick Koston
646508006c [ili9xxx] Fix clang-tidy sign comparison errors (#11054) 2025-10-06 11:02:54 -04:00
J. Nick Koston
9384f0683b [kamstrup_kmp] Fix clang-tidy sign comparison errors (#11055) 2025-10-06 11:02:02 -04:00
J. Nick Koston
5e7f5bf890 [ltr501] Fix clang-tidy sign comparison errors (#11057) 2025-10-06 10:59:36 -04:00
J. Nick Koston
2a8796437d [ltr_als_ps] Fix clang-tidy sign comparison errors (#11058) 2025-10-06 10:59:02 -04:00
J. Nick Koston
1635767aa2 [max7219digit] Fix clang-tidy sign comparison error (#11060) 2025-10-06 10:56:44 -04:00
J. Nick Koston
192856e8d1 [nau7802] Fix clang-tidy sign comparison errors (#11062) 2025-10-06 09:52:47 -05:00
J. Nick Koston
71be5a5f65 [mixer] Fix clang-tidy sign comparison errors (#11061) 2025-10-06 14:48:39 +00:00
J. Nick Koston
f86b83cda5 [fingerprint_grow] Fix clang-tidy sign comparison error (#11050) 2025-10-06 10:15:56 -04:00
J. Nick Koston
74c055745f [esp32_can] Fix clang-tidy sign comparison error (#11049) 2025-10-06 10:14:24 -04:00
J. Nick Koston
3edcdc7d80 [es7210] Fix clang-tidy sign comparison errors (#11047) 2025-10-06 10:13:12 -04:00
J. Nick Koston
94fea68e3e [daikin_arc] Fix clang-tidy sign comparison errors (#11046) 2025-10-06 10:12:40 -04:00
J. Nick Koston
6880f9fc5c [cm1106] Fix clang-tidy sign comparison error (#11045) 2025-10-06 10:09:10 -04:00
J. Nick Koston
26ebac8cb8 [bl0906, bl0942] Fix clang-tidy sign comparison errors (#11043)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 10:08:33 -04:00
J. Nick Koston
5cf0046601 [animation] Fix clang-tidy sign comparison errors (#11042) 2025-10-06 10:07:44 -04:00
J. Nick Koston
c68017ddb4 [online_image] Fix clang-tidy sign comparison errors (#11041) 2025-10-06 10:07:04 -04:00
Jesse Hills
0e0b67f126 Split response and error triggers
Simplify variables in response lambdas to JsonObject
Use `const char *` for message and parse to json right away
2025-10-06 17:04:47 +13:00
J. Nick Koston
3ab91e1f8b Merge branch 'integration' into memory_api 2025-10-05 22:51:51 -05:00
J. Nick Koston
b503e49739 revert 2025-10-05 22:51:36 -05:00
Keith Burzinski
cfd241ff29 [zwave_proxy] Send HomeID upon client connect (#11037) 2025-10-06 03:47:55 +00:00
J. Nick Koston
a159e4762a Merge branch 'dev' into api_size_limits 2025-10-05 22:29:00 -05:00
Clyde Stubbs
f757a19e82 [mipi] Fix rotation handling (#11010) 2025-10-06 14:05:44 +11:00
J. Nick Koston
e8854e0659 [esp32_ble] Fix max_connections architecture (shared client+server limit) (#11006) 2025-10-06 02:45:44 +00:00
Edward Firmo
a3622d878d [nextion] Reduce DEBUG logs on events (#11014) 2025-10-05 21:11:36 -04:00
Jesse Hills
a405592385 Update esphome/components/api/__init__.py
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-06 13:32:09 +13:00
Jonathan Swoboda
da2089c8be [core] Remove platformio install from setup (#10997) 2025-10-06 13:10:05 +13:00
J. Nick Koston
118663f9e2 [web_server] Use IDF web server for ESP32 Arduino builds (#10991) 2025-10-05 19:07:52 -05:00
J. Nick Koston
4a99987bfe [tuya] Fix clang-tidy signed/unsigned comparison warning (#11035) 2025-10-06 13:07:00 +13:00
J. Nick Koston
d164c06f01 [sonoff_d1] Fix clang-tidy signed/unsigned comparison warning (#11034) 2025-10-06 13:06:43 +13:00
J. Nick Koston
972987acdf [esp32_rmt_led_strip] Fix clang-tidy signed/unsigned comparison warning (#11033) 2025-10-06 13:06:26 +13:00
J. Nick Koston
eea2b6b81b [esp32_ble] Optimize string operations to reduce flash usage by 264 bytes (#11023) 2025-10-06 13:04:50 +13:00
J. Nick Koston
f62e06104e [wifi] Optimize logging to reduce flash usage by 284 bytes on ESP8266 (#11022) 2025-10-06 13:03:26 +13:00
J. Nick Koston
0a45aad842 Merge branch 'integration' into memory_api 2025-10-05 17:23:15 -05:00
J. Nick Koston
2919f14100 merge 2025-10-05 17:23:06 -05:00
J. Nick Koston
0e04b5ce61 Merge branch 'integration' into memory_api 2025-10-05 17:22:14 -05:00
J. Nick Koston
825e110f1a Merge remote-tracking branch 'upstream/dev' into integration 2025-10-05 17:22:08 -05:00
J. Nick Koston
6cedaee76a Merge branch 'light_validation_dupe_code' into integration 2025-10-05 17:21:45 -05:00
J. Nick Koston
a65b75efe3 Update esphome/components/light/light_call.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-05 17:21:26 -05:00
J. Nick Koston
f26e71bae6 [ci] Fix clang-tidy after Arduino-as-IDF-component migration (#11031) 2025-10-05 22:16:09 +00:00
J. Nick Koston
c9a70eb270 Merge branch 'wifi_logging_opt' into memory_api 2025-10-05 17:11:28 -05:00
J. Nick Koston
71a254a126 Merge branch 'integration' into memory_api 2025-10-05 17:10:30 -05:00
J. Nick Koston
b963526d2f Merge branch 'esp32_ble_server_unique_ptr_mfr_data' into integration 2025-10-05 17:10:24 -05:00
Jonathan Swoboda
c6e4a7911c [esp32] Improve version handling (#10899)
Co-authored-by: J. Nick Koston <nick@koston.org>
2025-10-05 22:10:23 +00:00
J. Nick Koston
6b5d1b4400 Merge branch 'light_validation_dupe_code' into integration 2025-10-05 17:08:54 -05:00
J. Nick Koston
6b87187c66 [esp32_ble_server] Optimize manufacturer_data storage to reduce memory overhead 2025-10-05 17:00:32 -05:00
J. Nick Koston
e2c5eeef97 [scheduler] Deduplicate item removal code with template helper (#11017) 2025-10-05 16:32:51 -05:00
J. Nick Koston
7ea51b1865 [esphome.ota] Fix ESP32-S3 OTA authentication with hardware SHA acceleration (#11011) 2025-10-06 10:17:28 +13:00
J. Nick Koston
795865e139 Merge remote-tracking branch 'upstream/dev' into ble_connections_slots_are_shared_client_server 2025-10-05 16:12:48 -05:00
J. Nick Koston
1b4c5f7976 [light] Reduce flash usage by eliminating duplicate validation code 2025-10-05 16:09:12 -05:00
J. Nick Koston
aa1afbd152 [wifi] Optimize WPA2 EAP phase2 logging to reduce memory overhead (#11005)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 10:02:41 +13:00
J. Nick Koston
20d9ae699c [logger] Conditionally compile runtime tag-specific log levels for performance (#11004) 2025-10-06 09:59:52 +13:00
J. Nick Koston
c0fb0ae06f [web_server_idf] Optimize parameter storage to reduce flash usage and memory overhead (#11003) 2025-10-06 09:57:59 +13:00
J. Nick Koston
9b6d62cd69 [web_server_idf] Fix watchdog timeout with unreliable event source connections (#11002)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-06 09:55:39 +13:00
J. Nick Koston
5932a4bd0e [web_server] Reduce flash and RAM usage by optimizing string construction (#10986) 2025-10-06 09:42:23 +13:00
J. Nick Koston
84c3cf5f17 [core] Replace std::pair with purpose-built named structs for component metadata (#10984) 2025-10-06 09:38:58 +13:00
J. Nick Koston
120a445abf [number] Reduce flash usage in NumberCall logging (#10983) 2025-10-06 09:37:47 +13:00
J. Nick Koston
41c073a451 [lock] Replace std::set with bitmask (saves 388B flash + 23B RAM per lock) (#10977) 2025-10-06 09:33:58 +13:00
J. Nick Koston
0fd71ca211 [mdns][openthread] Use StaticVector for services storage with compile-time capacity (#10976) 2025-10-06 09:30:17 +13:00
J. Nick Koston
19439199cc [api] Add configurable send queue limit to prevent OOM crashes (#10973) 2025-10-06 09:25:04 +13:00
J. Nick Koston
39d5cbc74a [esp32_ble_server] Replace EventEmitter with direct callbacks to reduce memory usage (#10946) 2025-10-06 09:20:40 +13:00
J. Nick Koston
6841d40d07 Merge branch 'integration' into memory_api 2025-10-05 14:43:26 -05:00
J. Nick Koston
58f917030e Merge remote-tracking branch 'upstream/dev' into integration 2025-10-05 14:43:19 -05:00
Jonathan Swoboda
722c5a94f2 [sps30] Clean up (#10998) 2025-10-05 09:24:09 -05:00
J. Nick Koston
7b48fc292f [api] Consolidate fatal error logging to reduce flash usage (#11015) 2025-10-05 09:56:30 -04:00
J. Nick Koston
4687e58b03 help bot 2025-10-04 22:02:32 -05:00
J. Nick Koston
b31f381444 wip 2025-10-04 21:19:26 -05:00
J. Nick Koston
6c7d92e726 [ethernet] Consolidate error handling to reduce flash usage (#11019) 2025-10-04 20:47:46 -05:00
J. Nick Koston
b1859c50bd [api] Simplify message reading conditional (#11016) 2025-10-04 21:42:21 -04:00
J. Nick Koston
3f9924eac2 [core] Merge duplicate loops in mac_address_is_valid() (#11018) 2025-10-04 21:42:07 -04:00
J. Nick Koston
f2a84052db Merge branch 'integration' into memory_api 2025-10-04 20:31:35 -05:00
J. Nick Koston
c796c02b3a Merge branch 'esp32_ble_name' into integration 2025-10-04 20:31:29 -05:00
J. Nick Koston
03d61dffad [esp32_ble] Optimize string operations to reduce flash usage by 264 bytes 2025-10-04 20:25:06 -05:00
J. Nick Koston
481c87aac3 Merge branch 'integration' into memory_api 2025-10-04 20:18:05 -05:00
J. Nick Koston
3f4a9771c5 Merge branch 'wifi_logging_opt' into integration 2025-10-04 20:17:58 -05:00
J. Nick Koston
6cf6fcf4e6 [wifi] Optimize logging to reduce flash usage by 284 bytes on ESP8266 2025-10-04 20:12:47 -05:00
J. Nick Koston
244ed9f95f Merge branch 'integration' into memory_api 2025-10-04 13:58:45 -05:00
J. Nick Koston
89c91d3ddc Merge branch 'ethernet_macro_dupe' into integration 2025-10-04 13:58:40 -05:00
J. Nick Koston
07840539d7 [ethernet] Consolidate error handling to reduce flash usage 2025-10-04 13:57:55 -05:00
J. Nick Koston
0178bd166d Merge branch 'integration' into memory_api 2025-10-04 13:48:39 -05:00
J. Nick Koston
b3fc8ccfca Merge branch 'mac_address_valid_double_loop_fix' into integration 2025-10-04 13:48:33 -05:00
J. Nick Koston
737bf2cde5 [core] Merge duplicate loops in mac_address_is_valid() 2025-10-04 13:37:41 -05:00
J. Nick Koston
1ec74583a6 Merge branch 'integration' into memory_api 2025-10-04 13:08:16 -05:00
J. Nick Koston
1b4076cc13 Merge branch 'scheduler_item_removal_dedupe_code' into integration 2025-10-04 13:08:11 -05:00
J. Nick Koston
82dbf05e7f [scheduler] Deduplicate item removal code with template helper 2025-10-04 13:07:34 -05:00
J. Nick Koston
395aef5a13 Merge branch 'integration' into memory_api 2025-10-04 12:46:45 -05:00
J. Nick Koston
9ff12c9c8f Merge branch 'api_connection_tiny_cleanup' into integration 2025-10-04 12:46:40 -05:00
J. Nick Koston
f00e9528da [api] Simplify message reading conditional 2025-10-04 12:45:51 -05:00
J. Nick Koston
8f4decdce4 Merge branch 'integration' into memory_api 2025-10-04 12:40:48 -05:00
J. Nick Koston
deede5a479 Merge branch 'api_logging_cleanups' into integration 2025-10-04 12:40:43 -05:00
J. Nick Koston
0d5eb79000 [api] Consolidate fatal error logging to reduce flash usage 2025-10-04 12:40:02 -05:00
J. Nick Koston
76afcc7647 Merge branch 'integration' into memory_api 2025-10-04 11:25:30 -05:00
J. Nick Koston
2806b5e314 Merge remote-tracking branch 'upstream/dev' into integration 2025-10-04 11:25:21 -05:00
mrtoy-me
874db20b7d [mpr121] cleaner setup (#11013) 2025-10-04 08:54:31 -04:00
J. Nick Koston
c640792482 Merge branch 'integration' into memory_api 2025-10-04 00:26:26 -05:00
J. Nick Koston
2a85ba1949 Merge branch 'ota_fix_s3' into integration 2025-10-04 00:26:20 -05:00
J. Nick Koston
44ffd08c33 [esphome.ota] Fix ESP32-S3 OTA authentication with hardware SHA acceleration 2025-10-04 00:22:18 -05:00
J. Nick Koston
2eea674c04 [json] Fix missing defines.h include causing PSRAM allocator to be unused (#11008) 2025-10-03 23:52:40 -05:00
J. Nick Koston
5600e52207 Merge branch 'integration' into memory_api 2025-10-03 20:35:52 -05:00
J. Nick Koston
c558308d6f Merge branch 'use_idf_webserver_esp32' into integration 2025-10-03 20:35:44 -05:00
J. Nick Koston
7060771cb4 missed one 2025-10-03 20:35:33 -05:00
J. Nick Koston
e27df825f8 Merge branch 'integration' into memory_api 2025-10-03 19:40:40 -05:00
J. Nick Koston
683d3fd19f Merge branch 'json_missing_define' into integration 2025-10-03 19:40:35 -05:00
J. Nick Koston
7d35c46ad3 [json] Fix missing defines.h include causing PSRAM allocator to be unused 2025-10-03 19:36:56 -05:00
J. Nick Koston
e20ad92bf7 Merge branch 'integration' into memory_api 2025-10-03 18:38:55 -05:00
J. Nick Koston
2b6fc94f31 Merge branch 'bound_tx_buf' into integration 2025-10-03 18:38:50 -05:00
J. Nick Koston
61d3a9a93a Merge remote-tracking branch 'upstream/dev' into bound_tx_buf 2025-10-03 18:38:20 -05:00
J. Nick Koston
ef3ab92979 Merge branch 'integration' into memory_api 2025-10-03 18:34:25 -05:00
J. Nick Koston
a51c288cf6 Merge branch 'ble_connections_slots_are_shared_client_server' into integration 2025-10-03 18:34:19 -05:00
J. Nick Koston
60f67382be copilot review comments 2025-10-03 18:31:21 -05:00
J. Nick Koston
944514eea4 Merge branch 'integration' into memory_api 2025-10-03 18:21:34 -05:00
J. Nick Koston
e2f25500bf Merge branch 'ble_connections_slots_are_shared_client_server' into integration 2025-10-03 18:21:29 -05:00
J. Nick Koston
6ebdb61098 Merge upstream/dev into ble_connections_slots_are_shared_client_server 2025-10-03 18:21:00 -05:00
J. Nick Koston
0137954f2b [const] Move CONF_MAX_CONNECTIONS to const.py (#11007) 2025-10-03 18:20:00 -05:00
J. Nick Koston
34e0620765 Merge branch 'integration' into memory_api 2025-10-03 18:11:25 -05:00
J. Nick Koston
389c76a922 Merge branch 'ble_connections_slots_are_shared_client_server' into integration 2025-10-03 18:11:17 -05:00
Patrick
0a40a30e4a [esp32_can] support multiple CAN instances for platforms that support it (#10712)
Co-authored-by: Jonathan Swoboda <154711427+swoboda1337@users.noreply.github.com>
2025-10-03 23:10:19 +00:00
J. Nick Koston
6b02b0cb59 remove default from tracker 2025-10-03 18:09:54 -05:00
J. Nick Koston
d660207c12 Merge branch 'integration' into memory_api 2025-10-03 18:07:17 -05:00
J. Nick Koston
eb9befde4d merge 2025-10-03 18:07:10 -05:00
J. Nick Koston
249080d118 Merge branch 'integration' into memory_api 2025-10-03 18:04:25 -05:00
J. Nick Koston
8cda4127bc Merge branch 'conf_max_connections' into integration 2025-10-03 18:04:17 -05:00
J. Nick Koston
e3d12cbac7 Create CONF_MAX_CONNECTIONS const 2025-10-03 18:01:15 -05:00
J. Nick Koston
d697d5df8b preen 2025-10-03 17:56:14 -05:00
J. Nick Koston
1570f83fd8 lint 2025-10-03 17:50:56 -05:00
J. Nick Koston
f16f826f12 its shared 2025-10-03 17:42:46 -05:00
J. Nick Koston
5e9c9e8e79 Merge branch 'integration' into memory_api 2025-10-03 17:08:07 -05:00
J. Nick Koston
0165c3d79b Merge branch 'std_map_overkill_wifi' into integration 2025-10-03 17:08:02 -05:00
J. Nick Koston
11a4d31e90 [wifi] Optimize WPA2 EAP phase2 logging to reduce memory overhead 2025-10-03 17:04:57 -05:00
J. Nick Koston
7887e136d6 Merge branch 'integration' into memory_api 2025-10-03 16:56:45 -05:00
J. Nick Koston
c30bd49568 Merge branch 'use_idf_webserver_esp32' into integration 2025-10-03 16:56:37 -05:00
J. Nick Koston
7621eb1f6e revert clang-tidy changes, copilot disagrees 2025-10-03 16:54:11 -05:00
J. Nick Koston
11b113b9db Merge branch 'dev' into use_idf_webserver_esp32 2025-10-03 16:42:21 -05:00
J. Nick Koston
a3f4863fdc Merge branch 'integration' into memory_api 2025-10-03 16:41:25 -05:00
J. Nick Koston
76fc04f286 Merge branch 'idf_query' into integration 2025-10-03 16:41:20 -05:00
J. Nick Koston
e19b48599c fix dangling pointer 2025-10-03 16:40:10 -05:00
J. Nick Koston
9e6dc91051 Merge branch 'integration' into memory_api 2025-10-03 16:06:56 -05:00
J. Nick Koston
b678b23a34 Merge branch 'logger_runtime_tags' into integration 2025-10-03 16:06:50 -05:00
J. Nick Koston
22d1729c5c Merge branch 'dev' into logger_runtime_tags 2025-10-03 16:06:38 -05:00
J. Nick Koston
28324adfb9 [logger] Conditionally compile runtime tag-specific log levels for performance 2025-10-03 16:03:30 -05:00
J. Nick Koston
d909910d6d Merge branch 'integration' into memory_api 2025-10-03 15:32:28 -05:00
J. Nick Koston
6f7afef08c Merge branch 'idf_query' into integration 2025-10-03 15:32:20 -05:00
J. Nick Koston
0f05f5119a [web_server_idf] Improve parameter caching security and reduce memory overhead 2025-10-03 15:31:09 -05:00
dependabot[bot]
d43b844e06 Bump ruff from 0.13.2 to 0.13.3 (#11000)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: J. Nick Koston <nick@home-assistant.io>
2025-10-03 14:28:58 -05:00
Tucker Kern
2596b6096f Fix log level selector when selecting levels above INFO (#10368)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2025-10-03 14:28:38 -05:00
dependabot[bot]
6f8e82aeb6 Bump actions/stale from 10.0.0 to 10.1.0 (#11001)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-10-03 14:27:29 -05:00
J. Nick Koston
ca0e738799 [logger] Fix line number wrapping bug for files with >999 lines (#10979) 2025-10-03 10:50:21 -05:00
Jonathan Swoboda
14a23101f2 [core] Fix MQTT import (#10982) 2025-10-03 11:35:55 -04:00
mrtoy-me
2b389bb8f2 [sps30] remove delay (#10964)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-03 09:40:43 -04:00
mrtoy-me
89c3340ef6 [mpr121] remove delay (#10963)
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
2025-10-03 09:06:16 -04:00
Jesse Hills
211a8c872b Add action response to tests 2025-10-01 13:58:19 +13:00
Jesse Hills
f4b7009c96 move callback 2025-10-01 13:50:07 +13:00
Jesse Hills
226399222d move error message 2025-10-01 11:16:07 +13:00
Jesse Hills
9a95ec95f9 Merge branch 'dev' into jesserockz-2025-457 2025-10-01 11:12:55 +13:00
Jesse Hills
2ef4f3c65f Update esphome/components/api/__init__.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-10-01 08:45:58 +13:00
Jesse Hills
6c362d42c3 [api] Add support for getting action responses from home-assistant 2025-09-30 15:28:41 +13:00
3780 changed files with 40762 additions and 20300 deletions

View File

@@ -186,6 +186,11 @@ This document provides essential context for AI models interacting with this pro
└── components/[component]/ # Component-specific tests
```
Run them using `script/test_build_components`. Use `-c <component>` to test specific components and `-t <target>` for specific platforms.
* **Testing All Components Together:** To verify that all components can be tested together without ID conflicts or configuration issues, use:
```bash
./script/test_component_grouping.py -e config --all
```
This tests all components in a single build to catch conflicts that might not appear when testing components individually. Use `-e config` for fast configuration validation, or `-e compile` for full compilation testing.
* **Debugging and Troubleshooting:**
* **Debug Tools:**
- `esphome config <file>.yaml` to validate configuration.
@@ -216,6 +221,146 @@ This document provides essential context for AI models interacting with this pro
* **Component Development:** Keep dependencies minimal, provide clear error messages, and write comprehensive docstrings and tests.
* **Code Generation:** Generate minimal and efficient C++ code. Validate all user inputs thoroughly. Support multiple platform variations.
* **Configuration Design:** Aim for simplicity with sensible defaults, while allowing for advanced customization.
* **Embedded Systems Optimization:** ESPHome targets resource-constrained microcontrollers. Be mindful of flash size and RAM usage.
**STL Container Guidelines:**
ESPHome runs on embedded systems with limited resources. Choose containers carefully:
1. **Compile-time-known sizes:** Use `std::array` instead of `std::vector` when size is known at compile time.
```cpp
// Bad - generates STL realloc code
std::vector<int> values;
// Good - no dynamic allocation
std::array<int, MAX_VALUES> values;
```
Use `cg.add_define("MAX_VALUES", count)` to set the size from Python configuration.
**For byte buffers:** Avoid `std::vector<uint8_t>` unless the buffer needs to grow. Use `std::unique_ptr<uint8_t[]>` instead.
> **Note:** `std::unique_ptr<uint8_t[]>` does **not** provide bounds checking or iterator support like `std::vector<uint8_t>`. Use it only when you do not need these features and want minimal overhead.
```cpp
// Bad - STL overhead for simple byte buffer
std::vector<uint8_t> buffer;
buffer.resize(256);
// Good - minimal overhead, single allocation
std::unique_ptr<uint8_t[]> buffer = std::make_unique<uint8_t[]>(256);
// Or if size is constant:
std::array<uint8_t, 256> buffer;
```
2. **Compile-time-known fixed sizes with vector-like API:** Use `StaticVector` from `esphome/core/helpers.h` for fixed-size stack allocation with `push_back()` interface.
```cpp
// Bad - generates STL realloc code (_M_realloc_insert)
std::vector<ServiceRecord> services;
services.reserve(5); // Still includes reallocation machinery
// Good - compile-time fixed size, stack allocated, no reallocation machinery
StaticVector<ServiceRecord, MAX_SERVICES> services; // Allocates all MAX_SERVICES on stack
services.push_back(record1); // Tracks count but all slots allocated
```
Use `cg.add_define("MAX_SERVICES", count)` to set the size from Python configuration.
Like `std::array` but with vector-like API (`push_back()`, `size()`) and no STL reallocation code.
3. **Runtime-known sizes:** Use `FixedVector` from `esphome/core/helpers.h` when the size is only known at runtime initialization.
```cpp
// Bad - generates STL realloc code (_M_realloc_insert)
std::vector<TxtRecord> txt_records;
txt_records.reserve(5); // Still includes reallocation machinery
// Good - runtime size, single allocation, no reallocation machinery
FixedVector<TxtRecord> txt_records;
txt_records.init(record_count); // Initialize with exact size at runtime
```
**Benefits:**
- Eliminates `_M_realloc_insert`, `_M_default_append` template instantiations (saves 200-500 bytes per instance)
- Single allocation, no upper bound needed
- No reallocation overhead
- Compatible with protobuf code generation when using `[(fixed_vector) = true]` option
4. **Small datasets (1-16 elements):** Use `std::vector` or `std::array` with simple structs instead of `std::map`/`std::set`/`std::unordered_map`.
```cpp
// Bad - 2KB+ overhead for red-black tree/hash table
std::map<std::string, int> small_lookup;
std::unordered_map<int, std::string> tiny_map;
// Good - simple struct with linear search (std::vector is fine)
struct LookupEntry {
const char *key;
int value;
};
std::vector<LookupEntry> small_lookup = {
{"key1", 10},
{"key2", 20},
{"key3", 30},
};
// Or std::array if size is compile-time constant:
// std::array<LookupEntry, 3> small_lookup = {{ ... }};
```
Linear search on small datasets (1-16 elements) is often faster than hashing/tree overhead, but this depends on lookup frequency and access patterns. For frequent lookups in hot code paths, the O(1) vs O(n) complexity difference may still matter even for small datasets. `std::vector` with simple structs is usually fine—it's the heavy containers (`map`, `set`, `unordered_map`) that should be avoided for small datasets unless profiling shows otherwise.
5. **Detection:** Look for these patterns in compiler output:
- Large code sections with STL symbols (vector, map, set)
- `alloc`, `realloc`, `dealloc` in symbol names
- `_M_realloc_insert`, `_M_default_append` (vector reallocation)
- Red-black tree code (`rb_tree`, `_Rb_tree`)
- Hash table infrastructure (`unordered_map`, `hash`)
**When to optimize:**
- Core components (API, network, logger)
- Widely-used components (mdns, wifi, ble)
- Components causing flash size complaints
**When not to optimize:**
- Single-use niche components
- Code where readability matters more than bytes
- Already using appropriate containers
* **State Management:** Use `CORE.data` for component state that needs to persist during configuration generation. Avoid module-level mutable globals.
**Bad Pattern (Module-Level Globals):**
```python
# Don't do this - state persists between compilation runs
_component_state = []
_use_feature = None
def enable_feature():
global _use_feature
_use_feature = True
```
**Good Pattern (CORE.data with Helpers):**
```python
from esphome.core import CORE
# Keys for CORE.data storage
COMPONENT_STATE_KEY = "my_component_state"
USE_FEATURE_KEY = "my_component_use_feature"
def _get_component_state() -> list:
"""Get component state from CORE.data."""
return CORE.data.setdefault(COMPONENT_STATE_KEY, [])
def _get_use_feature() -> bool | None:
"""Get feature flag from CORE.data."""
return CORE.data.get(USE_FEATURE_KEY)
def _set_use_feature(value: bool) -> None:
"""Set feature flag in CORE.data."""
CORE.data[USE_FEATURE_KEY] = value
def enable_feature():
_set_use_feature(True)
```
**Why this matters:**
- Module-level globals persist between compilation runs if the dashboard doesn't fork/exec
- `CORE.data` automatically clears between runs
- Typed helper functions provide better IDE support and maintainability
- Encapsulation makes state management explicit and testable
* **Security:** Be mindful of security when making changes to the API, web server, or any other network-related code. Do not hardcode secrets or keys.

View File

@@ -1 +1 @@
499db61c1aa55b98b6629df603a56a1ba7aff5a9a7c781a5c1552a9dcd186c08
3d46b63015d761c85ca9cb77ab79a389509e5776701fb22aed16e7b79d432c0c

View File

@@ -1,4 +1,5 @@
[run]
omit =
esphome/components/*
esphome/analyze_memory/*
tests/integration/*

View File

@@ -53,6 +53,7 @@ jobs:
'new-target-platform',
'merging-to-release',
'merging-to-beta',
'chained-pr',
'core',
'small-pr',
'dashboard',
@@ -140,6 +141,8 @@ jobs:
labels.add('merging-to-release');
} else if (baseRef === 'beta') {
labels.add('merging-to-beta');
} else if (baseRef !== 'dev') {
labels.add('chained-pr');
}
return labels;
@@ -413,7 +416,7 @@ jobs:
}
// Generate review messages
function generateReviewMessages(finalLabels) {
function generateReviewMessages(finalLabels, originalLabelCount) {
const messages = [];
const prAuthor = context.payload.pull_request.user.login;
@@ -427,15 +430,15 @@ jobs:
.reduce((sum, file) => sum + (file.deletions || 0), 0);
const nonTestChanges = (totalAdditions - testAdditions) - (totalDeletions - testDeletions);
const tooManyLabels = finalLabels.length > MAX_LABELS;
const tooManyLabels = originalLabelCount > MAX_LABELS;
const tooManyChanges = nonTestChanges > TOO_BIG_THRESHOLD;
let message = `${TOO_BIG_MARKER}\n### 📦 Pull Request Size\n\n`;
if (tooManyLabels && tooManyChanges) {
message += `This PR is too large with ${nonTestChanges} line changes (excluding tests) and affects ${finalLabels.length} different components/areas.`;
message += `This PR is too large with ${nonTestChanges} line changes (excluding tests) and affects ${originalLabelCount} different components/areas.`;
} else if (tooManyLabels) {
message += `This PR affects ${finalLabels.length} different components/areas.`;
message += `This PR affects ${originalLabelCount} different components/areas.`;
} else {
message += `This PR is too large with ${nonTestChanges} line changes (excluding tests).`;
}
@@ -463,8 +466,8 @@ jobs:
}
// Handle reviews
async function handleReviews(finalLabels) {
const reviewMessages = generateReviewMessages(finalLabels);
async function handleReviews(finalLabels, originalLabelCount) {
const reviewMessages = generateReviewMessages(finalLabels, originalLabelCount);
const hasReviewableLabels = finalLabels.some(label =>
['too-big', 'needs-codeowners'].includes(label)
);
@@ -528,8 +531,8 @@ jobs:
const apiData = await fetchApiData();
const baseRef = context.payload.pull_request.base.ref;
// Early exit for non-dev branches
if (baseRef !== 'dev') {
// Early exit for release and beta branches only
if (baseRef === 'release' || baseRef === 'beta') {
const branchLabels = await detectMergeBranch();
const finalLabels = Array.from(branchLabels);
@@ -624,6 +627,7 @@ jobs:
// Handle too many labels (only for non-mega PRs)
const tooManyLabels = finalLabels.length > MAX_LABELS;
const originalLabelCount = finalLabels.length;
if (tooManyLabels && !isMegaPR && !finalLabels.includes('too-big')) {
finalLabels = ['too-big'];
@@ -632,7 +636,7 @@ jobs:
console.log('Computed labels:', finalLabels.join(', '));
// Handle reviews
await handleReviews(finalLabels);
await handleReviews(finalLabels, originalLabelCount);
// Apply labels
if (finalLabels.length > 0) {

View File

@@ -62,7 +62,7 @@ jobs:
run: git diff
- if: failure()
name: Archive artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: generated-proto-files
path: |

View File

@@ -6,6 +6,7 @@ on:
- ".clang-tidy"
- "platformio.ini"
- "requirements_dev.txt"
- "sdkconfig.defaults"
- ".clang-tidy.hash"
- "script/clang_tidy_hash.py"
- ".github/workflows/ci-clang-tidy-hash.yml"

View File

@@ -0,0 +1,111 @@
---
name: Memory Impact Comment (Forks)
on:
workflow_run:
workflows: ["CI"]
types: [completed]
permissions:
contents: read
pull-requests: write
actions: read
jobs:
memory-impact-comment:
name: Post memory impact comment (fork PRs only)
runs-on: ubuntu-24.04
# Only run for PRs from forks that had successful CI runs
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_repository.full_name != github.repository
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Get PR details
id: pr
run: |
# Get PR details by searching for PR with matching head SHA
# The workflow_run.pull_requests field is often empty for forks
# Use paginate to handle repos with many open PRs
head_sha="${{ github.event.workflow_run.head_sha }}"
pr_data=$(gh api --paginate "/repos/${{ github.repository }}/pulls" \
--jq ".[] | select(.head.sha == \"$head_sha\") | {number: .number, base_ref: .base.ref}" \
| head -n 1)
if [ -z "$pr_data" ]; then
echo "No PR found for SHA $head_sha, skipping"
echo "skip=true" >> "$GITHUB_OUTPUT"
exit 0
fi
pr_number=$(echo "$pr_data" | jq -r '.number')
base_ref=$(echo "$pr_data" | jq -r '.base_ref')
echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT"
echo "base_ref=$base_ref" >> "$GITHUB_OUTPUT"
echo "Found PR #$pr_number targeting base branch: $base_ref"
- name: Check out code from base repository
if: steps.pr.outputs.skip != 'true'
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Always check out from the base repository (esphome/esphome), never from forks
# Use the PR's target branch to ensure we run trusted code from the main repo
repository: ${{ github.repository }}
ref: ${{ steps.pr.outputs.base_ref }}
- name: Restore Python
if: steps.pr.outputs.skip != 'true'
uses: ./.github/actions/restore-python
with:
python-version: "3.11"
cache-key: ${{ hashFiles('.cache-key') }}
- name: Download memory analysis artifacts
if: steps.pr.outputs.skip != 'true'
run: |
run_id="${{ github.event.workflow_run.id }}"
echo "Downloading artifacts from workflow run $run_id"
mkdir -p memory-analysis
# Download target analysis artifact
if gh run download --name "memory-analysis-target" --dir memory-analysis --repo "${{ github.repository }}" "$run_id"; then
echo "Downloaded memory-analysis-target artifact."
else
echo "No memory-analysis-target artifact found."
fi
# Download PR analysis artifact
if gh run download --name "memory-analysis-pr" --dir memory-analysis --repo "${{ github.repository }}" "$run_id"; then
echo "Downloaded memory-analysis-pr artifact."
else
echo "No memory-analysis-pr artifact found."
fi
- name: Check if artifacts exist
id: check
if: steps.pr.outputs.skip != 'true'
run: |
if [ -f ./memory-analysis/memory-analysis-target.json ] && [ -f ./memory-analysis/memory-analysis-pr.json ]; then
echo "found=true" >> "$GITHUB_OUTPUT"
else
echo "found=false" >> "$GITHUB_OUTPUT"
echo "Memory analysis artifacts not found, skipping comment"
fi
- name: Post or update PR comment
if: steps.pr.outputs.skip != 'true' && steps.check.outputs.found == 'true'
env:
PR_NUMBER: ${{ steps.pr.outputs.pr_number }}
run: |
. venv/bin/activate
# Pass PR number and JSON file paths directly to Python script
# Let Python parse the JSON to avoid shell injection risks
# The script will validate and sanitize all inputs
python script/ci_memory_impact_comment.py \
--pr-number "$PR_NUMBER" \
--target-json ./memory-analysis/memory-analysis-target.json \
--pr-json ./memory-analysis/memory-analysis-pr.json

View File

@@ -114,7 +114,6 @@ jobs:
matrix:
python-version:
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
@@ -126,12 +125,8 @@ jobs:
# version used for docker images on Windows and macOS
- python-version: "3.13"
os: windows-latest
- python-version: "3.12"
os: windows-latest
- python-version: "3.13"
os: macOS-latest
- python-version: "3.12"
os: macOS-latest
runs-on: ${{ matrix.os }}
needs:
- common
@@ -175,9 +170,17 @@ jobs:
outputs:
integration-tests: ${{ steps.determine.outputs.integration-tests }}
clang-tidy: ${{ steps.determine.outputs.clang-tidy }}
clang-tidy-mode: ${{ steps.determine.outputs.clang-tidy-mode }}
python-linters: ${{ steps.determine.outputs.python-linters }}
changed-components: ${{ steps.determine.outputs.changed-components }}
changed-components-with-tests: ${{ steps.determine.outputs.changed-components-with-tests }}
directly-changed-components-with-tests: ${{ steps.determine.outputs.directly-changed-components-with-tests }}
component-test-count: ${{ steps.determine.outputs.component-test-count }}
changed-cpp-file-count: ${{ steps.determine.outputs.changed-cpp-file-count }}
memory_impact: ${{ steps.determine.outputs.memory-impact }}
cpp-unit-tests-run-all: ${{ steps.determine.outputs.cpp-unit-tests-run-all }}
cpp-unit-tests-components: ${{ steps.determine.outputs.cpp-unit-tests-components }}
component-test-batches: ${{ steps.determine.outputs.component-test-batches }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -189,6 +192,11 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Restore components graph cache
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .temp/components_graph.json
key: components-graph-${{ hashFiles('esphome/components/**/*.py') }}
- name: Determine which tests to run
id: determine
env:
@@ -202,9 +210,23 @@ jobs:
# Extract individual fields
echo "integration-tests=$(echo "$output" | jq -r '.integration_tests')" >> $GITHUB_OUTPUT
echo "clang-tidy=$(echo "$output" | jq -r '.clang_tidy')" >> $GITHUB_OUTPUT
echo "clang-tidy-mode=$(echo "$output" | jq -r '.clang_tidy_mode')" >> $GITHUB_OUTPUT
echo "python-linters=$(echo "$output" | jq -r '.python_linters')" >> $GITHUB_OUTPUT
echo "changed-components=$(echo "$output" | jq -c '.changed_components')" >> $GITHUB_OUTPUT
echo "changed-components-with-tests=$(echo "$output" | jq -c '.changed_components_with_tests')" >> $GITHUB_OUTPUT
echo "directly-changed-components-with-tests=$(echo "$output" | jq -c '.directly_changed_components_with_tests')" >> $GITHUB_OUTPUT
echo "component-test-count=$(echo "$output" | jq -r '.component_test_count')" >> $GITHUB_OUTPUT
echo "changed-cpp-file-count=$(echo "$output" | jq -r '.changed_cpp_file_count')" >> $GITHUB_OUTPUT
echo "memory-impact=$(echo "$output" | jq -c '.memory_impact')" >> $GITHUB_OUTPUT
echo "cpp-unit-tests-run-all=$(echo "$output" | jq -r '.cpp_unit_tests_run_all')" >> $GITHUB_OUTPUT
echo "cpp-unit-tests-components=$(echo "$output" | jq -c '.cpp_unit_tests_components')" >> $GITHUB_OUTPUT
echo "component-test-batches=$(echo "$output" | jq -c '.component_test_batches')" >> $GITHUB_OUTPUT
- name: Save components graph cache
if: github.ref == 'refs/heads/dev'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: .temp/components_graph.json
key: components-graph-${{ hashFiles('esphome/components/**/*.py') }}
integration-tests:
name: Run integration tests
@@ -242,7 +264,34 @@ jobs:
. venv/bin/activate
pytest -vv --no-cov --tb=native -n auto tests/integration/
clang-tidy:
cpp-unit-tests:
name: Run C++ unit tests
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: github.event_name == 'pull_request' && (needs.determine-jobs.outputs.cpp-unit-tests-run-all == 'true' || needs.determine-jobs.outputs.cpp-unit-tests-components != '[]')
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Run cpp_unit_test.py
run: |
. venv/bin/activate
if [ "${{ needs.determine-jobs.outputs.cpp-unit-tests-run-all }}" = "true" ]; then
script/cpp_unit_test.py --all
else
ARGS=$(echo '${{ needs.determine-jobs.outputs.cpp-unit-tests-components }}' | jq -r '.[] | @sh' | xargs)
script/cpp_unit_test.py $ARGS
fi
clang-tidy-single:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
needs:
@@ -260,22 +309,6 @@ jobs:
name: Run script/clang-tidy for ESP8266
options: --environment esp8266-arduino-tidy --grep USE_ESP8266
pio_cache_key: tidyesp8266
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 1/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 1
pio_cache_key: tidyesp32
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 2/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 2
pio_cache_key: tidyesp32
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 3/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 3
pio_cache_key: tidyesp32
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 4/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 4
pio_cache_key: tidyesp32
- id: clang-tidy
name: Run script/clang-tidy for ESP32 IDF
options: --environment esp32-idf-tidy --grep USE_ESP_IDF
@@ -356,79 +389,192 @@ jobs:
# yamllint disable-line rule:line-length
if: always()
test-build-components:
name: Component test ${{ matrix.file }}
clang-tidy-nosplit:
name: Run script/clang-tidy for ESP32 Arduino
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.component-test-count) > 0 && fromJSON(needs.determine-jobs.outputs.component-test-count) < 100
if: needs.determine-jobs.outputs.clang-tidy-mode == 'nosplit'
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Need history for HEAD~1 to work for checking changed files
fetch-depth: 2
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
if: github.ref == 'refs/heads/dev'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-tidyesp32-${{ hashFiles('platformio.ini') }}
- name: Cache platformio
if: github.ref != 'refs/heads/dev'
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-tidyesp32-${{ hashFiles('platformio.ini') }}
- name: Register problem matchers
run: |
echo "::add-matcher::.github/workflows/matchers/gcc.json"
echo "::add-matcher::.github/workflows/matchers/clang-tidy.json"
- name: Check if full clang-tidy scan needed
id: check_full_scan
run: |
. venv/bin/activate
if python script/clang_tidy_hash.py --check; then
echo "full_scan=true" >> $GITHUB_OUTPUT
echo "reason=hash_changed" >> $GITHUB_OUTPUT
else
echo "full_scan=false" >> $GITHUB_OUTPUT
echo "reason=normal" >> $GITHUB_OUTPUT
fi
- name: Run clang-tidy
run: |
. venv/bin/activate
if [ "${{ steps.check_full_scan.outputs.full_scan }}" = "true" ]; then
echo "Running FULL clang-tidy scan (hash changed)"
script/clang-tidy --all-headers --fix --environment esp32-arduino-tidy
else
echo "Running clang-tidy on changed files only"
script/clang-tidy --all-headers --fix --changed --environment esp32-arduino-tidy
fi
env:
# Also cache libdeps, store them in a ~/.platformio subfolder
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
clang-tidy-split:
name: ${{ matrix.name }}
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: needs.determine-jobs.outputs.clang-tidy-mode == 'split'
env:
GH_TOKEN: ${{ github.token }}
strategy:
fail-fast: false
max-parallel: 2
matrix:
file: ${{ fromJson(needs.determine-jobs.outputs.changed-components) }}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
include:
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 1/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 1
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 2/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 2
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 3/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 3
- id: clang-tidy
name: Run script/clang-tidy for ESP32 Arduino 4/4
options: --environment esp32-arduino-tidy --split-num 4 --split-at 4
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
# Need history for HEAD~1 to work for checking changed files
fetch-depth: 2
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: test_build_components -e config -c ${{ matrix.file }}
run: |
. venv/bin/activate
./script/test_build_components -e config -c ${{ matrix.file }}
- name: test_build_components -e compile -c ${{ matrix.file }}
run: |
. venv/bin/activate
./script/test_build_components -e compile -c ${{ matrix.file }}
test-build-components-splitter:
name: Split components for testing into 20 groups maximum
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.component-test-count) >= 100
outputs:
matrix: ${{ steps.split.outputs.components }}
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Split components into 20 groups
id: split
- name: Cache platformio
if: github.ref == 'refs/heads/dev'
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-tidyesp32-${{ hashFiles('platformio.ini') }}
- name: Cache platformio
if: github.ref != 'refs/heads/dev'
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-tidyesp32-${{ hashFiles('platformio.ini') }}
- name: Register problem matchers
run: |
components=$(echo '${{ needs.determine-jobs.outputs.changed-components }}' | jq -c '.[]' | shuf | jq -s -c '[_nwise(20) | join(" ")]')
echo "components=$components" >> $GITHUB_OUTPUT
echo "::add-matcher::.github/workflows/matchers/gcc.json"
echo "::add-matcher::.github/workflows/matchers/clang-tidy.json"
- name: Check if full clang-tidy scan needed
id: check_full_scan
run: |
. venv/bin/activate
if python script/clang_tidy_hash.py --check; then
echo "full_scan=true" >> $GITHUB_OUTPUT
echo "reason=hash_changed" >> $GITHUB_OUTPUT
else
echo "full_scan=false" >> $GITHUB_OUTPUT
echo "reason=normal" >> $GITHUB_OUTPUT
fi
- name: Run clang-tidy
run: |
. venv/bin/activate
if [ "${{ steps.check_full_scan.outputs.full_scan }}" = "true" ]; then
echo "Running FULL clang-tidy scan (hash changed)"
script/clang-tidy --all-headers --fix ${{ matrix.options }}
else
echo "Running clang-tidy on changed files only"
script/clang-tidy --all-headers --fix --changed ${{ matrix.options }}
fi
env:
# Also cache libdeps, store them in a ~/.platformio subfolder
PLATFORMIO_LIBDEPS_DIR: ~/.platformio/libdeps
- name: Suggested changes
run: script/ci-suggest-changes
if: always()
test-build-components-split:
name: Test split components
name: Test components batch (${{ matrix.components }})
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
- test-build-components-splitter
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.component-test-count) >= 100
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.component-test-count) > 0
strategy:
fail-fast: false
max-parallel: 4
max-parallel: ${{ (startsWith(github.base_ref, 'beta') || startsWith(github.base_ref, 'release')) && 8 || 4 }}
matrix:
components: ${{ fromJson(needs.test-build-components-splitter.outputs.matrix) }}
components: ${{ fromJson(needs.determine-jobs.outputs.component-test-batches) }}
steps:
- name: Show disk space
run: |
echo "Available disk space:"
df -h
- name: List components
run: echo ${{ matrix.components }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install libsdl2-dev
- name: Cache apt packages
uses: awalsh128/cache-apt-pkgs-action@acb598e5ddbc6f68a970c5da0688d2f3a9f04d05 # v1.5.3
with:
packages: libsdl2-dev
version: 1.0
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -437,27 +583,83 @@ jobs:
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Validate config
- name: Validate and compile components with intelligent grouping
run: |
. venv/bin/activate
for component in ${{ matrix.components }}; do
./script/test_build_components -e config -c $component
done
- name: Compile config
run: |
. venv/bin/activate
mkdir build_cache
export PLATFORMIO_BUILD_CACHE_DIR=$PWD/build_cache
for component in ${{ matrix.components }}; do
./script/test_build_components -e compile -c $component
done
# Check if /mnt has more free space than / before bind mounting
# Extract available space in KB for comparison
root_avail=$(df -k / | awk 'NR==2 {print $4}')
mnt_avail=$(df -k /mnt 2>/dev/null | awk 'NR==2 {print $4}')
echo "Available space: / has ${root_avail}KB, /mnt has ${mnt_avail}KB"
# Only use /mnt if it has more space than /
if [ -n "$mnt_avail" ] && [ "$mnt_avail" -gt "$root_avail" ]; then
echo "Using /mnt for build files (more space available)"
# Bind mount PlatformIO directory to /mnt (tools, packages, build cache all go there)
sudo mkdir -p /mnt/platformio
sudo chown $USER:$USER /mnt/platformio
mkdir -p ~/.platformio
sudo mount --bind /mnt/platformio ~/.platformio
# Bind mount test build directory to /mnt
sudo mkdir -p /mnt/test_build_components_build
sudo chown $USER:$USER /mnt/test_build_components_build
mkdir -p tests/test_build_components/build
sudo mount --bind /mnt/test_build_components_build tests/test_build_components/build
else
echo "Using / for build files (more space available than /mnt or /mnt unavailable)"
fi
# Convert space-separated components to comma-separated for Python script
components_csv=$(echo "${{ matrix.components }}" | tr ' ' ',')
# Only isolate directly changed components when targeting dev branch
# For beta/release branches, group everything for faster CI
#
# WHY ISOLATE DIRECTLY CHANGED COMPONENTS?
# - Isolated tests run WITHOUT --testing-mode, enabling full validation
# - This catches pin conflicts and other issues in directly changed code
# - Grouped tests use --testing-mode to allow config merging (disables some checks)
# - Dependencies are safe to group since they weren't modified in this PR
if [[ "${{ github.base_ref }}" == beta* ]] || [[ "${{ github.base_ref }}" == release* ]]; then
directly_changed_csv=""
echo "Testing components: $components_csv"
echo "Target branch: ${{ github.base_ref }} - grouping all components"
else
directly_changed_csv=$(echo '${{ needs.determine-jobs.outputs.directly-changed-components-with-tests }}' | jq -r 'join(",")')
echo "Testing components: $components_csv"
echo "Target branch: ${{ github.base_ref }} - isolating directly changed components: $directly_changed_csv"
fi
echo ""
# Show disk space before validation (after bind mounts setup)
echo "Disk space before config validation:"
df -h
echo ""
# Run config validation with grouping and isolation
python3 script/test_build_components.py -e config -c "$components_csv" -f --isolate "$directly_changed_csv"
echo ""
echo "Config validation passed! Starting compilation..."
echo ""
# Show disk space before compilation
echo "Disk space before compilation:"
df -h
echo ""
# Run compilation with grouping and isolation
python3 script/test_build_components.py -e compile -c "$components_csv" -f --isolate "$directly_changed_csv"
pre-commit-ci-lite:
name: pre-commit.ci lite
runs-on: ubuntu-latest
needs:
- common
if: github.event_name == 'pull_request' && github.base_ref != 'beta' && github.base_ref != 'release'
if: github.event_name == 'pull_request' && !startsWith(github.base_ref, 'beta') && !startsWith(github.base_ref, 'release')
steps:
- name: Check out code from GitHub
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
@@ -472,6 +674,271 @@ jobs:
- uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
if: always()
memory-impact-target-branch:
name: Build target branch for memory impact
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.memory_impact).should_run == 'true'
outputs:
ram_usage: ${{ steps.extract.outputs.ram_usage }}
flash_usage: ${{ steps.extract.outputs.flash_usage }}
cache_hit: ${{ steps.cache-memory-analysis.outputs.cache-hit }}
skip: ${{ steps.check-script.outputs.skip }}
steps:
- name: Check out target branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.base_ref }}
# Check if memory impact extraction script exists on target branch
# If not, skip the analysis (this handles older branches that don't have the feature)
- name: Check for memory impact script
id: check-script
run: |
if [ -f "script/ci_memory_impact_extract.py" ]; then
echo "skip=false" >> $GITHUB_OUTPUT
else
echo "skip=true" >> $GITHUB_OUTPUT
echo "::warning::ci_memory_impact_extract.py not found on target branch, skipping memory impact analysis"
fi
# All remaining steps only run if script exists
- name: Generate cache key
id: cache-key
if: steps.check-script.outputs.skip != 'true'
run: |
# Get the commit SHA of the target branch
target_sha=$(git rev-parse HEAD)
# Hash the build infrastructure files (all files that affect build/analysis)
infra_hash=$(cat \
script/test_build_components.py \
script/ci_memory_impact_extract.py \
script/analyze_component_buses.py \
script/merge_component_configs.py \
script/ci_helpers.py \
.github/workflows/ci.yml \
| sha256sum | cut -d' ' -f1)
# Get platform and components from job inputs
platform="${{ fromJSON(needs.determine-jobs.outputs.memory_impact).platform }}"
components='${{ toJSON(fromJSON(needs.determine-jobs.outputs.memory_impact).components) }}'
components_hash=$(echo "$components" | sha256sum | cut -d' ' -f1)
# Combine into cache key
cache_key="memory-analysis-target-${target_sha}-${infra_hash}-${platform}-${components_hash}"
echo "cache-key=${cache_key}" >> $GITHUB_OUTPUT
echo "Cache key: ${cache_key}"
- name: Restore cached memory analysis
id: cache-memory-analysis
if: steps.check-script.outputs.skip != 'true'
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: memory-analysis-target.json
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Cache status
if: steps.check-script.outputs.skip != 'true'
run: |
if [ "${{ steps.cache-memory-analysis.outputs.cache-hit }}" == "true" ]; then
echo "✓ Cache hit! Using cached memory analysis results."
echo " Skipping build step to save time."
else
echo "✗ Cache miss. Will build and analyze memory usage."
fi
- name: Restore Python
if: steps.check-script.outputs.skip != 'true' && steps.cache-memory-analysis.outputs.cache-hit != 'true'
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
if: steps.check-script.outputs.skip != 'true' && steps.cache-memory-analysis.outputs.cache-hit != 'true'
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-memory-${{ fromJSON(needs.determine-jobs.outputs.memory_impact).platform }}-${{ hashFiles('platformio.ini') }}
- name: Build, compile, and analyze memory
if: steps.check-script.outputs.skip != 'true' && steps.cache-memory-analysis.outputs.cache-hit != 'true'
id: build
run: |
. venv/bin/activate
components='${{ toJSON(fromJSON(needs.determine-jobs.outputs.memory_impact).components) }}'
platform="${{ fromJSON(needs.determine-jobs.outputs.memory_impact).platform }}"
echo "Building with test_build_components.py for $platform with components:"
echo "$components" | jq -r '.[]' | sed 's/^/ - /'
# Use test_build_components.py which handles grouping automatically
# Pass components as comma-separated list
component_list=$(echo "$components" | jq -r 'join(",")')
echo "Compiling with test_build_components.py..."
# Run build and extract memory with auto-detection of build directory for detailed analysis
# Use tee to show output in CI while also piping to extraction script
python script/test_build_components.py \
-e compile \
-c "$component_list" \
-t "$platform" 2>&1 | \
tee /dev/stderr | \
python script/ci_memory_impact_extract.py \
--output-env \
--output-json memory-analysis-target.json
# Add metadata to JSON before caching
python script/ci_add_metadata_to_json.py \
--json-file memory-analysis-target.json \
--components "$components" \
--platform "$platform"
- name: Save memory analysis to cache
if: steps.check-script.outputs.skip != 'true' && steps.cache-memory-analysis.outputs.cache-hit != 'true' && steps.build.outcome == 'success'
uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: memory-analysis-target.json
key: ${{ steps.cache-key.outputs.cache-key }}
- name: Extract memory usage for outputs
id: extract
if: steps.check-script.outputs.skip != 'true'
run: |
if [ -f memory-analysis-target.json ]; then
ram=$(jq -r '.ram_bytes' memory-analysis-target.json)
flash=$(jq -r '.flash_bytes' memory-analysis-target.json)
echo "ram_usage=${ram}" >> $GITHUB_OUTPUT
echo "flash_usage=${flash}" >> $GITHUB_OUTPUT
echo "RAM: ${ram} bytes, Flash: ${flash} bytes"
else
echo "Error: memory-analysis-target.json not found"
exit 1
fi
- name: Upload memory analysis JSON
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: memory-analysis-target
path: memory-analysis-target.json
if-no-files-found: warn
retention-days: 1
memory-impact-pr-branch:
name: Build PR branch for memory impact
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
if: github.event_name == 'pull_request' && fromJSON(needs.determine-jobs.outputs.memory_impact).should_run == 'true'
outputs:
ram_usage: ${{ steps.extract.outputs.ram_usage }}
flash_usage: ${{ steps.extract.outputs.flash_usage }}
steps:
- name: Check out PR branch
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Cache platformio
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4.3.0
with:
path: ~/.platformio
key: platformio-memory-${{ fromJSON(needs.determine-jobs.outputs.memory_impact).platform }}-${{ hashFiles('platformio.ini') }}
- name: Build, compile, and analyze memory
id: extract
run: |
. venv/bin/activate
components='${{ toJSON(fromJSON(needs.determine-jobs.outputs.memory_impact).components) }}'
platform="${{ fromJSON(needs.determine-jobs.outputs.memory_impact).platform }}"
echo "Building with test_build_components.py for $platform with components:"
echo "$components" | jq -r '.[]' | sed 's/^/ - /'
# Use test_build_components.py which handles grouping automatically
# Pass components as comma-separated list
component_list=$(echo "$components" | jq -r 'join(",")')
echo "Compiling with test_build_components.py..."
# Run build and extract memory with auto-detection of build directory for detailed analysis
# Use tee to show output in CI while also piping to extraction script
python script/test_build_components.py \
-e compile \
-c "$component_list" \
-t "$platform" 2>&1 | \
tee /dev/stderr | \
python script/ci_memory_impact_extract.py \
--output-env \
--output-json memory-analysis-pr.json
# Add metadata to JSON (components and platform are in shell variables above)
python script/ci_add_metadata_to_json.py \
--json-file memory-analysis-pr.json \
--components "$components" \
--platform "$platform"
- name: Upload memory analysis JSON
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: memory-analysis-pr
path: memory-analysis-pr.json
if-no-files-found: warn
retention-days: 1
memory-impact-comment:
name: Comment memory impact
runs-on: ubuntu-24.04
needs:
- common
- determine-jobs
- memory-impact-target-branch
- memory-impact-pr-branch
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && fromJSON(needs.determine-jobs.outputs.memory_impact).should_run == 'true' && needs.memory-impact-target-branch.outputs.skip != 'true'
permissions:
contents: read
pull-requests: write
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Check out code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Restore Python
uses: ./.github/actions/restore-python
with:
python-version: ${{ env.DEFAULT_PYTHON }}
cache-key: ${{ needs.common.outputs.cache-key }}
- name: Download target analysis JSON
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: memory-analysis-target
path: ./memory-analysis
continue-on-error: true
- name: Download PR analysis JSON
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
name: memory-analysis-pr
path: ./memory-analysis
continue-on-error: true
- name: Post or update PR comment
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
. venv/bin/activate
# Pass JSON file paths directly to Python script
# All data is extracted from JSON files for security
python script/ci_memory_impact_comment.py \
--pr-number "$PR_NUMBER" \
--target-json ./memory-analysis/memory-analysis-target.json \
--pr-json ./memory-analysis/memory-analysis-pr.json
ci-status:
name: CI Status
runs-on: ubuntu-24.04
@@ -481,12 +948,15 @@ jobs:
- pylint
- pytest
- integration-tests
- clang-tidy
- clang-tidy-single
- clang-tidy-nosplit
- clang-tidy-split
- determine-jobs
- test-build-components
- test-build-components-splitter
- test-build-components-split
- pre-commit-ci-lite
- memory-impact-target-branch
- memory-impact-pr-branch
- memory-impact-comment
if: always()
steps:
- name: Success

View File

@@ -58,7 +58,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
uses: github/codeql-action/init@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
@@ -86,6 +86,6 @@ jobs:
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@64d10c13136e1c5bce3e5fbde8d4906eeaafc885 # v3.30.6
uses: github/codeql-action/analyze@0499de31b99561a6d14a36a5f662c2a54f91beee # v4.31.2
with:
category: "/language:${{matrix.language}}"

View File

@@ -138,7 +138,7 @@ jobs:
# version: ${{ needs.init.outputs.tag }}
- name: Upload digests
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5.0.0
with:
name: digests-${{ matrix.platform.arch }}
path: /tmp/digests
@@ -171,7 +171,7 @@ jobs:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Download digests
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53 # v6.0.0
with:
pattern: digests-*
path: /tmp/digests

View File

@@ -19,11 +19,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Stale
uses: actions/stale@3a9db7e6a41a89f618792c92c0e97cc736e1b13f # v10.0.0
uses: actions/stale@5f858e3efba33a5ca4407a664cc011ad407f2008 # v10.1.0
with:
debug-only: ${{ github.ref != 'refs/heads/dev' }} # Dry-run when not run on dev branch
remove-stale-when-updated: true
operations-per-run: 150
operations-per-run: 400
# The 90 day stale policy for PRs
# - PRs

View File

@@ -14,6 +14,7 @@ jobs:
label:
- needs-docs
- merge-after-release
- chained-pr
steps:
- name: Check for ${{ matrix.label }} label
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0

View File

@@ -11,7 +11,7 @@ ci:
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.13.2
rev: v0.14.3
hooks:
# Run the linter.
- id: ruff

View File

@@ -62,6 +62,7 @@ esphome/components/bedjet/fan/* @jhansche
esphome/components/bedjet/sensor/* @javawizard @jhansche
esphome/components/beken_spi_led_strip/* @Mat931
esphome/components/bh1750/* @OttoWinter
esphome/components/bh1900nux/* @B48D81EFCC
esphome/components/binary_sensor/* @esphome/core
esphome/components/bk72xx/* @kuba2k2
esphome/components/bl0906/* @athom-tech @jesserockz @tarontop
@@ -69,6 +70,7 @@ esphome/components/bl0939/* @ziceva
esphome/components/bl0940/* @dan-s-github @tobias-
esphome/components/bl0942/* @dbuezas @dwmw2
esphome/components/ble_client/* @buxtronix @clydebarrow
esphome/components/ble_nus/* @tomaszduda23
esphome/components/bluetooth_proxy/* @bdraco @jesserockz
esphome/components/bme280_base/* @esphome/core
esphome/components/bme280_spi/* @apbodrov
@@ -139,6 +141,7 @@ esphome/components/ens160_base/* @latonita @vincentscode
esphome/components/ens160_i2c/* @latonita
esphome/components/ens160_spi/* @latonita
esphome/components/ens210/* @itn3rd77
esphome/components/epaper_spi/* @esphome/core
esphome/components/es7210/* @kahrendt
esphome/components/es7243e/* @kbx81
esphome/components/es8156/* @kbx81
@@ -152,12 +155,14 @@ esphome/components/esp32_ble_tracker/* @bdraco
esphome/components/esp32_camera_web_server/* @ayufan
esphome/components/esp32_can/* @Sympatron
esphome/components/esp32_hosted/* @swoboda1337
esphome/components/esp32_hosted/update/* @swoboda1337
esphome/components/esp32_improv/* @jesserockz
esphome/components/esp32_rmt/* @jesserockz
esphome/components/esp32_rmt_led_strip/* @jesserockz
esphome/components/esp8266/* @esphome/core
esphome/components/esp_ldo/* @clydebarrow
esphome/components/espnow/* @jesserockz
esphome/components/espnow/packet_transport/* @EasilyBoredEngineer
esphome/components/ethernet_info/* @gtjadsonsantos
esphome/components/event/* @nohat
esphome/components/exposure_notifications/* @OttoWinter
@@ -197,6 +202,7 @@ esphome/components/havells_solar/* @sourabhjaiswal
esphome/components/hbridge/fan/* @WeekendWarrior
esphome/components/hbridge/light/* @DotNetDann
esphome/components/hbridge/switch/* @dwmw2
esphome/components/hdc2010/* @optimusprimespace @ssieb
esphome/components/he60r/* @clydebarrow
esphome/components/heatpumpir/* @rob-deutsch
esphome/components/hitachi_ac424/* @sourabhjaiswal
@@ -256,6 +262,7 @@ esphome/components/libretiny_pwm/* @kuba2k2
esphome/components/light/* @esphome/core
esphome/components/lightwaverf/* @max246
esphome/components/lilygo_t5_47/touchscreen/* @jesserockz
esphome/components/lm75b/* @beormund
esphome/components/ln882x/* @lamauny
esphome/components/lock/* @esphome/core
esphome/components/logger/* @esphome/core
@@ -428,6 +435,7 @@ esphome/components/speaker/media_player/* @kahrendt @synesthesiam
esphome/components/spi/* @clydebarrow @esphome/core
esphome/components/spi_device/* @clydebarrow
esphome/components/spi_led_strip/* @clydebarrow
esphome/components/split_buffer/* @jesserockz
esphome/components/sprinkler/* @kbx81
esphome/components/sps30/* @martgras
esphome/components/ssd1322_base/* @kbx81
@@ -472,6 +480,7 @@ esphome/components/template/fan/* @ssieb
esphome/components/text/* @mauritskorse
esphome/components/thermostat/* @kbx81
esphome/components/time/* @esphome/core
esphome/components/tinyusb/* @kbx81
esphome/components/tlc5947/* @rnauber
esphome/components/tlc5971/* @IJIJI
esphome/components/tm1621/* @Philippe12

View File

@@ -48,7 +48,7 @@ PROJECT_NAME = ESPHome
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = 2025.10.0-dev
PROJECT_NUMBER = 2025.11.0-dev
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a

View File

@@ -14,9 +14,11 @@ from typing import Protocol
import argcomplete
# Note: Do not import modules from esphome.components here, as this would
# cause them to be loaded before external components are processed, resulting
# in the built-in version being used instead of the external component one.
from esphome import const, writer, yaml_util
import esphome.codegen as cg
from esphome.components.mqtt import CONF_DISCOVER_IP
from esphome.config import iter_component_configs, read_config, strip_default_ids
from esphome.const import (
ALLOWED_NAME_CHARS,
@@ -60,6 +62,40 @@ from esphome.util import (
_LOGGER = logging.getLogger(__name__)
# Special non-component keys that appear in configs
_NON_COMPONENT_KEYS = frozenset(
{
CONF_ESPHOME,
"substitutions",
"packages",
"globals",
"external_components",
"<<",
}
)
def detect_external_components(config: ConfigType) -> set[str]:
"""Detect external/custom components in the configuration.
External components are those that appear in the config but are not
part of ESPHome's built-in components and are not special config keys.
Args:
config: The ESPHome configuration dictionary
Returns:
A set of external component names
"""
from esphome.analyze_memory.helpers import get_esphome_components
builtin_components = get_esphome_components()
return {
key
for key in config
if key not in builtin_components and key not in _NON_COMPONENT_KEYS
}
class ArgsProtocol(Protocol):
device: list[str] | None
@@ -115,6 +151,17 @@ class Purpose(StrEnum):
LOGGING = "logging"
class PortType(StrEnum):
SERIAL = "SERIAL"
NETWORK = "NETWORK"
MQTT = "MQTT"
MQTTIP = "MQTTIP"
# Magic MQTT port types that require special handling
_MQTT_PORT_TYPES = frozenset({PortType.MQTT, PortType.MQTTIP})
def _resolve_with_cache(address: str, purpose: Purpose) -> list[str]:
"""Resolve an address using cache if available, otherwise return the address itself."""
if CORE.address_cache and (cached := CORE.address_cache.get_addresses(address)):
@@ -160,19 +207,21 @@ def choose_upload_log_host(
if has_mqtt_logging():
resolved.append("MQTT")
if has_api() and has_non_ip_address():
if has_api() and has_non_ip_address() and has_resolvable_address():
resolved.extend(_resolve_with_cache(CORE.address, purpose))
elif purpose == Purpose.UPLOADING:
if has_ota() and has_mqtt_ip_lookup():
resolved.append("MQTTIP")
if has_ota() and has_non_ip_address():
if has_ota() and has_non_ip_address() and has_resolvable_address():
resolved.extend(_resolve_with_cache(CORE.address, purpose))
else:
resolved.append(device)
if not resolved:
_LOGGER.error("All specified devices: %s could not be resolved.", defaults)
raise EsphomeError(
f"All specified devices {defaults} could not be resolved. Is the device connected to the network?"
)
return resolved
# No devices specified, show interactive chooser
@@ -240,6 +289,8 @@ def has_ota() -> bool:
def has_mqtt_ip_lookup() -> bool:
"""Check if MQTT is available and IP lookup is supported."""
from esphome.components.mqtt import CONF_DISCOVER_IP
if CONF_MQTT not in CORE.config:
return False
# Default Enabled
@@ -264,8 +315,20 @@ def has_ip_address() -> bool:
def has_resolvable_address() -> bool:
"""Check if CORE.address is resolvable (via mDNS or is an IP address)."""
return has_mdns() or has_ip_address()
"""Check if CORE.address is resolvable (via mDNS, DNS, or is an IP address)."""
# Any address (IP, mDNS hostname, or regular DNS hostname) is resolvable
# The resolve_ip_address() function in helpers.py handles all types via AsyncResolver
if CORE.address is None:
return False
if has_ip_address():
return True
if has_mdns():
return True
# .local mDNS hostnames are only resolvable if mDNS is enabled
return not CORE.address.endswith(".local")
def mqtt_get_ip(config: ConfigType, username: str, password: str, client_id: str):
@@ -274,16 +337,67 @@ def mqtt_get_ip(config: ConfigType, username: str, password: str, client_id: str
return mqtt.get_esphome_device_ip(config, username, password, client_id)
_PORT_TO_PORT_TYPE = {
"MQTT": "MQTT",
"MQTTIP": "MQTTIP",
}
def _resolve_network_devices(
devices: list[str], config: ConfigType, args: ArgsProtocol
) -> list[str]:
"""Resolve device list, converting MQTT magic strings to actual IP addresses.
This function filters the devices list to:
- Replace MQTT/MQTTIP magic strings with actual IP addresses via MQTT lookup
- Deduplicate addresses while preserving order
- Only resolve MQTT once even if multiple MQTT strings are present
- If MQTT resolution fails, log a warning and continue with other devices
Args:
devices: List of device identifiers (IPs, hostnames, or magic strings)
config: ESPHome configuration
args: Command-line arguments containing MQTT credentials
Returns:
List of network addresses suitable for connection attempts
"""
network_devices: list[str] = []
mqtt_resolved: bool = False
for device in devices:
port_type = get_port_type(device)
if port_type in _MQTT_PORT_TYPES:
# Only resolve MQTT once, even if multiple MQTT entries
if not mqtt_resolved:
try:
mqtt_ips = mqtt_get_ip(
config, args.username, args.password, args.client_id
)
network_devices.extend(mqtt_ips)
except EsphomeError as err:
_LOGGER.warning(
"MQTT IP discovery failed (%s), will try other devices if available",
err,
)
mqtt_resolved = True
elif device not in network_devices:
# Regular network address or IP - add if not already present
network_devices.append(device)
return network_devices
def get_port_type(port: str) -> str:
def get_port_type(port: str) -> PortType:
"""Determine the type of port/device identifier.
Returns:
PortType.SERIAL for serial ports (/dev/ttyUSB0, COM1, etc.)
PortType.MQTT for MQTT logging
PortType.MQTTIP for MQTT IP lookup
PortType.NETWORK for IP addresses, hostnames, or mDNS names
"""
if port.startswith("/") or port.startswith("COM"):
return "SERIAL"
return _PORT_TO_PORT_TYPE.get(port, "NETWORK")
return PortType.SERIAL
if port == "MQTT":
return PortType.MQTT
if port == "MQTTIP":
return PortType.MQTTIP
return PortType.NETWORK
def run_miniterm(config: ConfigType, port: str, args) -> int:
@@ -398,7 +512,9 @@ def write_cpp_file() -> int:
def compile_program(args: ArgsProtocol, config: ConfigType) -> int:
from esphome import platformio_api
_LOGGER.info("Compiling app...")
# NOTE: "Build path:" format is parsed by script/ci_memory_impact_extract.py
# If you change this format, update the regex in that script as well
_LOGGER.info("Compiling app... Build path: %s", CORE.build_path)
rc = platformio_api.run_compile(config, CORE.verbose)
if rc != 0:
return rc
@@ -483,7 +599,7 @@ def upload_using_platformio(config: ConfigType, port: str):
def check_permissions(port: str):
if os.name == "posix" and get_port_type(port) == "SERIAL":
if os.name == "posix" and get_port_type(port) == PortType.SERIAL:
# Check if we can open selected serial port
if not os.access(port, os.F_OK):
raise EsphomeError(
@@ -511,7 +627,7 @@ def upload_program(
except AttributeError:
pass
if get_port_type(host) == "SERIAL":
if get_port_type(host) == PortType.SERIAL:
check_permissions(host)
exit_code = 1
@@ -538,17 +654,16 @@ def upload_program(
from esphome import espota2
remote_port = int(ota_conf[CONF_PORT])
password = ota_conf.get(CONF_PASSWORD, "")
password = ota_conf.get(CONF_PASSWORD)
if getattr(args, "file", None) is not None:
binary = Path(args.file)
else:
binary = CORE.firmware_bin
# MQTT address resolution
if get_port_type(host) in ("MQTT", "MQTTIP"):
devices = mqtt_get_ip(config, args.username, args.password, args.client_id)
# Resolve MQTT magic strings to actual IP addresses
network_devices = _resolve_network_devices(devices, config, args)
return espota2.run_ota(devices, remote_port, password, binary)
return espota2.run_ota(network_devices, remote_port, password, binary)
def show_logs(config: ConfigType, args: ArgsProtocol, devices: list[str]) -> int | None:
@@ -563,32 +678,22 @@ def show_logs(config: ConfigType, args: ArgsProtocol, devices: list[str]) -> int
raise EsphomeError("Logger is not configured!")
port = devices[0]
port_type = get_port_type(port)
if get_port_type(port) == "SERIAL":
if port_type == PortType.SERIAL:
check_permissions(port)
return run_miniterm(config, port, args)
port_type = get_port_type(port)
# Check if we should use API for logging
if has_api():
addresses_to_use: list[str] | None = None
# Resolve MQTT magic strings to actual IP addresses
if has_api() and (
network_devices := _resolve_network_devices(devices, config, args)
):
from esphome.components.api.client import run_logs
if port_type == "NETWORK" and (has_mdns() or is_ip_address(port)):
addresses_to_use = devices
elif port_type in ("NETWORK", "MQTT", "MQTTIP") and has_mqtt_ip_lookup():
# Only use MQTT IP lookup if the first condition didn't match
# (for MQTT/MQTTIP types, or for NETWORK when mdns/ip check fails)
addresses_to_use = mqtt_get_ip(
config, args.username, args.password, args.client_id
)
return run_logs(config, network_devices)
if addresses_to_use is not None:
from esphome.components.api.client import run_logs
return run_logs(config, addresses_to_use)
if port_type in ("NETWORK", "MQTT") and has_mqtt_logging():
if port_type in (PortType.NETWORK, PortType.MQTT) and has_mqtt_logging():
from esphome import mqtt
return mqtt.show_logs(
@@ -838,6 +943,54 @@ def command_idedata(args: ArgsProtocol, config: ConfigType) -> int:
return 0
def command_analyze_memory(args: ArgsProtocol, config: ConfigType) -> int:
"""Analyze memory usage by component.
This command compiles the configuration and performs memory analysis.
Compilation is fast if sources haven't changed (just relinking).
"""
from esphome import platformio_api
from esphome.analyze_memory.cli import MemoryAnalyzerCLI
# Always compile to ensure fresh data (fast if no changes - just relinks)
exit_code = write_cpp(config)
if exit_code != 0:
return exit_code
exit_code = compile_program(args, config)
if exit_code != 0:
return exit_code
_LOGGER.info("Successfully compiled program.")
# Get idedata for analysis
idedata = platformio_api.get_idedata(config)
if idedata is None:
_LOGGER.error("Failed to get IDE data for memory analysis")
return 1
firmware_elf = Path(idedata.firmware_elf_path)
# Extract external components from config
external_components = detect_external_components(config)
_LOGGER.debug("Detected external components: %s", external_components)
# Perform memory analysis
_LOGGER.info("Analyzing memory usage...")
analyzer = MemoryAnalyzerCLI(
str(firmware_elf),
idedata.objdump_path,
idedata.readelf_path,
external_components,
)
analyzer.analyze()
# Generate and display report
report = analyzer.generate_report()
print()
print(report)
return 0
def command_rename(args: ArgsProtocol, config: ConfigType) -> int | None:
new_name = args.name
for c in new_name:
@@ -953,6 +1106,7 @@ POST_CONFIG_ACTIONS = {
"idedata": command_idedata,
"rename": command_rename,
"discover": command_discover,
"analyze-memory": command_analyze_memory,
}
SIMPLE_CONFIG_ACTIONS = [
@@ -1005,6 +1159,12 @@ def parse_args(argv):
action="append",
default=[],
)
options_parser.add_argument(
"--testing-mode",
help="Enable testing mode (disables validation checks for grouped component testing)",
action="store_true",
default=False,
)
parser = argparse.ArgumentParser(
description=f"ESPHome {const.__version__}", parents=[options_parser]
@@ -1243,6 +1403,14 @@ def parse_args(argv):
)
parser_rename.add_argument("name", help="The new name for the device.", type=str)
parser_analyze_memory = subparsers.add_parser(
"analyze-memory",
help="Analyze memory usage by component.",
)
parser_analyze_memory.add_argument(
"configuration", help="Your YAML configuration file(s).", nargs="+"
)
# Keep backward compatibility with the old command line format of
# esphome <config> <command>.
#
@@ -1274,6 +1442,7 @@ def run_esphome(argv):
args = parse_args(argv)
CORE.dashboard = args.dashboard
CORE.testing_mode = args.testing_mode
# Create address cache from command-line arguments
CORE.address_cache = AddressCache.from_cli_args(

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,502 @@
"""Memory usage analyzer for ESPHome compiled binaries."""
from collections import defaultdict
from dataclasses import dataclass, field
import logging
from pathlib import Path
import re
import subprocess
from typing import TYPE_CHECKING
from .const import (
CORE_SUBCATEGORY_PATTERNS,
DEMANGLED_PATTERNS,
ESPHOME_COMPONENT_PATTERN,
SECTION_TO_ATTR,
SYMBOL_PATTERNS,
)
from .helpers import (
get_component_class_patterns,
get_esphome_components,
map_section_name,
parse_symbol_line,
)
if TYPE_CHECKING:
from esphome.platformio_api import IDEData
_LOGGER = logging.getLogger(__name__)
# GCC global constructor/destructor prefix annotations
_GCC_PREFIX_ANNOTATIONS = {
"_GLOBAL__sub_I_": "global constructor for",
"_GLOBAL__sub_D_": "global destructor for",
}
# GCC optimization suffix pattern (e.g., $isra$0, $part$1, $constprop$2)
_GCC_OPTIMIZATION_SUFFIX_PATTERN = re.compile(r"(\$(?:isra|part|constprop)\$\d+)")
# C++ runtime patterns for categorization
_CPP_RUNTIME_PATTERNS = frozenset(["vtable", "typeinfo", "thunk"])
# libc printf/scanf family base names (used to detect variants like _printf_r, vfprintf, etc.)
_LIBC_PRINTF_SCANF_FAMILY = frozenset(["printf", "fprintf", "sprintf", "scanf"])
# Regex pattern for parsing readelf section headers
# Format: [ #] name type addr off size
_READELF_SECTION_PATTERN = re.compile(
r"\s*\[\s*\d+\]\s+([\.\w]+)\s+\w+\s+[\da-fA-F]+\s+[\da-fA-F]+\s+([\da-fA-F]+)"
)
# Component category prefixes
_COMPONENT_PREFIX_ESPHOME = "[esphome]"
_COMPONENT_PREFIX_EXTERNAL = "[external]"
_COMPONENT_CORE = f"{_COMPONENT_PREFIX_ESPHOME}core"
_COMPONENT_API = f"{_COMPONENT_PREFIX_ESPHOME}api"
# C++ namespace prefixes
_NAMESPACE_ESPHOME = "esphome::"
_NAMESPACE_STD = "std::"
# Type alias for symbol information: (symbol_name, size, component)
SymbolInfoType = tuple[str, int, str]
@dataclass
class MemorySection:
"""Represents a memory section with its symbols."""
name: str
symbols: list[SymbolInfoType] = field(default_factory=list)
total_size: int = 0
@dataclass
class ComponentMemory:
"""Tracks memory usage for a component."""
name: str
text_size: int = 0 # Code in flash
rodata_size: int = 0 # Read-only data in flash
data_size: int = 0 # Initialized data (flash + ram)
bss_size: int = 0 # Uninitialized data (ram only)
symbol_count: int = 0
@property
def flash_total(self) -> int:
"""Total flash usage (text + rodata + data)."""
return self.text_size + self.rodata_size + self.data_size
@property
def ram_total(self) -> int:
"""Total RAM usage (data + bss)."""
return self.data_size + self.bss_size
class MemoryAnalyzer:
"""Analyzes memory usage from ELF files."""
def __init__(
self,
elf_path: str,
objdump_path: str | None = None,
readelf_path: str | None = None,
external_components: set[str] | None = None,
idedata: "IDEData | None" = None,
) -> None:
"""Initialize memory analyzer.
Args:
elf_path: Path to ELF file to analyze
objdump_path: Path to objdump binary (auto-detected from idedata if not provided)
readelf_path: Path to readelf binary (auto-detected from idedata if not provided)
external_components: Set of external component names
idedata: Optional PlatformIO IDEData object to auto-detect toolchain paths
"""
self.elf_path = Path(elf_path)
if not self.elf_path.exists():
raise FileNotFoundError(f"ELF file not found: {elf_path}")
# Auto-detect toolchain paths from idedata if not provided
if idedata is not None and (objdump_path is None or readelf_path is None):
objdump_path = objdump_path or idedata.objdump_path
readelf_path = readelf_path or idedata.readelf_path
_LOGGER.debug("Using toolchain paths from PlatformIO idedata")
self.objdump_path = objdump_path or "objdump"
self.readelf_path = readelf_path or "readelf"
self.external_components = external_components or set()
self.sections: dict[str, MemorySection] = {}
self.components: dict[str, ComponentMemory] = defaultdict(
lambda: ComponentMemory("")
)
self._demangle_cache: dict[str, str] = {}
self._uncategorized_symbols: list[tuple[str, str, int]] = []
self._esphome_core_symbols: list[
tuple[str, str, int]
] = [] # Track core symbols
self._component_symbols: dict[str, list[tuple[str, str, int]]] = defaultdict(
list
) # Track symbols for all components
def analyze(self) -> dict[str, ComponentMemory]:
"""Analyze the ELF file and return component memory usage."""
self._parse_sections()
self._parse_symbols()
self._categorize_symbols()
return dict(self.components)
def _parse_sections(self) -> None:
"""Parse section headers from ELF file."""
result = subprocess.run(
[self.readelf_path, "-S", str(self.elf_path)],
capture_output=True,
text=True,
check=True,
)
# Parse section headers
for line in result.stdout.splitlines():
# Look for section entries
if not (match := _READELF_SECTION_PATTERN.match(line)):
continue
section_name = match.group(1)
size_hex = match.group(2)
size = int(size_hex, 16)
# Map to standard section name
mapped_section = map_section_name(section_name)
if not mapped_section:
continue
if mapped_section not in self.sections:
self.sections[mapped_section] = MemorySection(mapped_section)
self.sections[mapped_section].total_size += size
def _parse_symbols(self) -> None:
"""Parse symbols from ELF file."""
result = subprocess.run(
[self.objdump_path, "-t", str(self.elf_path)],
capture_output=True,
text=True,
check=True,
)
# Track seen addresses to avoid duplicates
seen_addresses: set[str] = set()
for line in result.stdout.splitlines():
if not (symbol_info := parse_symbol_line(line)):
continue
section, name, size, address = symbol_info
# Skip duplicate symbols at the same address (e.g., C1/C2 constructors)
if address in seen_addresses or section not in self.sections:
continue
self.sections[section].symbols.append((name, size, ""))
seen_addresses.add(address)
def _categorize_symbols(self) -> None:
"""Categorize symbols by component."""
# First, collect all unique symbol names for batch demangling
all_symbols = {
symbol_name
for section in self.sections.values()
for symbol_name, _, _ in section.symbols
}
# Batch demangle all symbols at once
self._batch_demangle_symbols(list(all_symbols))
# Now categorize with cached demangled names
for section_name, section in self.sections.items():
for symbol_name, size, _ in section.symbols:
component = self._identify_component(symbol_name)
if component not in self.components:
self.components[component] = ComponentMemory(component)
comp_mem = self.components[component]
comp_mem.symbol_count += 1
# Update the appropriate size attribute based on section
if attr_name := SECTION_TO_ATTR.get(section_name):
setattr(comp_mem, attr_name, getattr(comp_mem, attr_name) + size)
# Track uncategorized symbols
if component == "other" and size > 0:
demangled = self._demangle_symbol(symbol_name)
self._uncategorized_symbols.append((symbol_name, demangled, size))
# Track ESPHome core symbols for detailed analysis
if component == _COMPONENT_CORE and size > 0:
demangled = self._demangle_symbol(symbol_name)
self._esphome_core_symbols.append((symbol_name, demangled, size))
# Track all component symbols for detailed analysis
if size > 0:
demangled = self._demangle_symbol(symbol_name)
self._component_symbols[component].append(
(symbol_name, demangled, size)
)
def _identify_component(self, symbol_name: str) -> str:
"""Identify which component a symbol belongs to."""
# Demangle C++ names if needed
demangled = self._demangle_symbol(symbol_name)
# Check for special component classes first (before namespace pattern)
# This handles cases like esphome::ESPHomeOTAComponent which should map to ota
if _NAMESPACE_ESPHOME in demangled:
# Check for special component classes that include component name in the class
# For example: esphome::ESPHomeOTAComponent -> ota component
for component_name in get_esphome_components():
patterns = get_component_class_patterns(component_name)
if any(pattern in demangled for pattern in patterns):
return f"{_COMPONENT_PREFIX_ESPHOME}{component_name}"
# Check for ESPHome component namespaces
match = ESPHOME_COMPONENT_PATTERN.search(demangled)
if match:
component_name = match.group(1)
# Strip trailing underscore if present (e.g., switch_ -> switch)
component_name = component_name.rstrip("_")
# Check if this is an actual component in the components directory
if component_name in get_esphome_components():
return f"{_COMPONENT_PREFIX_ESPHOME}{component_name}"
# Check if this is a known external component from the config
if component_name in self.external_components:
return f"{_COMPONENT_PREFIX_EXTERNAL}{component_name}"
# Everything else in esphome:: namespace is core
return _COMPONENT_CORE
# Check for esphome core namespace (no component namespace)
if _NAMESPACE_ESPHOME in demangled:
# If no component match found, it's core
return _COMPONENT_CORE
# Check against symbol patterns
for component, patterns in SYMBOL_PATTERNS.items():
if any(pattern in symbol_name for pattern in patterns):
return component
# Check against demangled patterns
for component, patterns in DEMANGLED_PATTERNS.items():
if any(pattern in demangled for pattern in patterns):
return component
# Special cases that need more complex logic
# Check if spi_flash vs spi_driver
if "spi_" in symbol_name or "SPI" in symbol_name:
return "spi_flash" if "spi_flash" in symbol_name else "spi_driver"
# libc special printf variants
if (
symbol_name.startswith("_")
and symbol_name[1:].replace("_r", "").replace("v", "").replace("s", "")
in _LIBC_PRINTF_SCANF_FAMILY
):
return "libc"
# Track uncategorized symbols for analysis
return "other"
def _batch_demangle_symbols(self, symbols: list[str]) -> None:
"""Batch demangle C++ symbol names for efficiency."""
if not symbols:
return
# Try to find the appropriate c++filt for the platform
cppfilt_cmd = "c++filt"
_LOGGER.info("Demangling %d symbols", len(symbols))
_LOGGER.debug("objdump_path = %s", self.objdump_path)
# Check if we have a toolchain-specific c++filt
if self.objdump_path and self.objdump_path != "objdump":
# Replace objdump with c++filt in the path
potential_cppfilt = self.objdump_path.replace("objdump", "c++filt")
_LOGGER.info("Checking for toolchain c++filt at: %s", potential_cppfilt)
if Path(potential_cppfilt).exists():
cppfilt_cmd = potential_cppfilt
_LOGGER.info("✓ Using toolchain c++filt: %s", cppfilt_cmd)
else:
_LOGGER.info(
"✗ Toolchain c++filt not found at %s, using system c++filt",
potential_cppfilt,
)
else:
_LOGGER.info("✗ Using system c++filt (objdump_path=%s)", self.objdump_path)
# Strip GCC optimization suffixes and prefixes before demangling
# Suffixes like $isra$0, $part$0, $constprop$0 confuse c++filt
# Prefixes like _GLOBAL__sub_I_ need to be removed and tracked
symbols_stripped: list[str] = []
symbols_prefixes: list[str] = [] # Track removed prefixes
for symbol in symbols:
# Remove GCC optimization markers
stripped = _GCC_OPTIMIZATION_SUFFIX_PATTERN.sub("", symbol)
# Handle GCC global constructor/initializer prefixes
# _GLOBAL__sub_I_<mangled> -> extract <mangled> for demangling
prefix = ""
for gcc_prefix in _GCC_PREFIX_ANNOTATIONS:
if stripped.startswith(gcc_prefix):
prefix = gcc_prefix
stripped = stripped[len(prefix) :]
break
symbols_stripped.append(stripped)
symbols_prefixes.append(prefix)
try:
# Send all symbols to c++filt at once
result = subprocess.run(
[cppfilt_cmd],
input="\n".join(symbols_stripped),
capture_output=True,
text=True,
check=False,
)
except (subprocess.SubprocessError, OSError, UnicodeDecodeError) as e:
# On error, cache originals
_LOGGER.warning("Failed to batch demangle symbols: %s", e)
for symbol in symbols:
self._demangle_cache[symbol] = symbol
return
if result.returncode != 0:
_LOGGER.warning(
"c++filt exited with code %d: %s",
result.returncode,
result.stderr[:200] if result.stderr else "(no error output)",
)
# Cache originals on failure
for symbol in symbols:
self._demangle_cache[symbol] = symbol
return
# Process demangled output
self._process_demangled_output(
symbols, symbols_stripped, symbols_prefixes, result.stdout, cppfilt_cmd
)
def _process_demangled_output(
self,
symbols: list[str],
symbols_stripped: list[str],
symbols_prefixes: list[str],
demangled_output: str,
cppfilt_cmd: str,
) -> None:
"""Process demangled symbol output and populate cache.
Args:
symbols: Original symbol names
symbols_stripped: Stripped symbol names sent to c++filt
symbols_prefixes: Removed prefixes to restore
demangled_output: Output from c++filt
cppfilt_cmd: Path to c++filt command (for logging)
"""
demangled_lines = demangled_output.strip().split("\n")
failed_count = 0
for original, stripped, prefix, demangled in zip(
symbols, symbols_stripped, symbols_prefixes, demangled_lines
):
# Add back any prefix that was removed
demangled = self._restore_symbol_prefix(prefix, stripped, demangled)
# If we stripped a suffix, add it back to the demangled name for clarity
if original != stripped and not prefix:
demangled = self._restore_symbol_suffix(original, demangled)
self._demangle_cache[original] = demangled
# Log symbols that failed to demangle (stayed the same as stripped version)
if stripped == demangled and stripped.startswith("_Z"):
failed_count += 1
if failed_count <= 5: # Only log first 5 failures
_LOGGER.warning("Failed to demangle: %s", original)
if failed_count == 0:
_LOGGER.info("Successfully demangled all %d symbols", len(symbols))
return
_LOGGER.warning(
"Failed to demangle %d/%d symbols using %s",
failed_count,
len(symbols),
cppfilt_cmd,
)
@staticmethod
def _restore_symbol_prefix(prefix: str, stripped: str, demangled: str) -> str:
"""Restore prefix that was removed before demangling.
Args:
prefix: Prefix that was removed (e.g., "_GLOBAL__sub_I_")
stripped: Stripped symbol name
demangled: Demangled symbol name
Returns:
Demangled name with prefix restored/annotated
"""
if not prefix:
return demangled
# Successfully demangled - add descriptive prefix
if demangled != stripped and (
annotation := _GCC_PREFIX_ANNOTATIONS.get(prefix)
):
return f"[{annotation}: {demangled}]"
# Failed to demangle - restore original prefix
return prefix + demangled
@staticmethod
def _restore_symbol_suffix(original: str, demangled: str) -> str:
"""Restore GCC optimization suffix that was removed before demangling.
Args:
original: Original symbol name with suffix
demangled: Demangled symbol name without suffix
Returns:
Demangled name with suffix annotation
"""
if suffix_match := _GCC_OPTIMIZATION_SUFFIX_PATTERN.search(original):
return f"{demangled} [{suffix_match.group(1)}]"
return demangled
def _demangle_symbol(self, symbol: str) -> str:
"""Get demangled C++ symbol name from cache."""
return self._demangle_cache.get(symbol, symbol)
def _categorize_esphome_core_symbol(self, demangled: str) -> str:
"""Categorize ESPHome core symbols into subcategories."""
# Special patterns that need to be checked separately
if any(pattern in demangled for pattern in _CPP_RUNTIME_PATTERNS):
return "C++ Runtime (vtables/RTTI)"
if demangled.startswith(_NAMESPACE_STD):
return "C++ STL"
# Check against patterns from const.py
for category, patterns in CORE_SUBCATEGORY_PATTERNS.items():
if any(pattern in demangled for pattern in patterns):
return category
return "Other Core"
if __name__ == "__main__":
from .cli import main
main()

View File

@@ -0,0 +1,6 @@
"""Main entry point for running the memory analyzer as a module."""
from .cli import main
if __name__ == "__main__":
main()

View File

@@ -0,0 +1,444 @@
"""CLI interface for memory analysis with report generation."""
from collections import defaultdict
import json
import sys
from . import (
_COMPONENT_API,
_COMPONENT_CORE,
_COMPONENT_PREFIX_ESPHOME,
_COMPONENT_PREFIX_EXTERNAL,
MemoryAnalyzer,
)
class MemoryAnalyzerCLI(MemoryAnalyzer):
"""Memory analyzer with CLI-specific report generation."""
# Column width constants
COL_COMPONENT: int = 29
COL_FLASH_TEXT: int = 14
COL_FLASH_DATA: int = 14
COL_RAM_DATA: int = 12
COL_RAM_BSS: int = 12
COL_TOTAL_FLASH: int = 15
COL_TOTAL_RAM: int = 12
COL_SEPARATOR: int = 3 # " | "
# Core analysis column widths
COL_CORE_SUBCATEGORY: int = 30
COL_CORE_SIZE: int = 12
COL_CORE_COUNT: int = 6
COL_CORE_PERCENT: int = 10
# Calculate table width once at class level
TABLE_WIDTH: int = (
COL_COMPONENT
+ COL_SEPARATOR
+ COL_FLASH_TEXT
+ COL_SEPARATOR
+ COL_FLASH_DATA
+ COL_SEPARATOR
+ COL_RAM_DATA
+ COL_SEPARATOR
+ COL_RAM_BSS
+ COL_SEPARATOR
+ COL_TOTAL_FLASH
+ COL_SEPARATOR
+ COL_TOTAL_RAM
)
@staticmethod
def _make_separator_line(*widths: int) -> str:
"""Create a separator line with given column widths.
Args:
widths: Column widths to create separators for
Returns:
Separator line like "----+---------+-----"
"""
return "-+-".join("-" * width for width in widths)
# Pre-computed separator lines
MAIN_TABLE_SEPARATOR: str = _make_separator_line(
COL_COMPONENT,
COL_FLASH_TEXT,
COL_FLASH_DATA,
COL_RAM_DATA,
COL_RAM_BSS,
COL_TOTAL_FLASH,
COL_TOTAL_RAM,
)
CORE_TABLE_SEPARATOR: str = _make_separator_line(
COL_CORE_SUBCATEGORY,
COL_CORE_SIZE,
COL_CORE_COUNT,
COL_CORE_PERCENT,
)
def generate_report(self, detailed: bool = False) -> str:
"""Generate a formatted memory report."""
components = sorted(
self.components.items(), key=lambda x: x[1].flash_total, reverse=True
)
# Calculate totals
total_flash = sum(c.flash_total for _, c in components)
total_ram = sum(c.ram_total for _, c in components)
# Build report
lines: list[str] = []
lines.append("=" * self.TABLE_WIDTH)
lines.append("Component Memory Analysis".center(self.TABLE_WIDTH))
lines.append("=" * self.TABLE_WIDTH)
lines.append("")
# Main table - fixed column widths
lines.append(
f"{'Component':<{self.COL_COMPONENT}} | {'Flash (text)':>{self.COL_FLASH_TEXT}} | {'Flash (data)':>{self.COL_FLASH_DATA}} | {'RAM (data)':>{self.COL_RAM_DATA}} | {'RAM (bss)':>{self.COL_RAM_BSS}} | {'Total Flash':>{self.COL_TOTAL_FLASH}} | {'Total RAM':>{self.COL_TOTAL_RAM}}"
)
lines.append(self.MAIN_TABLE_SEPARATOR)
for name, mem in components:
if mem.flash_total > 0 or mem.ram_total > 0:
flash_rodata = mem.rodata_size + mem.data_size
lines.append(
f"{name:<{self.COL_COMPONENT}} | {mem.text_size:>{self.COL_FLASH_TEXT - 2},} B | {flash_rodata:>{self.COL_FLASH_DATA - 2},} B | "
f"{mem.data_size:>{self.COL_RAM_DATA - 2},} B | {mem.bss_size:>{self.COL_RAM_BSS - 2},} B | "
f"{mem.flash_total:>{self.COL_TOTAL_FLASH - 2},} B | {mem.ram_total:>{self.COL_TOTAL_RAM - 2},} B"
)
lines.append(self.MAIN_TABLE_SEPARATOR)
lines.append(
f"{'TOTAL':<{self.COL_COMPONENT}} | {' ':>{self.COL_FLASH_TEXT}} | {' ':>{self.COL_FLASH_DATA}} | "
f"{' ':>{self.COL_RAM_DATA}} | {' ':>{self.COL_RAM_BSS}} | "
f"{total_flash:>{self.COL_TOTAL_FLASH - 2},} B | {total_ram:>{self.COL_TOTAL_RAM - 2},} B"
)
# Top consumers
lines.append("")
lines.append("Top Flash Consumers:")
for i, (name, mem) in enumerate(components[:25]):
if mem.flash_total > 0:
percentage = (
(mem.flash_total / total_flash * 100) if total_flash > 0 else 0
)
lines.append(
f"{i + 1}. {name} ({mem.flash_total:,} B) - {percentage:.1f}% of analyzed flash"
)
lines.append("")
lines.append("Top RAM Consumers:")
ram_components = sorted(components, key=lambda x: x[1].ram_total, reverse=True)
for i, (name, mem) in enumerate(ram_components[:25]):
if mem.ram_total > 0:
percentage = (mem.ram_total / total_ram * 100) if total_ram > 0 else 0
lines.append(
f"{i + 1}. {name} ({mem.ram_total:,} B) - {percentage:.1f}% of analyzed RAM"
)
lines.append("")
lines.append(
"Note: This analysis covers symbols in the ELF file. Some runtime allocations may not be included."
)
lines.append("=" * self.TABLE_WIDTH)
# Add ESPHome core detailed analysis if there are core symbols
if self._esphome_core_symbols:
lines.append("")
lines.append("=" * self.TABLE_WIDTH)
lines.append(
f"{_COMPONENT_CORE} Detailed Analysis".center(self.TABLE_WIDTH)
)
lines.append("=" * self.TABLE_WIDTH)
lines.append("")
# Group core symbols by subcategory
core_subcategories: dict[str, list[tuple[str, str, int]]] = defaultdict(
list
)
for symbol, demangled, size in self._esphome_core_symbols:
# Categorize based on demangled name patterns
subcategory = self._categorize_esphome_core_symbol(demangled)
core_subcategories[subcategory].append((symbol, demangled, size))
# Sort subcategories by total size
sorted_subcategories = sorted(
[
(name, symbols, sum(s[2] for s in symbols))
for name, symbols in core_subcategories.items()
],
key=lambda x: x[2],
reverse=True,
)
lines.append(
f"{'Subcategory':<{self.COL_CORE_SUBCATEGORY}} | {'Size':>{self.COL_CORE_SIZE}} | "
f"{'Count':>{self.COL_CORE_COUNT}} | {'% of Core':>{self.COL_CORE_PERCENT}}"
)
lines.append(self.CORE_TABLE_SEPARATOR)
core_total = sum(size for _, _, size in self._esphome_core_symbols)
for subcategory, symbols, total_size in sorted_subcategories:
percentage = (total_size / core_total * 100) if core_total > 0 else 0
lines.append(
f"{subcategory:<{self.COL_CORE_SUBCATEGORY}} | {total_size:>{self.COL_CORE_SIZE - 2},} B | "
f"{len(symbols):>{self.COL_CORE_COUNT}} | {percentage:>{self.COL_CORE_PERCENT - 1}.1f}%"
)
# Top 15 largest core symbols
lines.append("")
lines.append(f"Top 15 Largest {_COMPONENT_CORE} Symbols:")
sorted_core_symbols = sorted(
self._esphome_core_symbols, key=lambda x: x[2], reverse=True
)
for i, (symbol, demangled, size) in enumerate(sorted_core_symbols[:15]):
lines.append(f"{i + 1}. {demangled} ({size:,} B)")
lines.append("=" * self.TABLE_WIDTH)
# Add detailed analysis for top ESPHome and external components
esphome_components = [
(name, mem)
for name, mem in components
if name.startswith(_COMPONENT_PREFIX_ESPHOME) and name != _COMPONENT_CORE
]
external_components = [
(name, mem)
for name, mem in components
if name.startswith(_COMPONENT_PREFIX_EXTERNAL)
]
top_esphome_components = sorted(
esphome_components, key=lambda x: x[1].flash_total, reverse=True
)[:30]
# Include all external components (they're usually important)
top_external_components = sorted(
external_components, key=lambda x: x[1].flash_total, reverse=True
)
# Check if API component exists and ensure it's included
api_component = None
for name, mem in components:
if name == _COMPONENT_API:
api_component = (name, mem)
break
# Also include wifi_stack and other important system components if they exist
system_components_to_include = [
# Empty list - we've finished debugging symbol categorization
# Add component names here if you need to debug their symbols
]
system_components = [
(name, mem)
for name, mem in components
if name in system_components_to_include
]
# Combine all components to analyze: top ESPHome + all external + API if not already included + system components
components_to_analyze = (
list(top_esphome_components)
+ list(top_external_components)
+ system_components
)
if api_component and api_component not in components_to_analyze:
components_to_analyze.append(api_component)
if components_to_analyze:
for comp_name, comp_mem in components_to_analyze:
if not (comp_symbols := self._component_symbols.get(comp_name, [])):
continue
lines.append("")
lines.append("=" * self.TABLE_WIDTH)
lines.append(f"{comp_name} Detailed Analysis".center(self.TABLE_WIDTH))
lines.append("=" * self.TABLE_WIDTH)
lines.append("")
# Sort symbols by size
sorted_symbols = sorted(comp_symbols, key=lambda x: x[2], reverse=True)
lines.append(f"Total symbols: {len(sorted_symbols)}")
lines.append(f"Total size: {comp_mem.flash_total:,} B")
lines.append("")
# Show all symbols > 100 bytes for better visibility
large_symbols = [
(sym, dem, size) for sym, dem, size in sorted_symbols if size > 100
]
lines.append(
f"{comp_name} Symbols > 100 B ({len(large_symbols)} symbols):"
)
for i, (symbol, demangled, size) in enumerate(large_symbols):
lines.append(f"{i + 1}. {demangled} ({size:,} B)")
lines.append("=" * self.TABLE_WIDTH)
return "\n".join(lines)
def to_json(self) -> str:
"""Export analysis results as JSON."""
data = {
"components": {
name: {
"text": mem.text_size,
"rodata": mem.rodata_size,
"data": mem.data_size,
"bss": mem.bss_size,
"flash_total": mem.flash_total,
"ram_total": mem.ram_total,
"symbol_count": mem.symbol_count,
}
for name, mem in self.components.items()
},
"totals": {
"flash": sum(c.flash_total for c in self.components.values()),
"ram": sum(c.ram_total for c in self.components.values()),
},
}
return json.dumps(data, indent=2)
def dump_uncategorized_symbols(self, output_file: str | None = None) -> None:
"""Dump uncategorized symbols for analysis."""
# Sort by size descending
sorted_symbols = sorted(
self._uncategorized_symbols, key=lambda x: x[2], reverse=True
)
lines = ["Uncategorized Symbols Analysis", "=" * 80]
lines.append(f"Total uncategorized symbols: {len(sorted_symbols)}")
lines.append(
f"Total uncategorized size: {sum(s[2] for s in sorted_symbols):,} bytes"
)
lines.append("")
lines.append(f"{'Size':>10} | {'Symbol':<60} | Demangled")
lines.append("-" * 10 + "-+-" + "-" * 60 + "-+-" + "-" * 40)
for symbol, demangled, size in sorted_symbols[:100]: # Top 100
demangled_display = (
demangled[:100] if symbol != demangled else "[not demangled]"
)
lines.append(f"{size:>10,} | {symbol[:60]:<60} | {demangled_display}")
if len(sorted_symbols) > 100:
lines.append(f"\n... and {len(sorted_symbols) - 100} more symbols")
content = "\n".join(lines)
if output_file:
with open(output_file, "w", encoding="utf-8") as f:
f.write(content)
else:
print(content)
def analyze_elf(
elf_path: str,
objdump_path: str | None = None,
readelf_path: str | None = None,
detailed: bool = False,
external_components: set[str] | None = None,
) -> str:
"""Analyze an ELF file and return a memory report."""
analyzer = MemoryAnalyzerCLI(
elf_path, objdump_path, readelf_path, external_components
)
analyzer.analyze()
return analyzer.generate_report(detailed)
def main():
"""CLI entrypoint for memory analysis."""
if len(sys.argv) < 2:
print("Usage: python -m esphome.analyze_memory <build_directory>")
print("\nAnalyze memory usage from an ESPHome build directory.")
print("The build directory should contain firmware.elf and idedata will be")
print("loaded from ~/.esphome/.internal/idedata/<device>.json")
print("\nExamples:")
print(" python -m esphome.analyze_memory ~/.esphome/build/my-device")
print(" python -m esphome.analyze_memory .esphome/build/my-device")
print(" python -m esphome.analyze_memory my-device # Short form")
sys.exit(1)
build_dir = sys.argv[1]
# Load build directory
import json
from pathlib import Path
from esphome.platformio_api import IDEData
build_path = Path(build_dir)
# If no path separator in name, assume it's a device name
if "/" not in build_dir and not build_path.is_dir():
# Try current directory first
cwd_path = Path.cwd() / ".esphome" / "build" / build_dir
if cwd_path.is_dir():
build_path = cwd_path
print(f"Using build directory: {build_path}", file=sys.stderr)
else:
# Fall back to home directory
build_path = Path.home() / ".esphome" / "build" / build_dir
print(f"Using build directory: {build_path}", file=sys.stderr)
if not build_path.is_dir():
print(f"Error: {build_path} is not a directory", file=sys.stderr)
sys.exit(1)
# Find firmware.elf
elf_file = None
for elf_candidate in [
build_path / "firmware.elf",
build_path / ".pioenvs" / build_path.name / "firmware.elf",
]:
if elf_candidate.exists():
elf_file = str(elf_candidate)
break
if not elf_file:
print(f"Error: firmware.elf not found in {build_dir}", file=sys.stderr)
sys.exit(1)
# Find idedata.json - check current directory first, then home
device_name = build_path.name
idedata_candidates = [
Path.cwd() / ".esphome" / "idedata" / f"{device_name}.json",
Path.home() / ".esphome" / "idedata" / f"{device_name}.json",
]
idedata = None
for idedata_path in idedata_candidates:
if not idedata_path.exists():
continue
try:
with open(idedata_path, encoding="utf-8") as f:
raw_data = json.load(f)
idedata = IDEData(raw_data)
print(f"Loaded idedata from: {idedata_path}", file=sys.stderr)
break
except (json.JSONDecodeError, OSError) as e:
print(f"Warning: Failed to load idedata: {e}", file=sys.stderr)
if not idedata:
print(
f"Warning: idedata not found (searched {idedata_candidates[0]} and {idedata_candidates[1]})",
file=sys.stderr,
)
analyzer = MemoryAnalyzerCLI(elf_file, idedata=idedata)
analyzer.analyze()
report = analyzer.generate_report()
print(report)
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,121 @@
"""Helper functions for memory analysis."""
from functools import cache
from pathlib import Path
from .const import SECTION_MAPPING
# Import namespace constant from parent module
# Note: This would create a circular import if done at module level,
# so we'll define it locally here as well
_NAMESPACE_ESPHOME = "esphome::"
# Get the list of actual ESPHome components by scanning the components directory
@cache
def get_esphome_components():
"""Get set of actual ESPHome components from the components directory."""
# Find the components directory relative to this file
# Go up two levels from analyze_memory/helpers.py to esphome/
current_dir = Path(__file__).parent.parent
components_dir = current_dir / "components"
if not components_dir.exists() or not components_dir.is_dir():
return frozenset()
return frozenset(
item.name
for item in components_dir.iterdir()
if item.is_dir()
and not item.name.startswith(".")
and not item.name.startswith("__")
)
@cache
def get_component_class_patterns(component_name: str) -> list[str]:
"""Generate component class name patterns for symbol matching.
Args:
component_name: The component name (e.g., "ota", "wifi", "api")
Returns:
List of pattern strings to match against demangled symbols
"""
component_upper = component_name.upper()
component_camel = component_name.replace("_", "").title()
return [
f"{_NAMESPACE_ESPHOME}{component_upper}Component", # e.g., esphome::OTAComponent
f"{_NAMESPACE_ESPHOME}ESPHome{component_upper}Component", # e.g., esphome::ESPHomeOTAComponent
f"{_NAMESPACE_ESPHOME}{component_camel}Component", # e.g., esphome::OtaComponent
f"{_NAMESPACE_ESPHOME}ESPHome{component_camel}Component", # e.g., esphome::ESPHomeOtaComponent
]
def map_section_name(raw_section: str) -> str | None:
"""Map raw section name to standard section.
Args:
raw_section: Raw section name from ELF file (e.g., ".iram0.text", ".rodata.str1.1")
Returns:
Standard section name (".text", ".rodata", ".data", ".bss") or None
"""
for standard_section, patterns in SECTION_MAPPING.items():
if any(pattern in raw_section for pattern in patterns):
return standard_section
return None
def parse_symbol_line(line: str) -> tuple[str, str, int, str] | None:
"""Parse a single symbol line from objdump output.
Args:
line: Line from objdump -t output
Returns:
Tuple of (section, name, size, address) or None if not a valid symbol.
Format: address l/g w/d F/O section size name
Example: 40084870 l F .iram0.text 00000000 _xt_user_exc
"""
parts = line.split()
if len(parts) < 5:
return None
try:
# Validate and extract address
address = parts[0]
int(address, 16)
except ValueError:
return None
# Look for F (function) or O (object) flag
if "F" not in parts and "O" not in parts:
return None
# Find section, size, and name
for i, part in enumerate(parts):
if not part.startswith("."):
continue
section = map_section_name(part)
if not section:
break
# Need at least size field after section
if i + 1 >= len(parts):
break
try:
size = int(parts[i + 1], 16)
except ValueError:
break
# Need symbol name and non-zero size
if i + 2 >= len(parts) or size == 0:
break
name = " ".join(parts[i + 2 :])
return (section, name, size, address)
return None

View File

@@ -15,8 +15,13 @@ from esphome.const import (
CONF_TYPE_ID,
CONF_UPDATE_INTERVAL,
)
from esphome.core import ID
from esphome.cpp_generator import MockObj, MockObjClass, TemplateArgsType
from esphome.core import ID, Lambda
from esphome.cpp_generator import (
LambdaExpression,
MockObj,
MockObjClass,
TemplateArgsType,
)
from esphome.schema_extractors import SCHEMA_EXTRACT, schema_extractor
from esphome.types import ConfigType
from esphome.util import Registry
@@ -87,6 +92,7 @@ def validate_potentially_or_condition(value):
DelayAction = cg.esphome_ns.class_("DelayAction", Action, cg.Component)
LambdaAction = cg.esphome_ns.class_("LambdaAction", Action)
StatelessLambdaAction = cg.esphome_ns.class_("StatelessLambdaAction", Action)
IfAction = cg.esphome_ns.class_("IfAction", Action)
WhileAction = cg.esphome_ns.class_("WhileAction", Action)
RepeatAction = cg.esphome_ns.class_("RepeatAction", Action)
@@ -97,9 +103,40 @@ ResumeComponentAction = cg.esphome_ns.class_("ResumeComponentAction", Action)
Automation = cg.esphome_ns.class_("Automation")
LambdaCondition = cg.esphome_ns.class_("LambdaCondition", Condition)
StatelessLambdaCondition = cg.esphome_ns.class_("StatelessLambdaCondition", Condition)
ForCondition = cg.esphome_ns.class_("ForCondition", Condition, cg.Component)
def new_lambda_pvariable(
id_obj: ID,
lambda_expr: LambdaExpression,
stateless_class: MockObjClass,
template_arg: cg.TemplateArguments | None = None,
) -> MockObj:
"""Create Pvariable for lambda, using stateless class if applicable.
Combines ID selection and Pvariable creation in one call. For stateless
lambdas (empty capture), uses function pointer instead of std::function.
Args:
id_obj: The ID object (action_id, condition_id, or filter_id)
lambda_expr: The lambda expression object
stateless_class: The stateless class to use for stateless lambdas
template_arg: Optional template arguments (for actions/conditions)
Returns:
The created Pvariable
"""
# For stateless lambdas, use function pointer instead of std::function
if lambda_expr.capture == "":
id_obj = id_obj.copy()
id_obj.type = stateless_class
if template_arg is not None:
return cg.new_Pvariable(id_obj, template_arg, lambda_expr)
return cg.new_Pvariable(id_obj, lambda_expr)
def validate_automation(extra_schema=None, extra_validators=None, single=False):
if extra_schema is None:
extra_schema = {}
@@ -145,7 +182,7 @@ def validate_automation(extra_schema=None, extra_validators=None, single=False):
value = cv.Schema([extra_validators])(value)
if single:
if len(value) != 1:
raise cv.Invalid("Cannot have more than 1 automation for templates")
raise cv.Invalid("This trigger allows only a single automation")
return value[0]
return value
@@ -240,7 +277,9 @@ async def lambda_condition_to_code(
args: TemplateArgsType,
) -> MockObj:
lambda_ = await cg.process_lambda(config, args, return_type=bool)
return cg.new_Pvariable(condition_id, template_arg, lambda_)
return new_lambda_pvariable(
condition_id, lambda_, StatelessLambdaCondition, template_arg
)
@register_condition(
@@ -271,6 +310,30 @@ async def for_condition_to_code(
return var
@register_condition(
"component.is_idle",
LambdaCondition,
maybe_simple_id(
{
cv.Required(CONF_ID): cv.use_id(cg.Component),
}
),
)
async def component_is_idle_condition_to_code(
config: ConfigType,
condition_id: ID,
template_arg: cg.TemplateArguments,
args: TemplateArgsType,
) -> MockObj:
comp = await cg.get_variable(config[CONF_ID])
lambda_ = await cg.process_lambda(
Lambda(f"return {comp}->is_idle();"), args, return_type=bool
)
return new_lambda_pvariable(
condition_id, lambda_, StatelessLambdaCondition, template_arg
)
@register_action(
"delay", DelayAction, cv.templatable(cv.positive_time_period_milliseconds)
)
@@ -406,7 +469,7 @@ async def lambda_action_to_code(
args: TemplateArgsType,
) -> MockObj:
lambda_ = await cg.process_lambda(config, args, return_type=cg.void)
return cg.new_Pvariable(action_id, template_arg, lambda_)
return new_lambda_pvariable(action_id, lambda_, StatelessLambdaAction, template_arg)
@register_action(

View File

@@ -62,6 +62,7 @@ from esphome.cpp_types import ( # noqa: F401
EntityBase,
EntityCategory,
ESPTime,
FixedVector,
GPIOPin,
InternalGPIOPin,
JsonObject,

View File

@@ -9,7 +9,7 @@ static const char *const TAG = "adalight_light_effect";
static const uint32_t ADALIGHT_ACK_INTERVAL = 1000;
static const uint32_t ADALIGHT_RECEIVE_TIMEOUT = 1000;
AdalightLightEffect::AdalightLightEffect(const std::string &name) : AddressableLightEffect(name) {}
AdalightLightEffect::AdalightLightEffect(const char *name) : AddressableLightEffect(name) {}
void AdalightLightEffect::start() {
AddressableLightEffect::start();

View File

@@ -11,7 +11,7 @@ namespace adalight {
class AdalightLightEffect : public light::AddressableLightEffect, public uart::UARTDevice {
public:
AdalightLightEffect(const std::string &name);
AdalightLightEffect(const char *name);
void start() override;
void stop() override;

View File

@@ -172,12 +172,6 @@ def alarm_control_panel_schema(
return _ALARM_CONTROL_PANEL_SCHEMA.extend(schema)
# Remove before 2025.11.0
ALARM_CONTROL_PANEL_SCHEMA = alarm_control_panel_schema(AlarmControlPanel)
ALARM_CONTROL_PANEL_SCHEMA.add_extra(
cv.deprecated_schema_constant("alarm_control_panel")
)
ALARM_CONTROL_PANEL_ACTION_SCHEMA = maybe_simple_id(
{
cv.GenerateID(): cv.use_id(AlarmControlPanel),

View File

@@ -26,12 +26,12 @@ uint32_t Animation::get_animation_frame_count() const { return this->animation_f
int Animation::get_current_frame() const { return this->current_frame_; }
void Animation::next_frame() {
this->current_frame_++;
if (loop_count_ && this->current_frame_ == loop_end_frame_ &&
if (loop_count_ && static_cast<uint32_t>(this->current_frame_) == loop_end_frame_ &&
(this->loop_current_iteration_ < loop_count_ || loop_count_ < 0)) {
this->current_frame_ = loop_start_frame_;
this->loop_current_iteration_++;
}
if (this->current_frame_ >= animation_frame_count_) {
if (static_cast<uint32_t>(this->current_frame_) >= animation_frame_count_) {
this->loop_current_iteration_ = 1;
this->current_frame_ = 0;
}

View File

@@ -28,7 +28,7 @@ class Anova : public climate::Climate, public esphome::ble_client::BLEClientNode
void dump_config() override;
climate::ClimateTraits traits() override {
auto traits = climate::ClimateTraits();
traits.set_supports_current_temperature(true);
traits.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
traits.set_supported_modes({climate::CLIMATE_MODE_OFF, climate::ClimateMode::CLIMATE_MODE_HEAT});
traits.set_visual_min_temperature(25.0);
traits.set_visual_max_temperature(100.0);

View File

@@ -9,37 +9,59 @@ import esphome.config_validation as cv
from esphome.const import (
CONF_ACTION,
CONF_ACTIONS,
CONF_CAPTURE_RESPONSE,
CONF_DATA,
CONF_DATA_TEMPLATE,
CONF_EVENT,
CONF_ID,
CONF_KEY,
CONF_MAX_CONNECTIONS,
CONF_ON_CLIENT_CONNECTED,
CONF_ON_CLIENT_DISCONNECTED,
CONF_ON_ERROR,
CONF_ON_SUCCESS,
CONF_PASSWORD,
CONF_PORT,
CONF_REBOOT_TIMEOUT,
CONF_RESPONSE_TEMPLATE,
CONF_SERVICE,
CONF_SERVICES,
CONF_TAG,
CONF_TRIGGER_ID,
CONF_VARIABLES,
)
from esphome.core import CORE, CoroPriority, coroutine_with_priority
from esphome.core import CORE, ID, CoroPriority, coroutine_with_priority
from esphome.cpp_generator import TemplateArgsType
from esphome.types import ConfigType
_LOGGER = logging.getLogger(__name__)
DOMAIN = "api"
DEPENDENCIES = ["network"]
AUTO_LOAD = ["socket"]
CODEOWNERS = ["@esphome/core"]
def AUTO_LOAD(config: ConfigType) -> list[str]:
"""Conditionally auto-load json only when capture_response is used."""
base = ["socket"]
# Check if any homeassistant.action/homeassistant.service has capture_response: true
# This flag is set during config validation in _validate_response_config
if not config or CORE.data.get(DOMAIN, {}).get(CONF_CAPTURE_RESPONSE, False):
return base + ["json"]
return base
api_ns = cg.esphome_ns.namespace("api")
APIServer = api_ns.class_("APIServer", cg.Component, cg.Controller)
HomeAssistantServiceCallAction = api_ns.class_(
"HomeAssistantServiceCallAction", automation.Action
)
ActionResponse = api_ns.class_("ActionResponse")
HomeAssistantActionResponseTrigger = api_ns.class_(
"HomeAssistantActionResponseTrigger", automation.Trigger
)
APIConnectedCondition = api_ns.class_("APIConnectedCondition", Condition)
UserServiceTrigger = api_ns.class_("UserServiceTrigger", automation.Trigger)
@@ -49,10 +71,12 @@ SERVICE_ARG_NATIVE_TYPES = {
"int": cg.int32,
"float": float,
"string": cg.std_string,
"bool[]": cg.std_vector.template(bool),
"int[]": cg.std_vector.template(cg.int32),
"float[]": cg.std_vector.template(float),
"string[]": cg.std_vector.template(cg.std_string),
"bool[]": cg.FixedVector.template(bool).operator("const").operator("ref"),
"int[]": cg.FixedVector.template(cg.int32).operator("const").operator("ref"),
"float[]": cg.FixedVector.template(float).operator("const").operator("ref"),
"string[]": cg.FixedVector.template(cg.std_string)
.operator("const")
.operator("ref"),
}
CONF_ENCRYPTION = "encryption"
CONF_BATCH_DELAY = "batch_delay"
@@ -60,7 +84,6 @@ CONF_CUSTOM_SERVICES = "custom_services"
CONF_HOMEASSISTANT_SERVICES = "homeassistant_services"
CONF_HOMEASSISTANT_STATES = "homeassistant_states"
CONF_LISTEN_BACKLOG = "listen_backlog"
CONF_MAX_CONNECTIONS = "max_connections"
CONF_MAX_SEND_QUEUE = "max_send_queue"
@@ -134,6 +157,17 @@ def _validate_api_config(config: ConfigType) -> ConfigType:
return config
def _consume_api_sockets(config: ConfigType) -> ConfigType:
"""Register socket needs for API component."""
from esphome.components import socket
# API needs 1 listening socket + typically 3 concurrent client connections
# (not max_connections, which is the upper limit rarely reached)
sockets_needed = 1 + 3
socket.consume_sockets(sockets_needed, "api")(config)
return config
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
@@ -201,6 +235,7 @@ CONFIG_SCHEMA = cv.All(
).extend(cv.COMPONENT_SCHEMA),
cv.rename_key(CONF_SERVICES, CONF_ACTIONS),
_validate_api_config,
_consume_api_sockets,
)
@@ -225,6 +260,10 @@ async def to_code(config):
if config.get(CONF_ACTIONS) or config[CONF_CUSTOM_SERVICES]:
cg.add_define("USE_API_SERVICES")
# Set USE_API_CUSTOM_SERVICES if external components need dynamic service registration
if config[CONF_CUSTOM_SERVICES]:
cg.add_define("USE_API_CUSTOM_SERVICES")
if config[CONF_HOMEASSISTANT_SERVICES]:
cg.add_define("USE_API_HOMEASSISTANT_SERVICES")
@@ -232,6 +271,8 @@ async def to_code(config):
cg.add_define("USE_API_HOMEASSISTANT_STATES")
if actions := config.get(CONF_ACTIONS, []):
# Collect all triggers first, then register all at once with initializer_list
triggers: list[cg.Pvariable] = []
for conf in actions:
template_args = []
func_args = []
@@ -245,8 +286,10 @@ async def to_code(config):
trigger = cg.new_Pvariable(
conf[CONF_TRIGGER_ID], templ, conf[CONF_ACTION], service_arg_names
)
cg.add(var.register_user_service(trigger))
triggers.append(trigger)
await automation.build_automation(trigger, func_args, conf)
# Register all services at once - single allocation, no reallocations
cg.add(var.initialize_user_services(triggers))
if CONF_ON_CLIENT_CONNECTED in config:
cg.add_define("USE_API_CLIENT_CONNECTED_TRIGGER")
@@ -288,6 +331,29 @@ async def to_code(config):
KEY_VALUE_SCHEMA = cv.Schema({cv.string: cv.templatable(cv.string_strict)})
def _validate_response_config(config: ConfigType) -> ConfigType:
# Validate dependencies:
# - response_template requires capture_response: true
# - capture_response: true requires on_success
if CONF_RESPONSE_TEMPLATE in config and not config[CONF_CAPTURE_RESPONSE]:
raise cv.Invalid(
f"`{CONF_RESPONSE_TEMPLATE}` requires `{CONF_CAPTURE_RESPONSE}: true` to be set.",
path=[CONF_RESPONSE_TEMPLATE],
)
if config[CONF_CAPTURE_RESPONSE] and CONF_ON_SUCCESS not in config:
raise cv.Invalid(
f"`{CONF_CAPTURE_RESPONSE}: true` requires `{CONF_ON_SUCCESS}` to be set.",
path=[CONF_CAPTURE_RESPONSE],
)
# Track if any action uses capture_response for AUTO_LOAD
if config[CONF_CAPTURE_RESPONSE]:
CORE.data.setdefault(DOMAIN, {})[CONF_CAPTURE_RESPONSE] = True
return config
HOMEASSISTANT_ACTION_ACTION_SCHEMA = cv.All(
cv.Schema(
{
@@ -303,10 +369,15 @@ HOMEASSISTANT_ACTION_ACTION_SCHEMA = cv.All(
cv.Optional(CONF_VARIABLES, default={}): cv.Schema(
{cv.string: cv.returning_lambda}
),
cv.Optional(CONF_RESPONSE_TEMPLATE): cv.templatable(cv.string),
cv.Optional(CONF_CAPTURE_RESPONSE, default=False): cv.boolean,
cv.Optional(CONF_ON_SUCCESS): automation.validate_automation(single=True),
cv.Optional(CONF_ON_ERROR): automation.validate_automation(single=True),
}
),
cv.has_exactly_one_key(CONF_SERVICE, CONF_ACTION),
cv.rename_key(CONF_SERVICE, CONF_ACTION),
_validate_response_config,
)
@@ -320,21 +391,67 @@ HOMEASSISTANT_ACTION_ACTION_SCHEMA = cv.All(
HomeAssistantServiceCallAction,
HOMEASSISTANT_ACTION_ACTION_SCHEMA,
)
async def homeassistant_service_to_code(config, action_id, template_arg, args):
async def homeassistant_service_to_code(
config: ConfigType,
action_id: ID,
template_arg: cg.TemplateArguments,
args: TemplateArgsType,
):
cg.add_define("USE_API_HOMEASSISTANT_SERVICES")
serv = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, serv, False)
templ = await cg.templatable(config[CONF_ACTION], args, None)
cg.add(var.set_service(templ))
# Initialize FixedVectors with exact sizes from config
cg.add(var.init_data(len(config[CONF_DATA])))
for key, value in config[CONF_DATA].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_data(key, templ))
cg.add(var.init_data_template(len(config[CONF_DATA_TEMPLATE])))
for key, value in config[CONF_DATA_TEMPLATE].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_data_template(key, templ))
cg.add(var.init_variables(len(config[CONF_VARIABLES])))
for key, value in config[CONF_VARIABLES].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_variable(key, templ))
if on_error := config.get(CONF_ON_ERROR):
cg.add_define("USE_API_HOMEASSISTANT_ACTION_RESPONSES")
cg.add_define("USE_API_HOMEASSISTANT_ACTION_RESPONSES_ERRORS")
cg.add(var.set_wants_status())
await automation.build_automation(
var.get_error_trigger(),
[(cg.std_string, "error"), *args],
on_error,
)
if on_success := config.get(CONF_ON_SUCCESS):
cg.add_define("USE_API_HOMEASSISTANT_ACTION_RESPONSES")
cg.add(var.set_wants_status())
if config[CONF_CAPTURE_RESPONSE]:
cg.add(var.set_wants_response())
cg.add_define("USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON")
await automation.build_automation(
var.get_success_trigger_with_response(),
[(cg.JsonObjectConst, "response"), *args],
on_success,
)
if response_template := config.get(CONF_RESPONSE_TEMPLATE):
templ = await cg.templatable(response_template, args, cg.std_string)
cg.add(var.set_response_template(templ))
else:
await automation.build_automation(
var.get_success_trigger(),
args,
on_success,
)
return var
@@ -370,15 +487,23 @@ async def homeassistant_event_to_code(config, action_id, template_arg, args):
var = cg.new_Pvariable(action_id, template_arg, serv, True)
templ = await cg.templatable(config[CONF_EVENT], args, None)
cg.add(var.set_service(templ))
# Initialize FixedVectors with exact sizes from config
cg.add(var.init_data(len(config[CONF_DATA])))
for key, value in config[CONF_DATA].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_data(key, templ))
cg.add(var.init_data_template(len(config[CONF_DATA_TEMPLATE])))
for key, value in config[CONF_DATA_TEMPLATE].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_data_template(key, templ))
cg.add(var.init_variables(len(config[CONF_VARIABLES])))
for key, value in config[CONF_VARIABLES].items():
templ = await cg.templatable(value, args, None)
cg.add(var.add_variable(key, templ))
return var
@@ -401,6 +526,8 @@ async def homeassistant_tag_scanned_to_code(config, action_id, template_arg, arg
serv = await cg.get_variable(config[CONF_ID])
var = cg.new_Pvariable(action_id, template_arg, serv, True)
cg.add(var.set_service("esphome.tag_scanned"))
# Initialize FixedVector with exact size (1 data field)
cg.add(var.init_data(1))
templ = await cg.templatable(config[CONF_TAG], args, cg.std_string)
cg.add(var.add_data("tag_id", templ))
return var

View File

@@ -425,7 +425,7 @@ message ListEntitiesFanResponse {
bool disabled_by_default = 9;
string icon = 10 [(field_ifdef) = "USE_ENTITY_ICON"];
EntityCategory entity_category = 11;
repeated string supported_preset_modes = 12 [(container_pointer) = "std::set"];
repeated string supported_preset_modes = 12 [(container_pointer_no_template) = "std::vector<const char *>"];
uint32 device_id = 13 [(field_ifdef) = "USE_DEVICES"];
}
// Deprecated in API version 1.6 - only used in deprecated fields
@@ -506,7 +506,7 @@ message ListEntitiesLightResponse {
string name = 3;
reserved 4; // Deprecated: was string unique_id
repeated ColorMode supported_color_modes = 12 [(container_pointer) = "std::set<light::ColorMode>"];
repeated ColorMode supported_color_modes = 12 [(container_pointer_no_template) = "light::ColorModeMask"];
// next four supports_* are for legacy clients, newer clients should use color modes
// Deprecated in API version 1.6
bool legacy_supports_brightness = 5 [deprecated=true];
@@ -776,10 +776,26 @@ message HomeassistantActionRequest {
option (ifdef) = "USE_API_HOMEASSISTANT_SERVICES";
string service = 1;
repeated HomeassistantServiceMap data = 2;
repeated HomeassistantServiceMap data_template = 3;
repeated HomeassistantServiceMap variables = 4;
repeated HomeassistantServiceMap data = 2 [(fixed_vector) = true];
repeated HomeassistantServiceMap data_template = 3 [(fixed_vector) = true];
repeated HomeassistantServiceMap variables = 4 [(fixed_vector) = true];
bool is_event = 5;
uint32 call_id = 6 [(field_ifdef) = "USE_API_HOMEASSISTANT_ACTION_RESPONSES"];
bool wants_response = 7 [(field_ifdef) = "USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON"];
string response_template = 8 [(no_zero_copy) = true, (field_ifdef) = "USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON"];
}
// Message sent by Home Assistant to ESPHome with service call response data
message HomeassistantActionResponse {
option (id) = 130;
option (source) = SOURCE_CLIENT;
option (no_delay) = true;
option (ifdef) = "USE_API_HOMEASSISTANT_ACTION_RESPONSES";
uint32 call_id = 1; // Matches the call_id from HomeassistantActionRequest
bool success = 2; // Whether the service call succeeded
string error_message = 3; // Error message if success = false
bytes response_data = 4 [(pointer_to_buffer) = true, (field_ifdef) = "USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON"];
}
// ==================== IMPORT HOME ASSISTANT STATES ====================
@@ -850,7 +866,7 @@ message ListEntitiesServicesResponse {
string name = 1;
fixed32 key = 2;
repeated ListEntitiesServicesArgument args = 3;
repeated ListEntitiesServicesArgument args = 3 [(fixed_vector) = true];
}
message ExecuteServiceArgument {
option (ifdef) = "USE_API_SERVICES";
@@ -860,10 +876,10 @@ message ExecuteServiceArgument {
string string_ = 4;
// ESPHome 1.14 (api v1.3) make int a signed value
sint32 int_ = 5;
repeated bool bool_array = 6 [packed=false];
repeated sint32 int_array = 7 [packed=false];
repeated float float_array = 8 [packed=false];
repeated string string_array = 9;
repeated bool bool_array = 6 [packed=false, (fixed_vector) = true];
repeated sint32 int_array = 7 [packed=false, (fixed_vector) = true];
repeated float float_array = 8 [packed=false, (fixed_vector) = true];
repeated string string_array = 9 [(fixed_vector) = true];
}
message ExecuteServiceRequest {
option (id) = 42;
@@ -872,7 +888,7 @@ message ExecuteServiceRequest {
option (ifdef) = "USE_API_SERVICES";
fixed32 key = 1;
repeated ExecuteServiceArgument args = 2;
repeated ExecuteServiceArgument args = 2 [(fixed_vector) = true];
}
// ==================== CAMERA ====================
@@ -971,9 +987,9 @@ message ListEntitiesClimateResponse {
string name = 3;
reserved 4; // Deprecated: was string unique_id
bool supports_current_temperature = 5;
bool supports_two_point_target_temperature = 6;
repeated ClimateMode supported_modes = 7 [(container_pointer) = "std::set<climate::ClimateMode>"];
bool supports_current_temperature = 5; // Deprecated: use feature_flags
bool supports_two_point_target_temperature = 6; // Deprecated: use feature_flags
repeated ClimateMode supported_modes = 7 [(container_pointer_no_template) = "climate::ClimateModeMask"];
float visual_min_temperature = 8;
float visual_max_temperature = 9;
float visual_target_temperature_step = 10;
@@ -981,21 +997,22 @@ message ListEntitiesClimateResponse {
// is if CLIMATE_PRESET_AWAY exists is supported_presets
// Deprecated in API version 1.5
bool legacy_supports_away = 11 [deprecated=true];
bool supports_action = 12;
repeated ClimateFanMode supported_fan_modes = 13 [(container_pointer) = "std::set<climate::ClimateFanMode>"];
repeated ClimateSwingMode supported_swing_modes = 14 [(container_pointer) = "std::set<climate::ClimateSwingMode>"];
repeated string supported_custom_fan_modes = 15 [(container_pointer) = "std::set"];
repeated ClimatePreset supported_presets = 16 [(container_pointer) = "std::set<climate::ClimatePreset>"];
repeated string supported_custom_presets = 17 [(container_pointer) = "std::set"];
bool supports_action = 12; // Deprecated: use feature_flags
repeated ClimateFanMode supported_fan_modes = 13 [(container_pointer_no_template) = "climate::ClimateFanModeMask"];
repeated ClimateSwingMode supported_swing_modes = 14 [(container_pointer_no_template) = "climate::ClimateSwingModeMask"];
repeated string supported_custom_fan_modes = 15 [(container_pointer_no_template) = "std::vector<const char *>"];
repeated ClimatePreset supported_presets = 16 [(container_pointer_no_template) = "climate::ClimatePresetMask"];
repeated string supported_custom_presets = 17 [(container_pointer_no_template) = "std::vector<const char *>"];
bool disabled_by_default = 18;
string icon = 19 [(field_ifdef) = "USE_ENTITY_ICON"];
EntityCategory entity_category = 20;
float visual_current_temperature_step = 21;
bool supports_current_humidity = 22;
bool supports_target_humidity = 23;
bool supports_current_humidity = 22; // Deprecated: use feature_flags
bool supports_target_humidity = 23; // Deprecated: use feature_flags
float visual_min_humidity = 24;
float visual_max_humidity = 25;
uint32 device_id = 26 [(field_ifdef) = "USE_DEVICES"];
uint32 feature_flags = 27;
}
message ClimateStateResponse {
option (id) = 47;
@@ -1126,7 +1143,7 @@ message ListEntitiesSelectResponse {
reserved 4; // Deprecated: was string unique_id
string icon = 5 [(field_ifdef) = "USE_ENTITY_ICON"];
repeated string options = 6 [(container_pointer) = "std::vector"];
repeated string options = 6 [(container_pointer_no_template) = "FixedVector<const char *>"];
bool disabled_by_default = 7;
EntityCategory entity_category = 8;
uint32 device_id = 9 [(field_ifdef) = "USE_DEVICES"];
@@ -1503,7 +1520,7 @@ message BluetoothGATTCharacteristic {
repeated uint64 uuid = 1 [(fixed_array_size) = 2, (fixed_array_skip_zero) = true];
uint32 handle = 2;
uint32 properties = 3;
repeated BluetoothGATTDescriptor descriptors = 4;
repeated BluetoothGATTDescriptor descriptors = 4 [(fixed_vector) = true];
// New field for efficient UUID (v1.12+)
// Only one of uuid or short_uuid will be set.
@@ -1515,7 +1532,7 @@ message BluetoothGATTCharacteristic {
message BluetoothGATTService {
repeated uint64 uuid = 1 [(fixed_array_size) = 2, (fixed_array_skip_zero) = true];
uint32 handle = 2;
repeated BluetoothGATTCharacteristic characteristics = 3;
repeated BluetoothGATTCharacteristic characteristics = 3 [(fixed_vector) = true];
// New field for efficient UUID (v1.12+)
// Only one of uuid or short_uuid will be set.

View File

@@ -8,9 +8,9 @@
#endif
#include <cerrno>
#include <cinttypes>
#include <utility>
#include <functional>
#include <limits>
#include <utility>
#include "esphome/components/network/util.h"
#include "esphome/core/application.h"
#include "esphome/core/entity_base.h"
@@ -27,6 +27,9 @@
#ifdef USE_BLUETOOTH_PROXY
#include "esphome/components/bluetooth_proxy/bluetooth_proxy.h"
#endif
#ifdef USE_CLIMATE
#include "esphome/components/climate/climate_mode.h"
#endif
#ifdef USE_VOICE_ASSISTANT
#include "esphome/components/voice_assistant/voice_assistant.h"
#endif
@@ -116,8 +119,7 @@ void APIConnection::start() {
APIError err = this->helper_->init();
if (err != APIError::OK) {
on_fatal_error();
this->log_warning_(LOG_STR("Helper init failed"), err);
this->fatal_error_with_log_(LOG_STR("Helper init failed"), err);
return;
}
this->client_info_.peername = helper_->getpeername();
@@ -147,8 +149,7 @@ void APIConnection::loop() {
APIError err = this->helper_->loop();
if (err != APIError::OK) {
on_fatal_error();
this->log_socket_operation_failed_(err);
this->fatal_error_with_log_(LOG_STR("Socket operation failed"), err);
return;
}
@@ -163,17 +164,13 @@ void APIConnection::loop() {
// No more data available
break;
} else if (err != APIError::OK) {
on_fatal_error();
this->log_warning_(LOG_STR("Reading failed"), err);
this->fatal_error_with_log_(LOG_STR("Reading failed"), err);
return;
} else {
this->last_traffic_ = now;
// read a packet
if (buffer.data_len > 0) {
this->read_message(buffer.data_len, buffer.type, &buffer.container[buffer.data_offset]);
} else {
this->read_message(0, buffer.type, nullptr);
}
this->read_message(buffer.data_len, buffer.type,
buffer.data_len > 0 ? &buffer.container[buffer.data_offset] : nullptr);
if (this->flags_.remove)
return;
}
@@ -413,8 +410,8 @@ uint16_t APIConnection::try_send_fan_state(EntityBase *entity, APIConnection *co
}
if (traits.supports_direction())
msg.direction = static_cast<enums::FanDirection>(fan->direction);
if (traits.supports_preset_modes())
msg.set_preset_mode(StringRef(fan->preset_mode));
if (traits.supports_preset_modes() && fan->has_preset_mode())
msg.set_preset_mode(StringRef(fan->get_preset_mode()));
return fill_and_encode_entity_state(fan, msg, FanStateResponse::MESSAGE_TYPE, conn, remaining_size, is_single);
}
uint16_t APIConnection::try_send_fan_info(EntityBase *entity, APIConnection *conn, uint32_t remaining_size,
@@ -426,7 +423,7 @@ uint16_t APIConnection::try_send_fan_info(EntityBase *entity, APIConnection *con
msg.supports_speed = traits.supports_speed();
msg.supports_direction = traits.supports_direction();
msg.supported_speed_count = traits.supported_speed_count();
msg.supported_preset_modes = &traits.supported_preset_modes_for_api_();
msg.supported_preset_modes = &traits.supported_preset_modes();
return fill_and_encode_entity_info(fan, msg, ListEntitiesFanResponse::MESSAGE_TYPE, conn, remaining_size, is_single);
}
void APIConnection::fan_command(const FanCommandRequest &msg) {
@@ -456,7 +453,6 @@ uint16_t APIConnection::try_send_light_state(EntityBase *entity, APIConnection *
bool is_single) {
auto *light = static_cast<light::LightState *>(entity);
LightStateResponse resp;
auto traits = light->get_traits();
auto values = light->remote_values;
auto color_mode = values.get_color_mode();
resp.state = values.is_on();
@@ -480,7 +476,8 @@ uint16_t APIConnection::try_send_light_info(EntityBase *entity, APIConnection *c
auto *light = static_cast<light::LightState *>(entity);
ListEntitiesLightResponse msg;
auto traits = light->get_traits();
msg.supported_color_modes = &traits.get_supported_color_modes_for_api_();
// Pass pointer to ColorModeMask so the iterator can encode actual ColorMode enum values
msg.supported_color_modes = &traits.get_supported_color_modes();
if (traits.supports_color_capability(light::ColorCapability::COLOR_TEMPERATURE) ||
traits.supports_color_capability(light::ColorCapability::COLD_WARM_WHITE)) {
msg.min_mireds = traits.get_min_mireds();
@@ -489,7 +486,7 @@ uint16_t APIConnection::try_send_light_info(EntityBase *entity, APIConnection *c
if (light->supports_effects()) {
msg.effects.emplace_back("None");
for (auto *effect : light->get_effects()) {
msg.effects.push_back(effect->get_name());
msg.effects.emplace_back(effect->get_name());
}
}
return fill_and_encode_entity_info(light, msg, ListEntitiesLightResponse::MESSAGE_TYPE, conn, remaining_size,
@@ -629,9 +626,10 @@ uint16_t APIConnection::try_send_climate_state(EntityBase *entity, APIConnection
auto traits = climate->get_traits();
resp.mode = static_cast<enums::ClimateMode>(climate->mode);
resp.action = static_cast<enums::ClimateAction>(climate->action);
if (traits.get_supports_current_temperature())
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE))
resp.current_temperature = climate->current_temperature;
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
resp.target_temperature_low = climate->target_temperature_low;
resp.target_temperature_high = climate->target_temperature_high;
} else {
@@ -639,20 +637,20 @@ uint16_t APIConnection::try_send_climate_state(EntityBase *entity, APIConnection
}
if (traits.get_supports_fan_modes() && climate->fan_mode.has_value())
resp.fan_mode = static_cast<enums::ClimateFanMode>(climate->fan_mode.value());
if (!traits.get_supported_custom_fan_modes().empty() && climate->custom_fan_mode.has_value()) {
resp.set_custom_fan_mode(StringRef(climate->custom_fan_mode.value()));
if (!traits.get_supported_custom_fan_modes().empty() && climate->has_custom_fan_mode()) {
resp.set_custom_fan_mode(StringRef(climate->get_custom_fan_mode()));
}
if (traits.get_supports_presets() && climate->preset.has_value()) {
resp.preset = static_cast<enums::ClimatePreset>(climate->preset.value());
}
if (!traits.get_supported_custom_presets().empty() && climate->custom_preset.has_value()) {
resp.set_custom_preset(StringRef(climate->custom_preset.value()));
if (!traits.get_supported_custom_presets().empty() && climate->has_custom_preset()) {
resp.set_custom_preset(StringRef(climate->get_custom_preset()));
}
if (traits.get_supports_swing_modes())
resp.swing_mode = static_cast<enums::ClimateSwingMode>(climate->swing_mode);
if (traits.get_supports_current_humidity())
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY))
resp.current_humidity = climate->current_humidity;
if (traits.get_supports_target_humidity())
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY))
resp.target_humidity = climate->target_humidity;
return fill_and_encode_entity_state(climate, resp, ClimateStateResponse::MESSAGE_TYPE, conn, remaining_size,
is_single);
@@ -662,23 +660,27 @@ uint16_t APIConnection::try_send_climate_info(EntityBase *entity, APIConnection
auto *climate = static_cast<climate::Climate *>(entity);
ListEntitiesClimateResponse msg;
auto traits = climate->get_traits();
msg.supports_current_temperature = traits.get_supports_current_temperature();
msg.supports_current_humidity = traits.get_supports_current_humidity();
msg.supports_two_point_target_temperature = traits.get_supports_two_point_target_temperature();
msg.supports_target_humidity = traits.get_supports_target_humidity();
msg.supported_modes = &traits.get_supported_modes_for_api_();
// Flags set for backward compatibility, deprecated in 2025.11.0
msg.supports_current_temperature = traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
msg.supports_current_humidity = traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY);
msg.supports_two_point_target_temperature = traits.has_feature_flags(
climate::CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE | climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE);
msg.supports_target_humidity = traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY);
msg.supports_action = traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION);
// Current feature flags and other supported parameters
msg.feature_flags = traits.get_feature_flags();
msg.supported_modes = &traits.get_supported_modes();
msg.visual_min_temperature = traits.get_visual_min_temperature();
msg.visual_max_temperature = traits.get_visual_max_temperature();
msg.visual_target_temperature_step = traits.get_visual_target_temperature_step();
msg.visual_current_temperature_step = traits.get_visual_current_temperature_step();
msg.visual_min_humidity = traits.get_visual_min_humidity();
msg.visual_max_humidity = traits.get_visual_max_humidity();
msg.supports_action = traits.get_supports_action();
msg.supported_fan_modes = &traits.get_supported_fan_modes_for_api_();
msg.supported_custom_fan_modes = &traits.get_supported_custom_fan_modes_for_api_();
msg.supported_presets = &traits.get_supported_presets_for_api_();
msg.supported_custom_presets = &traits.get_supported_custom_presets_for_api_();
msg.supported_swing_modes = &traits.get_supported_swing_modes_for_api_();
msg.supported_fan_modes = &traits.get_supported_fan_modes();
msg.supported_custom_fan_modes = &traits.get_supported_custom_fan_modes();
msg.supported_presets = &traits.get_supported_presets();
msg.supported_custom_presets = &traits.get_supported_custom_presets();
msg.supported_swing_modes = &traits.get_supported_swing_modes();
return fill_and_encode_entity_info(climate, msg, ListEntitiesClimateResponse::MESSAGE_TYPE, conn, remaining_size,
is_single);
}
@@ -875,7 +877,7 @@ uint16_t APIConnection::try_send_select_state(EntityBase *entity, APIConnection
bool is_single) {
auto *select = static_cast<select::Select *>(entity);
SelectStateResponse resp;
resp.set_state(StringRef(select->state));
resp.set_state(StringRef(select->current_option()));
resp.missing_state = !select->has_state();
return fill_and_encode_entity_state(select, resp, SelectStateResponse::MESSAGE_TYPE, conn, remaining_size, is_single);
}
@@ -1080,13 +1082,8 @@ void APIConnection::on_get_time_response(const GetTimeResponse &value) {
homeassistant::global_homeassistant_time->set_epoch_time(value.epoch_seconds);
#ifdef USE_TIME_TIMEZONE
if (value.timezone_len > 0) {
const std::string &current_tz = homeassistant::global_homeassistant_time->get_timezone();
// Compare without allocating a string
if (current_tz.length() != value.timezone_len ||
memcmp(current_tz.c_str(), value.timezone, value.timezone_len) != 0) {
homeassistant::global_homeassistant_time->set_timezone(
std::string(reinterpret_cast<const char *>(value.timezone), value.timezone_len));
}
homeassistant::global_homeassistant_time->set_timezone(reinterpret_cast<const char *>(value.timezone),
value.timezone_len);
}
#endif
}
@@ -1395,6 +1392,11 @@ void APIConnection::complete_authentication_() {
this->send_time_request();
}
#endif
#ifdef USE_ZWAVE_PROXY
if (zwave_proxy::global_zwave_proxy != nullptr) {
zwave_proxy::global_zwave_proxy->api_connection_authenticated(this);
}
#endif
}
bool APIConnection::send_hello_response(const HelloRequest &msg) {
@@ -1407,7 +1409,7 @@ bool APIConnection::send_hello_response(const HelloRequest &msg) {
HelloResponse resp;
resp.api_version_major = 1;
resp.api_version_minor = 12;
resp.api_version_minor = 13;
// Send only the version string - the client only logs this for debugging and doesn't use it otherwise
resp.set_server_info(ESPHOME_VERSION_REF);
resp.set_name(StringRef(App.get_name()));
@@ -1550,13 +1552,33 @@ void APIConnection::execute_service(const ExecuteServiceRequest &msg) {
}
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
void APIConnection::on_homeassistant_action_response(const HomeassistantActionResponse &msg) {
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
if (msg.response_data_len > 0) {
this->parent_->handle_action_response(msg.call_id, msg.success, msg.error_message, msg.response_data,
msg.response_data_len);
} else
#endif
{
this->parent_->handle_action_response(msg.call_id, msg.success, msg.error_message);
}
};
#endif
#ifdef USE_API_NOISE
bool APIConnection::send_noise_encryption_set_key_response(const NoiseEncryptionSetKeyRequest &msg) {
NoiseEncryptionSetKeyResponse resp;
resp.success = false;
psk_t psk{};
if (base64_decode(msg.key, psk.data(), msg.key.size()) != psk.size()) {
if (msg.key.empty()) {
if (this->parent_->clear_noise_psk(true)) {
resp.success = true;
} else {
ESP_LOGW(TAG, "Failed to clear encryption key");
}
} else if (base64_decode(msg.key, psk.data(), msg.key.size()) != psk.size()) {
ESP_LOGW(TAG, "Invalid encryption key length");
} else if (!this->parent_->save_noise_psk(psk, true)) {
ESP_LOGW(TAG, "Failed to save encryption key");
@@ -1580,8 +1602,7 @@ bool APIConnection::try_to_clear_buffer(bool log_out_of_space) {
delay(0);
APIError err = this->helper_->loop();
if (err != APIError::OK) {
on_fatal_error();
this->log_socket_operation_failed_(err);
this->fatal_error_with_log_(LOG_STR("Socket operation failed"), err);
return false;
}
if (this->helper_->can_write_without_blocking())
@@ -1600,8 +1621,7 @@ bool APIConnection::send_buffer(ProtoWriteBuffer buffer, uint8_t message_type) {
if (err == APIError::WOULD_BLOCK)
return false;
if (err != APIError::OK) {
on_fatal_error();
this->log_warning_(LOG_STR("Packet write failed"), err);
this->fatal_error_with_log_(LOG_STR("Packet write failed"), err);
return false;
}
// Do not set last_traffic_ on send
@@ -1787,8 +1807,7 @@ void APIConnection::process_batch_() {
APIError err = this->helper_->write_protobuf_packets(ProtoWriteBuffer{&shared_buf},
std::span<const PacketInfo>(packet_info, packet_count));
if (err != APIError::OK && err != APIError::WOULD_BLOCK) {
on_fatal_error();
this->log_warning_(LOG_STR("Batch write failed"), err);
this->fatal_error_with_log_(LOG_STR("Batch write failed"), err);
}
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1871,9 +1890,5 @@ void APIConnection::log_warning_(const LogString *message, APIError err) {
LOG_STR_ARG(message), LOG_STR_ARG(api_error_to_logstr(err)), errno);
}
void APIConnection::log_socket_operation_failed_(APIError err) {
this->log_warning_(LOG_STR("Socket operation failed"), err);
}
} // namespace esphome::api
#endif

View File

@@ -129,7 +129,10 @@ class APIConnection final : public APIServerConnection {
return;
this->send_message(call, HomeassistantActionRequest::MESSAGE_TYPE);
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
void on_homeassistant_action_response(const HomeassistantActionResponse &msg) override;
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
#endif // USE_API_HOMEASSISTANT_SERVICES
#ifdef USE_BLUETOOTH_PROXY
void subscribe_bluetooth_le_advertisements(const SubscribeBluetoothLEAdvertisementsRequest &msg) override;
void unsubscribe_bluetooth_le_advertisements(const UnsubscribeBluetoothLEAdvertisementsRequest &msg) override;
@@ -732,8 +735,11 @@ class APIConnection final : public APIServerConnection {
// Helper function to log API errors with errno
void log_warning_(const LogString *message, APIError err);
// Specific helper for duplicated error message
void log_socket_operation_failed_(APIError err);
// Helper to handle fatal errors with logging
inline void fatal_error_with_log_(const LogString *message, APIError err) {
this->on_fatal_error();
this->log_warning_(message, err);
}
};
} // namespace esphome::api

View File

@@ -19,13 +19,14 @@ namespace esphome::api {
//#define HELPER_LOG_PACKETS
// Maximum message size limits to prevent OOM on constrained devices
// Voice Assistant is our largest user at 1024 bytes per audio chunk
// Using 2048 + 256 bytes overhead = 2304 bytes total to support voice and future needs
// ESP8266 has very limited RAM and cannot support voice assistant
// Handshake messages are limited to a small size for security
static constexpr uint16_t MAX_HANDSHAKE_SIZE = 128;
// Data message limits vary by platform based on available memory
#ifdef USE_ESP8266
static constexpr uint16_t MAX_MESSAGE_SIZE = 512; // Keep small for memory constrained ESP8266
static constexpr uint16_t MAX_MESSAGE_SIZE = 8192; // 8 KiB for ESP8266
#else
static constexpr uint16_t MAX_MESSAGE_SIZE = 2304; // Support voice (1024) + headroom for larger messages
static constexpr uint16_t MAX_MESSAGE_SIZE = 32768; // 32 KiB for ESP32 and other platforms
#endif
// Forward declaration

View File

@@ -132,26 +132,16 @@ APIError APINoiseFrameHelper::loop() {
return APIFrameHelper::loop();
}
/** Read a packet into the rx_buf_. If successful, stores frame data in the frame parameter
/** Read a packet into the rx_buf_.
*
* @param frame: The struct to hold the frame information in.
* msg_start: points to the start of the payload - this pointer is only valid until the next
* try_receive_raw_ call
*
* @return 0 if a full packet is in rx_buf_
* @return -1 if error, check errno.
* @return APIError::OK if a full packet is in rx_buf_
*
* errno EWOULDBLOCK: Packet could not be read without blocking. Try again later.
* errno ENOMEM: Not enough memory for reading packet.
* errno API_ERROR_BAD_INDICATOR: Bad indicator byte at start of frame.
* errno API_ERROR_HANDSHAKE_PACKET_LEN: Packet too big for this phase.
*/
APIError APINoiseFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
if (frame == nullptr) {
HELPER_LOG("Bad argument for try_read_frame_");
return APIError::BAD_ARG;
}
APIError APINoiseFrameHelper::try_read_frame_() {
// read header
if (rx_header_buf_len_ < 3) {
// no header information yet
@@ -178,23 +168,17 @@ APIError APINoiseFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
// read body
uint16_t msg_size = (((uint16_t) rx_header_buf_[1]) << 8) | rx_header_buf_[2];
if (state_ != State::DATA && msg_size > 128) {
// for handshake message only permit up to 128 bytes
// Check against size limits to prevent OOM: MAX_HANDSHAKE_SIZE for handshake, MAX_MESSAGE_SIZE for data
uint16_t limit = (state_ == State::DATA) ? MAX_MESSAGE_SIZE : MAX_HANDSHAKE_SIZE;
if (msg_size > limit) {
state_ = State::FAILED;
HELPER_LOG("Bad packet len for handshake: %d", msg_size);
return APIError::BAD_HANDSHAKE_PACKET_LEN;
HELPER_LOG("Bad packet: message size %u exceeds maximum %u", msg_size, limit);
return (state_ == State::DATA) ? APIError::BAD_DATA_PACKET : APIError::BAD_HANDSHAKE_PACKET_LEN;
}
// Check against maximum message size to prevent OOM
if (msg_size > MAX_MESSAGE_SIZE) {
state_ = State::FAILED;
HELPER_LOG("Bad packet: message size %u exceeds maximum %u", msg_size, MAX_MESSAGE_SIZE);
return APIError::BAD_DATA_PACKET;
}
// reserve space for body
if (rx_buf_.size() != msg_size) {
rx_buf_.resize(msg_size);
// Reserve space for body
if (this->rx_buf_.size() != msg_size) {
this->rx_buf_.resize(msg_size);
}
if (rx_buf_len_ < msg_size) {
@@ -212,12 +196,12 @@ APIError APINoiseFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
}
}
LOG_PACKET_RECEIVED(rx_buf_);
*frame = std::move(rx_buf_);
// consume msg
rx_buf_ = {};
rx_buf_len_ = 0;
rx_header_buf_len_ = 0;
LOG_PACKET_RECEIVED(this->rx_buf_);
// Clear state for next frame (rx_buf_ still contains data for caller)
this->rx_buf_len_ = 0;
this->rx_header_buf_len_ = 0;
return APIError::OK;
}
@@ -239,18 +223,17 @@ APIError APINoiseFrameHelper::state_action_() {
}
if (state_ == State::CLIENT_HELLO) {
// waiting for client hello
std::vector<uint8_t> frame;
aerr = try_read_frame_(&frame);
aerr = this->try_read_frame_();
if (aerr != APIError::OK) {
return handle_handshake_frame_error_(aerr);
}
// ignore contents, may be used in future for flags
// Resize for: existing prologue + 2 size bytes + frame data
size_t old_size = prologue_.size();
prologue_.resize(old_size + 2 + frame.size());
prologue_[old_size] = (uint8_t) (frame.size() >> 8);
prologue_[old_size + 1] = (uint8_t) frame.size();
std::memcpy(prologue_.data() + old_size + 2, frame.data(), frame.size());
size_t old_size = this->prologue_.size();
this->prologue_.resize(old_size + 2 + this->rx_buf_.size());
this->prologue_[old_size] = (uint8_t) (this->rx_buf_.size() >> 8);
this->prologue_[old_size + 1] = (uint8_t) this->rx_buf_.size();
std::memcpy(this->prologue_.data() + old_size + 2, this->rx_buf_.data(), this->rx_buf_.size());
state_ = State::SERVER_HELLO;
}
@@ -259,7 +242,6 @@ APIError APINoiseFrameHelper::state_action_() {
const std::string &name = App.get_name();
const std::string &mac = get_mac_address();
std::vector<uint8_t> msg;
// Calculate positions and sizes
size_t name_len = name.size() + 1; // including null terminator
size_t mac_len = mac.size() + 1; // including null terminator
@@ -267,17 +249,17 @@ APIError APINoiseFrameHelper::state_action_() {
size_t mac_offset = name_offset + name_len;
size_t total_size = 1 + name_len + mac_len;
msg.resize(total_size);
auto msg = std::make_unique<uint8_t[]>(total_size);
// chosen proto
msg[0] = 0x01;
// node name, terminated by null byte
std::memcpy(msg.data() + name_offset, name.c_str(), name_len);
std::memcpy(msg.get() + name_offset, name.c_str(), name_len);
// node mac, terminated by null byte
std::memcpy(msg.data() + mac_offset, mac.c_str(), mac_len);
std::memcpy(msg.get() + mac_offset, mac.c_str(), mac_len);
aerr = write_frame_(msg.data(), msg.size());
aerr = write_frame_(msg.get(), total_size);
if (aerr != APIError::OK)
return aerr;
@@ -292,24 +274,23 @@ APIError APINoiseFrameHelper::state_action_() {
int action = noise_handshakestate_get_action(handshake_);
if (action == NOISE_ACTION_READ_MESSAGE) {
// waiting for handshake msg
std::vector<uint8_t> frame;
aerr = try_read_frame_(&frame);
aerr = this->try_read_frame_();
if (aerr != APIError::OK) {
return handle_handshake_frame_error_(aerr);
}
if (frame.empty()) {
if (this->rx_buf_.empty()) {
send_explicit_handshake_reject_(LOG_STR("Empty handshake message"));
return APIError::BAD_HANDSHAKE_ERROR_BYTE;
} else if (frame[0] != 0x00) {
HELPER_LOG("Bad handshake error byte: %u", frame[0]);
} else if (this->rx_buf_[0] != 0x00) {
HELPER_LOG("Bad handshake error byte: %u", this->rx_buf_[0]);
send_explicit_handshake_reject_(LOG_STR("Bad handshake error byte"));
return APIError::BAD_HANDSHAKE_ERROR_BYTE;
}
NoiseBuffer mbuf;
noise_buffer_init(mbuf);
noise_buffer_set_input(mbuf, frame.data() + 1, frame.size() - 1);
noise_buffer_set_input(mbuf, this->rx_buf_.data() + 1, this->rx_buf_.size() - 1);
err = noise_handshakestate_read_message(handshake_, &mbuf, nullptr);
if (err != 0) {
// Special handling for MAC failure
@@ -357,64 +338,62 @@ void APINoiseFrameHelper::send_explicit_handshake_reject_(const LogString *reaso
#ifdef USE_STORE_LOG_STR_IN_FLASH
// On ESP8266 with flash strings, we need to use PROGMEM-aware functions
size_t reason_len = strlen_P(reinterpret_cast<PGM_P>(reason));
std::vector<uint8_t> data;
data.resize(reason_len + 1);
size_t data_size = reason_len + 1;
auto data = std::make_unique<uint8_t[]>(data_size);
data[0] = 0x01; // failure
// Copy error message from PROGMEM
if (reason_len > 0) {
memcpy_P(data.data() + 1, reinterpret_cast<PGM_P>(reason), reason_len);
memcpy_P(data.get() + 1, reinterpret_cast<PGM_P>(reason), reason_len);
}
#else
// Normal memory access
const char *reason_str = LOG_STR_ARG(reason);
size_t reason_len = strlen(reason_str);
std::vector<uint8_t> data;
data.resize(reason_len + 1);
size_t data_size = reason_len + 1;
auto data = std::make_unique<uint8_t[]>(data_size);
data[0] = 0x01; // failure
// Copy error message in bulk
if (reason_len > 0) {
std::memcpy(data.data() + 1, reason_str, reason_len);
std::memcpy(data.get() + 1, reason_str, reason_len);
}
#endif
// temporarily remove failed state
auto orig_state = state_;
state_ = State::EXPLICIT_REJECT;
write_frame_(data.data(), data.size());
write_frame_(data.get(), data_size);
state_ = orig_state;
}
APIError APINoiseFrameHelper::read_packet(ReadPacketBuffer *buffer) {
int err;
APIError aerr;
aerr = state_action_();
APIError aerr = this->state_action_();
if (aerr != APIError::OK) {
return aerr;
}
if (state_ != State::DATA) {
if (this->state_ != State::DATA) {
return APIError::WOULD_BLOCK;
}
std::vector<uint8_t> frame;
aerr = try_read_frame_(&frame);
aerr = this->try_read_frame_();
if (aerr != APIError::OK)
return aerr;
NoiseBuffer mbuf;
noise_buffer_init(mbuf);
noise_buffer_set_inout(mbuf, frame.data(), frame.size(), frame.size());
err = noise_cipherstate_decrypt(recv_cipher_, &mbuf);
noise_buffer_set_inout(mbuf, this->rx_buf_.data(), this->rx_buf_.size(), this->rx_buf_.size());
int err = noise_cipherstate_decrypt(this->recv_cipher_, &mbuf);
APIError decrypt_err =
handle_noise_error_(err, LOG_STR("noise_cipherstate_decrypt"), APIError::CIPHERSTATE_DECRYPT_FAILED);
if (decrypt_err != APIError::OK)
if (decrypt_err != APIError::OK) {
return decrypt_err;
}
uint16_t msg_size = mbuf.size;
uint8_t *msg_data = frame.data();
uint8_t *msg_data = this->rx_buf_.data();
if (msg_size < 4) {
state_ = State::FAILED;
this->state_ = State::FAILED;
HELPER_LOG("Bad data packet: size %d too short", msg_size);
return APIError::BAD_DATA_PACKET;
}
@@ -422,12 +401,12 @@ APIError APINoiseFrameHelper::read_packet(ReadPacketBuffer *buffer) {
uint16_t type = (((uint16_t) msg_data[0]) << 8) | msg_data[1];
uint16_t data_len = (((uint16_t) msg_data[2]) << 8) | msg_data[3];
if (data_len > msg_size - 4) {
state_ = State::FAILED;
this->state_ = State::FAILED;
HELPER_LOG("Bad data packet: data_len %u greater than msg_size %u", data_len, msg_size);
return APIError::BAD_DATA_PACKET;
}
buffer->container = std::move(frame);
buffer->container = std::move(this->rx_buf_);
buffer->data_offset = 4;
buffer->data_len = data_len;
buffer->type = type;
@@ -455,8 +434,7 @@ APIError APINoiseFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer, st
return APIError::OK;
}
std::vector<uint8_t> *raw_buffer = buffer.get_buffer();
uint8_t *buffer_data = raw_buffer->data(); // Cache buffer pointer
uint8_t *buffer_data = buffer.get_buffer()->data();
this->reusable_iovs_.clear();
this->reusable_iovs_.reserve(packets.size());

View File

@@ -28,7 +28,7 @@ class APINoiseFrameHelper final : public APIFrameHelper {
protected:
APIError state_action_();
APIError try_read_frame_(std::vector<uint8_t> *frame);
APIError try_read_frame_();
APIError write_frame_(const uint8_t *data, uint16_t len);
APIError init_handshake_();
APIError check_handshake_finished_();

View File

@@ -47,21 +47,13 @@ APIError APIPlaintextFrameHelper::loop() {
return APIFrameHelper::loop();
}
/** Read a packet into the rx_buf_. If successful, stores frame data in the frame parameter
*
* @param frame: The struct to hold the frame information in.
* msg: store the parsed frame in that struct
/** Read a packet into the rx_buf_.
*
* @return See APIError
*
* error API_ERROR_BAD_INDICATOR: Bad indicator byte at start of frame.
*/
APIError APIPlaintextFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
if (frame == nullptr) {
HELPER_LOG("Bad argument for try_read_frame_");
return APIError::BAD_ARG;
}
APIError APIPlaintextFrameHelper::try_read_frame_() {
// read header
while (!rx_header_parsed_) {
// Now that we know when the socket is ready, we can read up to 3 bytes
@@ -150,9 +142,9 @@ APIError APIPlaintextFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
}
// header reading done
// reserve space for body
if (rx_buf_.size() != rx_header_parsed_len_) {
rx_buf_.resize(rx_header_parsed_len_);
// Reserve space for body
if (this->rx_buf_.size() != this->rx_header_parsed_len_) {
this->rx_buf_.resize(this->rx_header_parsed_len_);
}
if (rx_buf_len_ < rx_header_parsed_len_) {
@@ -170,24 +162,22 @@ APIError APIPlaintextFrameHelper::try_read_frame_(std::vector<uint8_t> *frame) {
}
}
LOG_PACKET_RECEIVED(rx_buf_);
*frame = std::move(rx_buf_);
// consume msg
rx_buf_ = {};
rx_buf_len_ = 0;
rx_header_buf_pos_ = 0;
rx_header_parsed_ = false;
LOG_PACKET_RECEIVED(this->rx_buf_);
// Clear state for next frame (rx_buf_ still contains data for caller)
this->rx_buf_len_ = 0;
this->rx_header_buf_pos_ = 0;
this->rx_header_parsed_ = false;
return APIError::OK;
}
APIError APIPlaintextFrameHelper::read_packet(ReadPacketBuffer *buffer) {
APIError aerr;
if (state_ != State::DATA) {
APIError APIPlaintextFrameHelper::read_packet(ReadPacketBuffer *buffer) {
if (this->state_ != State::DATA) {
return APIError::WOULD_BLOCK;
}
std::vector<uint8_t> frame;
aerr = try_read_frame_(&frame);
APIError aerr = this->try_read_frame_();
if (aerr != APIError::OK) {
if (aerr == APIError::BAD_INDICATOR) {
// Make sure to tell the remote that we don't
@@ -220,10 +210,10 @@ APIError APIPlaintextFrameHelper::read_packet(ReadPacketBuffer *buffer) {
return aerr;
}
buffer->container = std::move(frame);
buffer->container = std::move(this->rx_buf_);
buffer->data_offset = 0;
buffer->data_len = rx_header_parsed_len_;
buffer->type = rx_header_parsed_type_;
buffer->data_len = this->rx_header_parsed_len_;
buffer->type = this->rx_header_parsed_type_;
return APIError::OK;
}
APIError APIPlaintextFrameHelper::write_protobuf_packet(uint8_t type, ProtoWriteBuffer buffer) {
@@ -240,8 +230,7 @@ APIError APIPlaintextFrameHelper::write_protobuf_packets(ProtoWriteBuffer buffer
return APIError::OK;
}
std::vector<uint8_t> *raw_buffer = buffer.get_buffer();
uint8_t *buffer_data = raw_buffer->data(); // Cache buffer pointer
uint8_t *buffer_data = buffer.get_buffer()->data();
this->reusable_iovs_.clear();
this->reusable_iovs_.reserve(packets.size());

View File

@@ -24,7 +24,7 @@ class APIPlaintextFrameHelper final : public APIFrameHelper {
APIError write_protobuf_packets(ProtoWriteBuffer buffer, std::span<const PacketInfo> packets) override;
protected:
APIError try_read_frame_(std::vector<uint8_t> *frame);
APIError try_read_frame_();
// Group 2-byte aligned types
uint16_t rx_header_parsed_type_ = 0;

View File

@@ -64,4 +64,20 @@ extend google.protobuf.FieldOptions {
// This is typically done through methods returning const T& or special accessor
// methods like get_options() or supported_modes_for_api_().
optional string container_pointer = 50001;
// fixed_vector: Use FixedVector instead of std::vector for repeated fields
// When set, the repeated field will use FixedVector<T> which requires calling
// init(size) before adding elements. This eliminates std::vector template overhead
// and is ideal when the exact size is known before populating the array.
optional bool fixed_vector = 50013 [default=false];
// container_pointer_no_template: Use a non-template container type for repeated fields
// Similar to container_pointer, but for containers that don't take template parameters.
// The container type is used as-is without appending element type.
// The container must have:
// - begin() and end() methods returning iterators
// - empty() method
// Example: [(container_pointer_no_template) = "light::ColorModeMask"]
// generates: const light::ColorModeMask *supported_color_modes{};
optional string container_pointer_no_template = 50014;
}

View File

@@ -355,8 +355,8 @@ void ListEntitiesFanResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(10, this->icon_ref_);
#endif
buffer.encode_uint32(11, static_cast<uint32_t>(this->entity_category));
for (const auto &it : *this->supported_preset_modes) {
buffer.encode_string(12, it, true);
for (const char *it : *this->supported_preset_modes) {
buffer.encode_string(12, it, strlen(it), true);
}
#ifdef USE_DEVICES
buffer.encode_uint32(13, this->device_id);
@@ -376,8 +376,8 @@ void ListEntitiesFanResponse::calculate_size(ProtoSize &size) const {
#endif
size.add_uint32(1, static_cast<uint32_t>(this->entity_category));
if (!this->supported_preset_modes->empty()) {
for (const auto &it : *this->supported_preset_modes) {
size.add_length_force(1, it.size());
for (const char *it : *this->supported_preset_modes) {
size.add_length_force(1, strlen(it));
}
}
#ifdef USE_DEVICES
@@ -884,6 +884,15 @@ void HomeassistantActionRequest::encode(ProtoWriteBuffer buffer) const {
buffer.encode_message(4, it, true);
}
buffer.encode_bool(5, this->is_event);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
buffer.encode_uint32(6, this->call_id);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
buffer.encode_bool(7, this->wants_response);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
buffer.encode_string(8, this->response_template);
#endif
}
void HomeassistantActionRequest::calculate_size(ProtoSize &size) const {
size.add_length(1, this->service_ref_.size());
@@ -891,6 +900,48 @@ void HomeassistantActionRequest::calculate_size(ProtoSize &size) const {
size.add_repeated_message(1, this->data_template);
size.add_repeated_message(1, this->variables);
size.add_bool(1, this->is_event);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
size.add_uint32(1, this->call_id);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
size.add_bool(1, this->wants_response);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
size.add_length(1, this->response_template.size());
#endif
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
bool HomeassistantActionResponse::decode_varint(uint32_t field_id, ProtoVarInt value) {
switch (field_id) {
case 1:
this->call_id = value.as_uint32();
break;
case 2:
this->success = value.as_bool();
break;
default:
return false;
}
return true;
}
bool HomeassistantActionResponse::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 3:
this->error_message = value.as_string();
break;
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
case 4: {
// Use raw data directly to avoid allocation
this->response_data = value.data();
this->response_data_len = value.size();
break;
}
#endif
default:
return false;
}
return true;
}
#endif
#ifdef USE_API_HOMEASSISTANT_STATES
@@ -1013,6 +1064,17 @@ bool ExecuteServiceArgument::decode_32bit(uint32_t field_id, Proto32Bit value) {
}
return true;
}
void ExecuteServiceArgument::decode(const uint8_t *buffer, size_t length) {
uint32_t count_bool_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 6);
this->bool_array.init(count_bool_array);
uint32_t count_int_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 7);
this->int_array.init(count_int_array);
uint32_t count_float_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 8);
this->float_array.init(count_float_array);
uint32_t count_string_array = ProtoDecodableMessage::count_repeated_field(buffer, length, 9);
this->string_array.init(count_string_array);
ProtoDecodableMessage::decode(buffer, length);
}
bool ExecuteServiceRequest::decode_length(uint32_t field_id, ProtoLengthDelimited value) {
switch (field_id) {
case 2:
@@ -1034,6 +1096,11 @@ bool ExecuteServiceRequest::decode_32bit(uint32_t field_id, Proto32Bit value) {
}
return true;
}
void ExecuteServiceRequest::decode(const uint8_t *buffer, size_t length) {
uint32_t count_args = ProtoDecodableMessage::count_repeated_field(buffer, length, 2);
this->args.init(count_args);
ProtoDecodableMessage::decode(buffer, length);
}
#endif
#ifdef USE_CAMERA
void ListEntitiesCameraResponse::encode(ProtoWriteBuffer buffer) const {
@@ -1112,14 +1179,14 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const {
for (const auto &it : *this->supported_swing_modes) {
buffer.encode_uint32(14, static_cast<uint32_t>(it), true);
}
for (const auto &it : *this->supported_custom_fan_modes) {
buffer.encode_string(15, it, true);
for (const char *it : *this->supported_custom_fan_modes) {
buffer.encode_string(15, it, strlen(it), true);
}
for (const auto &it : *this->supported_presets) {
buffer.encode_uint32(16, static_cast<uint32_t>(it), true);
}
for (const auto &it : *this->supported_custom_presets) {
buffer.encode_string(17, it, true);
for (const char *it : *this->supported_custom_presets) {
buffer.encode_string(17, it, strlen(it), true);
}
buffer.encode_bool(18, this->disabled_by_default);
#ifdef USE_ENTITY_ICON
@@ -1134,6 +1201,7 @@ void ListEntitiesClimateResponse::encode(ProtoWriteBuffer buffer) const {
#ifdef USE_DEVICES
buffer.encode_uint32(26, this->device_id);
#endif
buffer.encode_uint32(27, this->feature_flags);
}
void ListEntitiesClimateResponse::calculate_size(ProtoSize &size) const {
size.add_length(1, this->object_id_ref_.size());
@@ -1161,8 +1229,8 @@ void ListEntitiesClimateResponse::calculate_size(ProtoSize &size) const {
}
}
if (!this->supported_custom_fan_modes->empty()) {
for (const auto &it : *this->supported_custom_fan_modes) {
size.add_length_force(1, it.size());
for (const char *it : *this->supported_custom_fan_modes) {
size.add_length_force(1, strlen(it));
}
}
if (!this->supported_presets->empty()) {
@@ -1171,8 +1239,8 @@ void ListEntitiesClimateResponse::calculate_size(ProtoSize &size) const {
}
}
if (!this->supported_custom_presets->empty()) {
for (const auto &it : *this->supported_custom_presets) {
size.add_length_force(2, it.size());
for (const char *it : *this->supported_custom_presets) {
size.add_length_force(2, strlen(it));
}
}
size.add_bool(2, this->disabled_by_default);
@@ -1188,6 +1256,7 @@ void ListEntitiesClimateResponse::calculate_size(ProtoSize &size) const {
#ifdef USE_DEVICES
size.add_uint32(2, this->device_id);
#endif
size.add_uint32(2, this->feature_flags);
}
void ClimateStateResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_fixed32(1, this->key);
@@ -1406,8 +1475,8 @@ void ListEntitiesSelectResponse::encode(ProtoWriteBuffer buffer) const {
#ifdef USE_ENTITY_ICON
buffer.encode_string(5, this->icon_ref_);
#endif
for (const auto &it : *this->options) {
buffer.encode_string(6, it, true);
for (const char *it : *this->options) {
buffer.encode_string(6, it, strlen(it), true);
}
buffer.encode_bool(7, this->disabled_by_default);
buffer.encode_uint32(8, static_cast<uint32_t>(this->entity_category));
@@ -1423,8 +1492,8 @@ void ListEntitiesSelectResponse::calculate_size(ProtoSize &size) const {
size.add_length(1, this->icon_ref_.size());
#endif
if (!this->options->empty()) {
for (const auto &it : *this->options) {
size.add_length_force(1, it.size());
for (const char *it : *this->options) {
size.add_length_force(1, strlen(it));
}
}
size.add_bool(1, this->disabled_by_default);

View File

@@ -725,7 +725,7 @@ class ListEntitiesFanResponse final : public InfoResponseProtoMessage {
bool supports_speed{false};
bool supports_direction{false};
int32_t supported_speed_count{0};
const std::set<std::string> *supported_preset_modes{};
const std::vector<const char *> *supported_preset_modes{};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -790,7 +790,7 @@ class ListEntitiesLightResponse final : public InfoResponseProtoMessage {
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "list_entities_light_response"; }
#endif
const std::set<light::ColorMode> *supported_color_modes{};
const light::ColorModeMask *supported_color_modes{};
float min_mireds{0.0f};
float max_mireds{0.0f};
std::vector<std::string> effects{};
@@ -1104,16 +1104,25 @@ class HomeassistantServiceMap final : public ProtoMessage {
class HomeassistantActionRequest final : public ProtoMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 35;
static constexpr uint8_t ESTIMATED_SIZE = 113;
static constexpr uint8_t ESTIMATED_SIZE = 128;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "homeassistant_action_request"; }
#endif
StringRef service_ref_{};
void set_service(const StringRef &ref) { this->service_ref_ = ref; }
std::vector<HomeassistantServiceMap> data{};
std::vector<HomeassistantServiceMap> data_template{};
std::vector<HomeassistantServiceMap> variables{};
FixedVector<HomeassistantServiceMap> data{};
FixedVector<HomeassistantServiceMap> data_template{};
FixedVector<HomeassistantServiceMap> variables{};
bool is_event{false};
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
uint32_t call_id{0};
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
bool wants_response{false};
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
std::string response_template{};
#endif
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1123,6 +1132,30 @@ class HomeassistantActionRequest final : public ProtoMessage {
protected:
};
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
class HomeassistantActionResponse final : public ProtoDecodableMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 130;
static constexpr uint8_t ESTIMATED_SIZE = 34;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "homeassistant_action_response"; }
#endif
uint32_t call_id{0};
bool success{false};
std::string error_message{};
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
const uint8_t *response_data{nullptr};
uint16_t response_data_len{0};
#endif
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
protected:
bool decode_length(uint32_t field_id, ProtoLengthDelimited value) override;
bool decode_varint(uint32_t field_id, ProtoVarInt value) override;
};
#endif
#ifdef USE_API_HOMEASSISTANT_STATES
class SubscribeHomeAssistantStatesRequest final : public ProtoMessage {
public:
@@ -1230,7 +1263,7 @@ class ListEntitiesServicesResponse final : public ProtoMessage {
StringRef name_ref_{};
void set_name(const StringRef &ref) { this->name_ref_ = ref; }
uint32_t key{0};
std::vector<ListEntitiesServicesArgument> args{};
FixedVector<ListEntitiesServicesArgument> args{};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1246,10 +1279,11 @@ class ExecuteServiceArgument final : public ProtoDecodableMessage {
float float_{0.0f};
std::string string_{};
int32_t int_{0};
std::vector<bool> bool_array{};
std::vector<int32_t> int_array{};
std::vector<float> float_array{};
std::vector<std::string> string_array{};
FixedVector<bool> bool_array{};
FixedVector<int32_t> int_array{};
FixedVector<float> float_array{};
FixedVector<std::string> string_array{};
void decode(const uint8_t *buffer, size_t length) override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
@@ -1267,7 +1301,8 @@ class ExecuteServiceRequest final : public ProtoDecodableMessage {
const char *message_name() const override { return "execute_service_request"; }
#endif
uint32_t key{0};
std::vector<ExecuteServiceArgument> args{};
FixedVector<ExecuteServiceArgument> args{};
void decode(const uint8_t *buffer, size_t length) override;
#ifdef HAS_PROTO_MESSAGE_DUMP
void dump_to(std::string &out) const override;
#endif
@@ -1336,27 +1371,28 @@ class CameraImageRequest final : public ProtoDecodableMessage {
class ListEntitiesClimateResponse final : public InfoResponseProtoMessage {
public:
static constexpr uint8_t MESSAGE_TYPE = 46;
static constexpr uint8_t ESTIMATED_SIZE = 145;
static constexpr uint8_t ESTIMATED_SIZE = 150;
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "list_entities_climate_response"; }
#endif
bool supports_current_temperature{false};
bool supports_two_point_target_temperature{false};
const std::set<climate::ClimateMode> *supported_modes{};
const climate::ClimateModeMask *supported_modes{};
float visual_min_temperature{0.0f};
float visual_max_temperature{0.0f};
float visual_target_temperature_step{0.0f};
bool supports_action{false};
const std::set<climate::ClimateFanMode> *supported_fan_modes{};
const std::set<climate::ClimateSwingMode> *supported_swing_modes{};
const std::set<std::string> *supported_custom_fan_modes{};
const std::set<climate::ClimatePreset> *supported_presets{};
const std::set<std::string> *supported_custom_presets{};
const climate::ClimateFanModeMask *supported_fan_modes{};
const climate::ClimateSwingModeMask *supported_swing_modes{};
const std::vector<const char *> *supported_custom_fan_modes{};
const climate::ClimatePresetMask *supported_presets{};
const std::vector<const char *> *supported_custom_presets{};
float visual_current_temperature_step{0.0f};
bool supports_current_humidity{false};
bool supports_target_humidity{false};
float visual_min_humidity{0.0f};
float visual_max_humidity{0.0f};
uint32_t feature_flags{0};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1498,7 +1534,7 @@ class ListEntitiesSelectResponse final : public InfoResponseProtoMessage {
#ifdef HAS_PROTO_MESSAGE_DUMP
const char *message_name() const override { return "list_entities_select_response"; }
#endif
const std::vector<std::string> *options{};
const FixedVector<const char *> *options{};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
#ifdef HAS_PROTO_MESSAGE_DUMP
@@ -1890,7 +1926,7 @@ class BluetoothGATTCharacteristic final : public ProtoMessage {
std::array<uint64_t, 2> uuid{};
uint32_t handle{0};
uint32_t properties{0};
std::vector<BluetoothGATTDescriptor> descriptors{};
FixedVector<BluetoothGATTDescriptor> descriptors{};
uint32_t short_uuid{0};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;
@@ -1904,7 +1940,7 @@ class BluetoothGATTService final : public ProtoMessage {
public:
std::array<uint64_t, 2> uuid{};
uint32_t handle{0};
std::vector<BluetoothGATTCharacteristic> characteristics{};
FixedVector<BluetoothGATTCharacteristic> characteristics{};
uint32_t short_uuid{0};
void encode(ProtoWriteBuffer buffer) const override;
void calculate_size(ProtoSize &size) const override;

View File

@@ -88,6 +88,12 @@ static void dump_field(std::string &out, const char *field_name, StringRef value
out.append("\n");
}
static void dump_field(std::string &out, const char *field_name, const char *value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append("'").append(value).append("'");
out.append("\n");
}
template<typename T> static void dump_field(std::string &out, const char *field_name, T value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append(proto_enum_to_string<T>(value));
@@ -1122,6 +1128,28 @@ void HomeassistantActionRequest::dump_to(std::string &out) const {
out.append("\n");
}
dump_field(out, "is_event", this->is_event);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
dump_field(out, "call_id", this->call_id);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
dump_field(out, "wants_response", this->wants_response);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
dump_field(out, "response_template", this->response_template);
#endif
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
void HomeassistantActionResponse::dump_to(std::string &out) const {
MessageDumpHelper helper(out, "HomeassistantActionResponse");
dump_field(out, "call_id", this->call_id);
dump_field(out, "success", this->success);
dump_field(out, "error_message", this->error_message);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
out.append(" response_data: ");
out.append(format_hex_pretty(this->response_data, this->response_data_len));
out.append("\n");
#endif
}
#endif
#ifdef USE_API_HOMEASSISTANT_STATES
@@ -1270,6 +1298,7 @@ void ListEntitiesClimateResponse::dump_to(std::string &out) const {
#ifdef USE_DEVICES
dump_field(out, "device_id", this->device_id);
#endif
dump_field(out, "feature_flags", this->feature_flags);
}
void ClimateStateResponse::dump_to(std::string &out) const {
MessageDumpHelper helper(out, "ClimateStateResponse");

View File

@@ -610,6 +610,17 @@ void APIServerConnectionBase::read_message(uint32_t msg_size, uint32_t msg_type,
this->on_z_wave_proxy_request(msg);
break;
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
case HomeassistantActionResponse::MESSAGE_TYPE: {
HomeassistantActionResponse msg;
msg.decode(msg_data, msg_size);
#ifdef HAS_PROTO_MESSAGE_DUMP
ESP_LOGVV(TAG, "on_homeassistant_action_response: %s", msg.dump().c_str());
#endif
this->on_homeassistant_action_response(msg);
break;
}
#endif
default:
break;

View File

@@ -66,6 +66,9 @@ class APIServerConnectionBase : public ProtoService {
virtual void on_subscribe_homeassistant_services_request(const SubscribeHomeassistantServicesRequest &value){};
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
virtual void on_homeassistant_action_response(const HomeassistantActionResponse &value){};
#endif
#ifdef USE_API_HOMEASSISTANT_STATES
virtual void on_subscribe_home_assistant_states_request(const SubscribeHomeAssistantStatesRequest &value){};
#endif

View File

@@ -9,12 +9,16 @@
#include "esphome/core/log.h"
#include "esphome/core/util.h"
#include "esphome/core/version.h"
#ifdef USE_API_HOMEASSISTANT_SERVICES
#include "homeassistant_service.h"
#endif
#ifdef USE_LOGGER
#include "esphome/components/logger/logger.h"
#endif
#include <algorithm>
#include <utility>
namespace esphome::api {
@@ -220,7 +224,7 @@ void APIServer::dump_config() {
" Address: %s:%u\n"
" Listen backlog: %u\n"
" Max connections: %u",
network::get_use_address().c_str(), this->port_, this->listen_backlog_, this->max_connections_);
network::get_use_address(), this->port_, this->listen_backlog_, this->max_connections_);
#ifdef USE_API_NOISE
ESP_LOGCONFIG(TAG, " Noise encryption: %s", YESNO(this->noise_ctx_->has_psk()));
if (!this->noise_ctx_->has_psk()) {
@@ -400,7 +404,38 @@ void APIServer::send_homeassistant_action(const HomeassistantActionRequest &call
client->send_homeassistant_action(call);
}
}
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
void APIServer::register_action_response_callback(uint32_t call_id, ActionResponseCallback callback) {
this->action_response_callbacks_.push_back({call_id, std::move(callback)});
}
void APIServer::handle_action_response(uint32_t call_id, bool success, const std::string &error_message) {
for (auto it = this->action_response_callbacks_.begin(); it != this->action_response_callbacks_.end(); ++it) {
if (it->call_id == call_id) {
auto callback = std::move(it->callback);
this->action_response_callbacks_.erase(it);
ActionResponse response(success, error_message);
callback(response);
return;
}
}
}
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
void APIServer::handle_action_response(uint32_t call_id, bool success, const std::string &error_message,
const uint8_t *response_data, size_t response_data_len) {
for (auto it = this->action_response_callbacks_.begin(); it != this->action_response_callbacks_.end(); ++it) {
if (it->call_id == call_id) {
auto callback = std::move(it->callback);
this->action_response_callbacks_.erase(it);
ActionResponse response(success, error_message, response_data, response_data_len);
callback(response);
return;
}
}
}
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
#endif // USE_API_HOMEASSISTANT_SERVICES
#ifdef USE_API_HOMEASSISTANT_STATES
void APIServer::subscribe_home_assistant_state(std::string entity_id, optional<std::string> attribute,
@@ -433,6 +468,31 @@ uint16_t APIServer::get_port() const { return this->port_; }
void APIServer::set_reboot_timeout(uint32_t reboot_timeout) { this->reboot_timeout_ = reboot_timeout; }
#ifdef USE_API_NOISE
bool APIServer::update_noise_psk_(const SavedNoisePsk &new_psk, const LogString *save_log_msg,
const LogString *fail_log_msg, const psk_t &active_psk, bool make_active) {
if (!this->noise_pref_.save(&new_psk)) {
ESP_LOGW(TAG, "%s", LOG_STR_ARG(fail_log_msg));
return false;
}
// ensure it's written immediately
if (!global_preferences->sync()) {
ESP_LOGW(TAG, "Failed to sync preferences");
return false;
}
ESP_LOGD(TAG, "%s", LOG_STR_ARG(save_log_msg));
if (make_active) {
this->set_timeout(100, [this, active_psk]() {
ESP_LOGW(TAG, "Disconnecting all clients to reset PSK");
this->set_noise_psk(active_psk);
for (auto &c : this->clients_) {
DisconnectRequest req;
c->send_message(req, DisconnectRequest::MESSAGE_TYPE);
}
});
}
return true;
}
bool APIServer::save_noise_psk(psk_t psk, bool make_active) {
#ifdef USE_API_NOISE_PSK_FROM_YAML
// When PSK is set from YAML, this function should never be called
@@ -447,27 +507,21 @@ bool APIServer::save_noise_psk(psk_t psk, bool make_active) {
}
SavedNoisePsk new_saved_psk{psk};
if (!this->noise_pref_.save(&new_saved_psk)) {
ESP_LOGW(TAG, "Failed to save Noise PSK");
return false;
}
// ensure it's written immediately
if (!global_preferences->sync()) {
ESP_LOGW(TAG, "Failed to sync preferences");
return false;
}
ESP_LOGD(TAG, "Noise PSK saved");
if (make_active) {
this->set_timeout(100, [this, psk]() {
ESP_LOGW(TAG, "Disconnecting all clients to reset PSK");
this->set_noise_psk(psk);
for (auto &c : this->clients_) {
DisconnectRequest req;
c->send_message(req, DisconnectRequest::MESSAGE_TYPE);
}
});
}
return true;
return this->update_noise_psk_(new_saved_psk, LOG_STR("Noise PSK saved"), LOG_STR("Failed to save Noise PSK"), psk,
make_active);
#endif
}
bool APIServer::clear_noise_psk(bool make_active) {
#ifdef USE_API_NOISE_PSK_FROM_YAML
// When PSK is set from YAML, this function should never be called
// but if it is, reject the change
ESP_LOGW(TAG, "Key set in YAML");
return false;
#else
SavedNoisePsk empty_psk{};
psk_t empty{};
return this->update_noise_psk_(empty_psk, LOG_STR("Noise PSK cleared"), LOG_STR("Failed to clear Noise PSK"), empty,
make_active);
#endif
}
#endif

View File

@@ -16,6 +16,7 @@
#include "user_services.h"
#endif
#include <map>
#include <vector>
namespace esphome::api {
@@ -52,6 +53,7 @@ class APIServer : public Component, public Controller {
#ifdef USE_API_NOISE
bool save_noise_psk(psk_t psk, bool make_active = true);
bool clear_noise_psk(bool make_active = true);
void set_noise_psk(psk_t psk) { noise_ctx_->set_psk(psk); }
std::shared_ptr<APINoiseContext> get_noise_ctx() { return noise_ctx_; }
#endif // USE_API_NOISE
@@ -111,10 +113,26 @@ class APIServer : public Component, public Controller {
#ifdef USE_API_HOMEASSISTANT_SERVICES
void send_homeassistant_action(const HomeassistantActionRequest &call);
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
// Action response handling
using ActionResponseCallback = std::function<void(const class ActionResponse &)>;
void register_action_response_callback(uint32_t call_id, ActionResponseCallback callback);
void handle_action_response(uint32_t call_id, bool success, const std::string &error_message);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
void handle_action_response(uint32_t call_id, bool success, const std::string &error_message,
const uint8_t *response_data, size_t response_data_len);
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
#endif // USE_API_HOMEASSISTANT_SERVICES
#ifdef USE_API_SERVICES
void initialize_user_services(std::initializer_list<UserServiceDescriptor *> services) {
this->user_services_.assign(services);
}
#ifdef USE_API_CUSTOM_SERVICES
// Only compile push_back method when custom_services: true (external components)
void register_user_service(UserServiceDescriptor *descriptor) { this->user_services_.push_back(descriptor); }
#endif
#endif
#ifdef USE_HOMEASSISTANT_TIME
void request_time();
#endif
@@ -163,6 +181,10 @@ class APIServer : public Component, public Controller {
protected:
void schedule_reboot_timeout_();
#ifdef USE_API_NOISE
bool update_noise_psk_(const SavedNoisePsk &new_psk, const LogString *save_log_msg, const LogString *fail_log_msg,
const psk_t &active_psk, bool make_active);
#endif // USE_API_NOISE
// Pointers and pointer-like types first (4 bytes each)
std::unique_ptr<socket::Socket> socket_ = nullptr;
#ifdef USE_API_CLIENT_CONNECTED_TRIGGER
@@ -187,6 +209,13 @@ class APIServer : public Component, public Controller {
#ifdef USE_API_SERVICES
std::vector<UserServiceDescriptor *> user_services_;
#endif
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
struct PendingActionResponse {
uint32_t call_id;
ActionResponseCallback callback;
};
std::vector<PendingActionResponse> action_response_callbacks_;
#endif
// Group smaller types together
uint16_t port_{6053};

View File

@@ -53,8 +53,14 @@ class CustomAPIDevice {
template<typename T, typename... Ts>
void register_service(void (T::*callback)(Ts...), const std::string &name,
const std::array<std::string, sizeof...(Ts)> &arg_names) {
#ifdef USE_API_CUSTOM_SERVICES
auto *service = new CustomAPIDeviceService<T, Ts...>(name, arg_names, (T *) this, callback); // NOLINT
global_api_server->register_user_service(service);
#else
static_assert(
sizeof(T) == 0,
"register_service() requires 'custom_services: true' in the 'api:' section of your YAML configuration");
#endif
}
#else
template<typename T, typename... Ts>
@@ -86,8 +92,14 @@ class CustomAPIDevice {
*/
#ifdef USE_API_SERVICES
template<typename T> void register_service(void (T::*callback)(), const std::string &name) {
#ifdef USE_API_CUSTOM_SERVICES
auto *service = new CustomAPIDeviceService<T>(name, {}, (T *) this, callback); // NOLINT
global_api_server->register_user_service(service);
#else
static_assert(
sizeof(T) == 0,
"register_service() requires 'custom_services: true' in the 'api:' section of your YAML configuration");
#endif
}
#else
template<typename T> void register_service(void (T::*callback)(), const std::string &name) {
@@ -201,9 +213,9 @@ class CustomAPIDevice {
void call_homeassistant_service(const std::string &service_name, const std::map<std::string, std::string> &data) {
HomeassistantActionRequest resp;
resp.set_service(StringRef(service_name));
resp.data.init(data.size());
for (auto &it : data) {
resp.data.emplace_back();
auto &kv = resp.data.back();
auto &kv = resp.data.emplace_back();
kv.set_key(StringRef(it.first));
kv.value = it.second;
}
@@ -244,9 +256,9 @@ class CustomAPIDevice {
HomeassistantActionRequest resp;
resp.set_service(StringRef(service_name));
resp.is_event = true;
resp.data.init(data.size());
for (auto &it : data) {
resp.data.emplace_back();
auto &kv = resp.data.back();
auto &kv = resp.data.emplace_back();
kv.set_key(StringRef(it.first));
kv.value = it.second;
}

View File

@@ -3,8 +3,13 @@
#include "api_server.h"
#ifdef USE_API
#ifdef USE_API_HOMEASSISTANT_SERVICES
#include <functional>
#include <utility>
#include <vector>
#include "api_pb2.h"
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
#include "esphome/components/json/json_util.h"
#endif
#include "esphome/core/automation.h"
#include "esphome/core/helpers.h"
@@ -36,66 +41,191 @@ template<typename... X> class TemplatableStringValue : public TemplatableValue<s
template<typename... Ts> class TemplatableKeyValuePair {
public:
// Default constructor needed for FixedVector::emplace_back()
TemplatableKeyValuePair() = default;
// Keys are always string literals from YAML dictionary keys (e.g., "code", "event")
// and never templatable values or lambdas. Only the value parameter can be a lambda/template.
// Using pass-by-value with std::move allows optimal performance for both lvalues and rvalues.
template<typename T> TemplatableKeyValuePair(std::string key, T value) : key(std::move(key)), value(value) {}
std::string key;
TemplatableStringValue<Ts...> value;
};
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
// Represents the response data from a Home Assistant action
class ActionResponse {
public:
ActionResponse(bool success, std::string error_message = "")
: success_(success), error_message_(std::move(error_message)) {}
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
ActionResponse(bool success, std::string error_message, const uint8_t *data, size_t data_len)
: success_(success), error_message_(std::move(error_message)) {
if (data == nullptr || data_len == 0)
return;
this->json_document_ = json::parse_json(data, data_len);
}
#endif
bool is_success() const { return this->success_; }
const std::string &get_error_message() const { return this->error_message_; }
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
// Get data as parsed JSON object (const version returns read-only view)
JsonObjectConst get_json() const { return this->json_document_.as<JsonObjectConst>(); }
#endif
protected:
bool success_;
std::string error_message_;
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
JsonDocument json_document_;
#endif
};
// Callback type for action responses
template<typename... Ts> using ActionResponseCallback = std::function<void(const ActionResponse &, Ts...)>;
#endif
template<typename... Ts> class HomeAssistantServiceCallAction : public Action<Ts...> {
public:
explicit HomeAssistantServiceCallAction(APIServer *parent, bool is_event) : parent_(parent), is_event_(is_event) {}
explicit HomeAssistantServiceCallAction(APIServer *parent, bool is_event) : parent_(parent) {
this->flags_.is_event = is_event;
}
template<typename T> void set_service(T service) { this->service_ = service; }
// Initialize FixedVector members - called from Python codegen with compile-time known sizes.
// Must be called before any add_* methods; capacity must match the number of subsequent add_* calls.
void init_data(size_t count) { this->data_.init(count); }
void init_data_template(size_t count) { this->data_template_.init(count); }
void init_variables(size_t count) { this->variables_.init(count); }
// Keys are always string literals from the Python code generation (e.g., cg.add(var.add_data("tag_id", templ))).
// The value parameter can be a lambda/template, but keys are never templatable.
// Using pass-by-value allows the compiler to optimize for both lvalues and rvalues.
template<typename T> void add_data(std::string key, T value) { this->data_.emplace_back(std::move(key), value); }
template<typename T> void add_data_template(std::string key, T value) {
this->data_template_.emplace_back(std::move(key), value);
template<typename K, typename V> void add_data(K &&key, V &&value) {
this->add_kv_(this->data_, std::forward<K>(key), std::forward<V>(value));
}
template<typename T> void add_variable(std::string key, T value) {
this->variables_.emplace_back(std::move(key), value);
template<typename K, typename V> void add_data_template(K &&key, V &&value) {
this->add_kv_(this->data_template_, std::forward<K>(key), std::forward<V>(value));
}
template<typename K, typename V> void add_variable(K &&key, V &&value) {
this->add_kv_(this->variables_, std::forward<K>(key), std::forward<V>(value));
}
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
template<typename T> void set_response_template(T response_template) {
this->response_template_ = response_template;
this->flags_.has_response_template = true;
}
void set_wants_status() { this->flags_.wants_status = true; }
void set_wants_response() { this->flags_.wants_response = true; }
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
Trigger<JsonObjectConst, Ts...> *get_success_trigger_with_response() const {
return this->success_trigger_with_response_;
}
#endif
Trigger<Ts...> *get_success_trigger() const { return this->success_trigger_; }
Trigger<std::string, Ts...> *get_error_trigger() const { return this->error_trigger_; }
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
void play(Ts... x) override {
HomeassistantActionRequest resp;
std::string service_value = this->service_.value(x...);
resp.set_service(StringRef(service_value));
resp.is_event = this->is_event_;
for (auto &it : this->data_) {
resp.data.emplace_back();
auto &kv = resp.data.back();
kv.set_key(StringRef(it.key));
kv.value = it.value.value(x...);
}
for (auto &it : this->data_template_) {
resp.data_template.emplace_back();
auto &kv = resp.data_template.back();
kv.set_key(StringRef(it.key));
kv.value = it.value.value(x...);
}
for (auto &it : this->variables_) {
resp.variables.emplace_back();
auto &kv = resp.variables.back();
kv.set_key(StringRef(it.key));
kv.value = it.value.value(x...);
resp.is_event = this->flags_.is_event;
this->populate_service_map(resp.data, this->data_, x...);
this->populate_service_map(resp.data_template, this->data_template_, x...);
this->populate_service_map(resp.variables, this->variables_, x...);
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
if (this->flags_.wants_status) {
// Generate a unique call ID for this service call
static uint32_t call_id_counter = 1;
uint32_t call_id = call_id_counter++;
resp.call_id = call_id;
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
if (this->flags_.wants_response) {
resp.wants_response = true;
// Set response template if provided
if (this->flags_.has_response_template) {
std::string response_template_value = this->response_template_.value(x...);
resp.response_template = response_template_value;
}
}
#endif
auto captured_args = std::make_tuple(x...);
this->parent_->register_action_response_callback(call_id, [this, captured_args](const ActionResponse &response) {
std::apply(
[this, &response](auto &&...args) {
if (response.is_success()) {
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
if (this->flags_.wants_response) {
this->success_trigger_with_response_->trigger(response.get_json(), args...);
} else
#endif
{
this->success_trigger_->trigger(args...);
}
} else {
this->error_trigger_->trigger(response.get_error_message(), args...);
}
},
captured_args);
});
}
#endif
this->parent_->send_homeassistant_action(resp);
}
protected:
// Helper to add key-value pairs to FixedVectors with perfect forwarding to avoid copies
template<typename K, typename V> void add_kv_(FixedVector<TemplatableKeyValuePair<Ts...>> &vec, K &&key, V &&value) {
auto &kv = vec.emplace_back();
kv.key = std::forward<K>(key);
kv.value = std::forward<V>(value);
}
template<typename VectorType, typename SourceType>
static void populate_service_map(VectorType &dest, SourceType &source, Ts... x) {
dest.init(source.size());
for (auto &it : source) {
auto &kv = dest.emplace_back();
kv.set_key(StringRef(it.key));
kv.value = it.value.value(x...);
}
}
APIServer *parent_;
bool is_event_;
TemplatableStringValue<Ts...> service_{};
std::vector<TemplatableKeyValuePair<Ts...>> data_;
std::vector<TemplatableKeyValuePair<Ts...>> data_template_;
std::vector<TemplatableKeyValuePair<Ts...>> variables_;
FixedVector<TemplatableKeyValuePair<Ts...>> data_;
FixedVector<TemplatableKeyValuePair<Ts...>> data_template_;
FixedVector<TemplatableKeyValuePair<Ts...>> variables_;
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES
#ifdef USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
TemplatableStringValue<Ts...> response_template_{""};
Trigger<JsonObjectConst, Ts...> *success_trigger_with_response_ = new Trigger<JsonObjectConst, Ts...>();
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES_JSON
Trigger<Ts...> *success_trigger_ = new Trigger<Ts...>();
Trigger<std::string, Ts...> *error_trigger_ = new Trigger<std::string, Ts...>();
#endif // USE_API_HOMEASSISTANT_ACTION_RESPONSES
struct Flags {
uint8_t is_event : 1;
uint8_t wants_status : 1;
uint8_t wants_response : 1;
uint8_t has_response_template : 1;
uint8_t reserved : 5;
} flags_{0};
};
} // namespace esphome::api
#endif
#endif

View File

@@ -7,6 +7,69 @@ namespace esphome::api {
static const char *const TAG = "api.proto";
uint32_t ProtoDecodableMessage::count_repeated_field(const uint8_t *buffer, size_t length, uint32_t target_field_id) {
uint32_t count = 0;
const uint8_t *ptr = buffer;
const uint8_t *end = buffer + length;
while (ptr < end) {
uint32_t consumed;
// Parse field header (tag)
auto res = ProtoVarInt::parse(ptr, end - ptr, &consumed);
if (!res.has_value()) {
break; // Invalid data, stop counting
}
uint32_t tag = res->as_uint32();
uint32_t field_type = tag & WIRE_TYPE_MASK;
uint32_t field_id = tag >> 3;
ptr += consumed;
// Count if this is the target field
if (field_id == target_field_id) {
count++;
}
// Skip field data based on wire type
switch (field_type) {
case WIRE_TYPE_VARINT: { // VarInt - parse and skip
res = ProtoVarInt::parse(ptr, end - ptr, &consumed);
if (!res.has_value()) {
return count; // Invalid data, return what we have
}
ptr += consumed;
break;
}
case WIRE_TYPE_LENGTH_DELIMITED: { // Length-delimited - parse length and skip data
res = ProtoVarInt::parse(ptr, end - ptr, &consumed);
if (!res.has_value()) {
return count;
}
uint32_t field_length = res->as_uint32();
ptr += consumed;
if (ptr + field_length > end) {
return count; // Out of bounds
}
ptr += field_length;
break;
}
case WIRE_TYPE_FIXED32: { // 32-bit - skip 4 bytes
if (ptr + 4 > end) {
return count;
}
ptr += 4;
break;
}
default:
// Unknown wire type, can't continue
return count;
}
}
return count;
}
void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) {
const uint8_t *ptr = buffer;
const uint8_t *end = buffer + length;
@@ -22,12 +85,12 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) {
}
uint32_t tag = res->as_uint32();
uint32_t field_type = tag & 0b111;
uint32_t field_type = tag & WIRE_TYPE_MASK;
uint32_t field_id = tag >> 3;
ptr += consumed;
switch (field_type) {
case 0: { // VarInt
case WIRE_TYPE_VARINT: { // VarInt
res = ProtoVarInt::parse(ptr, end - ptr, &consumed);
if (!res.has_value()) {
ESP_LOGV(TAG, "Invalid VarInt at offset %ld", (long) (ptr - buffer));
@@ -39,7 +102,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) {
ptr += consumed;
break;
}
case 2: { // Length-delimited
case WIRE_TYPE_LENGTH_DELIMITED: { // Length-delimited
res = ProtoVarInt::parse(ptr, end - ptr, &consumed);
if (!res.has_value()) {
ESP_LOGV(TAG, "Invalid Length Delimited at offset %ld", (long) (ptr - buffer));
@@ -57,7 +120,7 @@ void ProtoDecodableMessage::decode(const uint8_t *buffer, size_t length) {
ptr += field_length;
break;
}
case 5: { // 32-bit
case WIRE_TYPE_FIXED32: { // 32-bit
if (ptr + 4 > end) {
ESP_LOGV(TAG, "Out-of-bounds Fixed32-bit at offset %ld", (long) (ptr - buffer));
return;

View File

@@ -15,6 +15,13 @@
namespace esphome::api {
// Protocol Buffer wire type constants
// See https://protobuf.dev/programming-guides/encoding/#structure
constexpr uint8_t WIRE_TYPE_VARINT = 0; // int32, int64, uint32, uint64, sint32, sint64, bool, enum
constexpr uint8_t WIRE_TYPE_LENGTH_DELIMITED = 2; // string, bytes, embedded messages, packed repeated fields
constexpr uint8_t WIRE_TYPE_FIXED32 = 5; // fixed32, sfixed32, float
constexpr uint8_t WIRE_TYPE_MASK = 0b111; // Mask to extract wire type from tag
// Helper functions for ZigZag encoding/decoding
inline constexpr uint32_t encode_zigzag32(int32_t value) {
return (static_cast<uint32_t>(value) << 1) ^ (static_cast<uint32_t>(value >> 31));
@@ -241,7 +248,7 @@ class ProtoWriteBuffer {
* Following https://protobuf.dev/programming-guides/encoding/#structure
*/
void encode_field_raw(uint32_t field_id, uint32_t type) {
uint32_t val = (field_id << 3) | (type & 0b111);
uint32_t val = (field_id << 3) | (type & WIRE_TYPE_MASK);
this->encode_varint_raw(val);
}
void encode_string(uint32_t field_id, const char *string, size_t len, bool force = false) {
@@ -354,7 +361,18 @@ class ProtoMessage {
// Base class for messages that support decoding
class ProtoDecodableMessage : public ProtoMessage {
public:
void decode(const uint8_t *buffer, size_t length);
virtual void decode(const uint8_t *buffer, size_t length);
/**
* Count occurrences of a repeated field in a protobuf buffer.
* This is a lightweight scan that only parses tags and skips field data.
*
* @param buffer Pointer to the protobuf buffer
* @param length Length of the buffer in bytes
* @param target_field_id The field ID to count
* @return Number of times the field appears in the buffer
*/
static uint32_t count_repeated_field(const uint8_t *buffer, size_t length, uint32_t target_field_id);
protected:
virtual bool decode_varint(uint32_t field_id, ProtoVarInt value) { return false; }
@@ -482,7 +500,7 @@ class ProtoSize {
* @return The number of bytes needed to encode the field ID and wire type
*/
static constexpr uint32_t field(uint32_t field_id, uint32_t type) {
uint32_t tag = (field_id << 3) | (type & 0b111);
uint32_t tag = (field_id << 3) | (type & WIRE_TYPE_MASK);
return varint(tag);
}
@@ -749,13 +767,29 @@ class ProtoSize {
template<typename MessageType>
inline void add_repeated_message(uint32_t field_id_size, const std::vector<MessageType> &messages) {
// Skip if the vector is empty
if (messages.empty()) {
return;
if (!messages.empty()) {
// Use the force version for all messages in the repeated field
for (const auto &message : messages) {
add_message_object_force(field_id_size, message);
}
}
}
// Use the force version for all messages in the repeated field
for (const auto &message : messages) {
add_message_object_force(field_id_size, message);
/**
* @brief Calculates and adds the sizes of all messages in a repeated field to the total message size (FixedVector
* version)
*
* @tparam MessageType The type of the nested messages in the FixedVector
* @param messages FixedVector of message objects
*/
template<typename MessageType>
inline void add_repeated_message(uint32_t field_id_size, const FixedVector<MessageType> &messages) {
// Skip if the fixed vector is empty
if (!messages.empty()) {
// Use the force version for all messages in the repeated field
for (const auto &message : messages) {
add_message_object_force(field_id_size, message);
}
}
}
};

View File

@@ -11,16 +11,49 @@ template<> int32_t get_execute_arg_value<int32_t>(const ExecuteServiceArgument &
}
template<> float get_execute_arg_value<float>(const ExecuteServiceArgument &arg) { return arg.float_; }
template<> std::string get_execute_arg_value<std::string>(const ExecuteServiceArgument &arg) { return arg.string_; }
// Legacy std::vector versions for external components using custom_api_device.h - optimized with reserve
template<> std::vector<bool> get_execute_arg_value<std::vector<bool>>(const ExecuteServiceArgument &arg) {
return arg.bool_array;
std::vector<bool> result;
result.reserve(arg.bool_array.size());
result.insert(result.end(), arg.bool_array.begin(), arg.bool_array.end());
return result;
}
template<> std::vector<int32_t> get_execute_arg_value<std::vector<int32_t>>(const ExecuteServiceArgument &arg) {
return arg.int_array;
std::vector<int32_t> result;
result.reserve(arg.int_array.size());
result.insert(result.end(), arg.int_array.begin(), arg.int_array.end());
return result;
}
template<> std::vector<float> get_execute_arg_value<std::vector<float>>(const ExecuteServiceArgument &arg) {
return arg.float_array;
std::vector<float> result;
result.reserve(arg.float_array.size());
result.insert(result.end(), arg.float_array.begin(), arg.float_array.end());
return result;
}
template<> std::vector<std::string> get_execute_arg_value<std::vector<std::string>>(const ExecuteServiceArgument &arg) {
std::vector<std::string> result;
result.reserve(arg.string_array.size());
result.insert(result.end(), arg.string_array.begin(), arg.string_array.end());
return result;
}
// New FixedVector const reference versions for YAML-generated services - zero-copy
template<>
const FixedVector<bool> &get_execute_arg_value<const FixedVector<bool> &>(const ExecuteServiceArgument &arg) {
return arg.bool_array;
}
template<>
const FixedVector<int32_t> &get_execute_arg_value<const FixedVector<int32_t> &>(const ExecuteServiceArgument &arg) {
return arg.int_array;
}
template<>
const FixedVector<float> &get_execute_arg_value<const FixedVector<float> &>(const ExecuteServiceArgument &arg) {
return arg.float_array;
}
template<>
const FixedVector<std::string> &get_execute_arg_value<const FixedVector<std::string> &>(
const ExecuteServiceArgument &arg) {
return arg.string_array;
}
@@ -28,6 +61,8 @@ template<> enums::ServiceArgType to_service_arg_type<bool>() { return enums::SER
template<> enums::ServiceArgType to_service_arg_type<int32_t>() { return enums::SERVICE_ARG_TYPE_INT; }
template<> enums::ServiceArgType to_service_arg_type<float>() { return enums::SERVICE_ARG_TYPE_FLOAT; }
template<> enums::ServiceArgType to_service_arg_type<std::string>() { return enums::SERVICE_ARG_TYPE_STRING; }
// Legacy std::vector versions for external components using custom_api_device.h
template<> enums::ServiceArgType to_service_arg_type<std::vector<bool>>() { return enums::SERVICE_ARG_TYPE_BOOL_ARRAY; }
template<> enums::ServiceArgType to_service_arg_type<std::vector<int32_t>>() {
return enums::SERVICE_ARG_TYPE_INT_ARRAY;
@@ -39,4 +74,18 @@ template<> enums::ServiceArgType to_service_arg_type<std::vector<std::string>>()
return enums::SERVICE_ARG_TYPE_STRING_ARRAY;
}
// New FixedVector const reference versions for YAML-generated services
template<> enums::ServiceArgType to_service_arg_type<const FixedVector<bool> &>() {
return enums::SERVICE_ARG_TYPE_BOOL_ARRAY;
}
template<> enums::ServiceArgType to_service_arg_type<const FixedVector<int32_t> &>() {
return enums::SERVICE_ARG_TYPE_INT_ARRAY;
}
template<> enums::ServiceArgType to_service_arg_type<const FixedVector<float> &>() {
return enums::SERVICE_ARG_TYPE_FLOAT_ARRAY;
}
template<> enums::ServiceArgType to_service_arg_type<const FixedVector<std::string> &>() {
return enums::SERVICE_ARG_TYPE_STRING_ARRAY;
}
} // namespace esphome::api

View File

@@ -35,9 +35,9 @@ template<typename... Ts> class UserServiceBase : public UserServiceDescriptor {
msg.set_name(StringRef(this->name_));
msg.key = this->key_;
std::array<enums::ServiceArgType, sizeof...(Ts)> arg_types = {to_service_arg_type<Ts>()...};
for (int i = 0; i < sizeof...(Ts); i++) {
msg.args.emplace_back();
auto &arg = msg.args.back();
msg.args.init(sizeof...(Ts));
for (size_t i = 0; i < sizeof...(Ts); i++) {
auto &arg = msg.args.emplace_back();
arg.type = arg_types[i];
arg.set_name(StringRef(this->arg_names_[i]));
}
@@ -55,7 +55,7 @@ template<typename... Ts> class UserServiceBase : public UserServiceDescriptor {
protected:
virtual void execute(Ts... x) = 0;
template<int... S> void execute_(const std::vector<ExecuteServiceArgument> &args, seq<S...> type) {
template<typename ArgsContainer, int... S> void execute_(const ArgsContainer &args, seq<S...> type) {
this->execute((get_execute_arg_value<Ts>(args[S]))...);
}

View File

@@ -165,4 +165,4 @@ def final_validate_audio_schema(
async def to_code(config):
cg.add_library("esphome/esp-audio-libs", "1.1.4")
cg.add_library("esphome/esp-audio-libs", "2.0.1")

View File

@@ -57,7 +57,7 @@ const char *audio_file_type_to_string(AudioFileType file_type) {
void scale_audio_samples(const int16_t *audio_samples, int16_t *output_buffer, int16_t scale_factor,
size_t samples_to_scale) {
// Note the assembly dsps_mulc function has audio glitches if the input and output buffers are the same.
for (int i = 0; i < samples_to_scale; i++) {
for (size_t i = 0; i < samples_to_scale; i++) {
int32_t acc = (int32_t) audio_samples[i] * (int32_t) scale_factor;
output_buffer[i] = (int16_t) (acc >> 15);
}

View File

@@ -229,18 +229,18 @@ FileDecoderState AudioDecoder::decode_flac_() {
auto result = this->flac_decoder_->read_header(this->input_transfer_buffer_->get_buffer_start(),
this->input_transfer_buffer_->available());
if (result == esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) {
return FileDecoderState::POTENTIALLY_FAILED;
}
if (result != esp_audio_libs::flac::FLAC_DECODER_SUCCESS) {
// Couldn't read FLAC header
if (result > esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) {
// Serrious error reading FLAC header, there is no recovery
return FileDecoderState::FAILED;
}
size_t bytes_consumed = this->flac_decoder_->get_bytes_index();
this->input_transfer_buffer_->decrease_buffer_length(bytes_consumed);
if (result == esp_audio_libs::flac::FLAC_DECODER_HEADER_OUT_OF_DATA) {
return FileDecoderState::MORE_TO_PROCESS;
}
// Reallocate the output transfer buffer to the smallest necessary size
this->free_buffer_required_ = flac_decoder_->get_output_buffer_size_bytes();
if (!this->output_transfer_buffer_->reallocate(this->free_buffer_required_)) {
@@ -256,9 +256,9 @@ FileDecoderState AudioDecoder::decode_flac_() {
}
uint32_t output_samples = 0;
auto result = this->flac_decoder_->decode_frame(
this->input_transfer_buffer_->get_buffer_start(), this->input_transfer_buffer_->available(),
reinterpret_cast<int16_t *>(this->output_transfer_buffer_->get_buffer_end()), &output_samples);
auto result = this->flac_decoder_->decode_frame(this->input_transfer_buffer_->get_buffer_start(),
this->input_transfer_buffer_->available(),
this->output_transfer_buffer_->get_buffer_end(), &output_samples);
if (result == esp_audio_libs::flac::FLAC_DECODER_ERROR_OUT_OF_DATA) {
// Not an issue, just needs more data that we'll get next time.

View File

@@ -6,6 +6,9 @@ namespace bang_bang {
static const char *const TAG = "bang_bang.climate";
BangBangClimate::BangBangClimate()
: idle_trigger_(new Trigger<>()), cool_trigger_(new Trigger<>()), heat_trigger_(new Trigger<>()) {}
void BangBangClimate::setup() {
this->sensor_->add_on_state_callback([this](float state) {
this->current_temperature = state;
@@ -31,53 +34,63 @@ void BangBangClimate::setup() {
restore->to_call(this).perform();
} else {
// restore from defaults, change_away handles those for us
if (supports_cool_ && supports_heat_) {
if (this->supports_cool_ && this->supports_heat_) {
this->mode = climate::CLIMATE_MODE_HEAT_COOL;
} else if (supports_cool_) {
} else if (this->supports_cool_) {
this->mode = climate::CLIMATE_MODE_COOL;
} else if (supports_heat_) {
} else if (this->supports_heat_) {
this->mode = climate::CLIMATE_MODE_HEAT;
}
this->change_away_(false);
}
}
void BangBangClimate::control(const climate::ClimateCall &call) {
if (call.get_mode().has_value())
if (call.get_mode().has_value()) {
this->mode = *call.get_mode();
if (call.get_target_temperature_low().has_value())
}
if (call.get_target_temperature_low().has_value()) {
this->target_temperature_low = *call.get_target_temperature_low();
if (call.get_target_temperature_high().has_value())
}
if (call.get_target_temperature_high().has_value()) {
this->target_temperature_high = *call.get_target_temperature_high();
if (call.get_preset().has_value())
}
if (call.get_preset().has_value()) {
this->change_away_(*call.get_preset() == climate::CLIMATE_PRESET_AWAY);
}
this->compute_state_();
this->publish_state();
}
climate::ClimateTraits BangBangClimate::traits() {
auto traits = climate::ClimateTraits();
traits.set_supports_current_temperature(true);
if (this->humidity_sensor_ != nullptr)
traits.set_supports_current_humidity(true);
traits.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE |
climate::CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE | climate::CLIMATE_SUPPORTS_ACTION);
if (this->humidity_sensor_ != nullptr) {
traits.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY);
}
traits.set_supported_modes({
climate::CLIMATE_MODE_OFF,
});
if (supports_cool_)
if (this->supports_cool_) {
traits.add_supported_mode(climate::CLIMATE_MODE_COOL);
if (supports_heat_)
}
if (this->supports_heat_) {
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT);
if (supports_cool_ && supports_heat_)
}
if (this->supports_cool_ && this->supports_heat_) {
traits.add_supported_mode(climate::CLIMATE_MODE_HEAT_COOL);
traits.set_supports_two_point_target_temperature(true);
if (supports_away_) {
}
if (this->supports_away_) {
traits.set_supported_presets({
climate::CLIMATE_PRESET_HOME,
climate::CLIMATE_PRESET_AWAY,
});
}
traits.set_supports_action(true);
return traits;
}
void BangBangClimate::compute_state_() {
if (this->mode == climate::CLIMATE_MODE_OFF) {
this->switch_to_action_(climate::CLIMATE_ACTION_OFF);
@@ -122,6 +135,7 @@ void BangBangClimate::compute_state_() {
this->switch_to_action_(target_action);
}
void BangBangClimate::switch_to_action_(climate::ClimateAction action) {
if (action == this->action) {
// already in target mode
@@ -166,6 +180,7 @@ void BangBangClimate::switch_to_action_(climate::ClimateAction action) {
this->prev_trigger_ = trig;
this->publish_state();
}
void BangBangClimate::change_away_(bool away) {
if (!away) {
this->target_temperature_low = this->normal_config_.default_temperature_low;
@@ -176,22 +191,26 @@ void BangBangClimate::change_away_(bool away) {
}
this->preset = away ? climate::CLIMATE_PRESET_AWAY : climate::CLIMATE_PRESET_HOME;
}
void BangBangClimate::set_normal_config(const BangBangClimateTargetTempConfig &normal_config) {
this->normal_config_ = normal_config;
}
void BangBangClimate::set_away_config(const BangBangClimateTargetTempConfig &away_config) {
this->supports_away_ = true;
this->away_config_ = away_config;
}
BangBangClimate::BangBangClimate()
: idle_trigger_(new Trigger<>()), cool_trigger_(new Trigger<>()), heat_trigger_(new Trigger<>()) {}
void BangBangClimate::set_sensor(sensor::Sensor *sensor) { this->sensor_ = sensor; }
void BangBangClimate::set_humidity_sensor(sensor::Sensor *humidity_sensor) { this->humidity_sensor_ = humidity_sensor; }
Trigger<> *BangBangClimate::get_idle_trigger() const { return this->idle_trigger_; }
Trigger<> *BangBangClimate::get_cool_trigger() const { return this->cool_trigger_; }
void BangBangClimate::set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
Trigger<> *BangBangClimate::get_heat_trigger() const { return this->heat_trigger_; }
void BangBangClimate::set_supports_cool(bool supports_cool) { this->supports_cool_ = supports_cool; }
void BangBangClimate::set_supports_heat(bool supports_heat) { this->supports_heat_ = supports_heat; }
void BangBangClimate::dump_config() {
LOG_CLIMATE("", "Bang Bang Climate", this);
ESP_LOGCONFIG(TAG,

View File

@@ -25,14 +25,15 @@ class BangBangClimate : public climate::Climate, public Component {
void set_sensor(sensor::Sensor *sensor);
void set_humidity_sensor(sensor::Sensor *humidity_sensor);
Trigger<> *get_idle_trigger() const;
Trigger<> *get_cool_trigger() const;
void set_supports_cool(bool supports_cool);
Trigger<> *get_heat_trigger() const;
void set_supports_heat(bool supports_heat);
void set_normal_config(const BangBangClimateTargetTempConfig &normal_config);
void set_away_config(const BangBangClimateTargetTempConfig &away_config);
Trigger<> *get_idle_trigger() const;
Trigger<> *get_cool_trigger() const;
Trigger<> *get_heat_trigger() const;
protected:
/// Override control to change settings of the climate device.
void control(const climate::ClimateCall &call) override;
@@ -56,16 +57,10 @@ class BangBangClimate : public climate::Climate, public Component {
*
* In idle mode, the controller is assumed to have both heating and cooling disabled.
*/
Trigger<> *idle_trigger_;
Trigger<> *idle_trigger_{nullptr};
/** The trigger to call when the controller should switch to cooling mode.
*/
Trigger<> *cool_trigger_;
/** Whether the controller supports cooling.
*
* A false value for this attribute means that the controller has no cooling action
* (for example a thermostat, where only heating and not-heating is possible).
*/
bool supports_cool_{false};
Trigger<> *cool_trigger_{nullptr};
/** The trigger to call when the controller should switch to heating mode.
*
* A null value for this attribute means that the controller has no heating action
@@ -73,15 +68,23 @@ class BangBangClimate : public climate::Climate, public Component {
* (blinds open) is possible.
*/
Trigger<> *heat_trigger_{nullptr};
bool supports_heat_{false};
/** A reference to the trigger that was previously active.
*
* This is so that the previous trigger can be stopped before enabling a new one.
*/
Trigger<> *prev_trigger_{nullptr};
BangBangClimateTargetTempConfig normal_config_{};
/** Whether the controller supports cooling/heating
*
* A false value for this attribute means that the controller has no respective action
* (for example a thermostat, where only heating and not-heating is possible).
*/
bool supports_cool_{false};
bool supports_heat_{false};
bool supports_away_{false};
BangBangClimateTargetTempConfig normal_config_{};
BangBangClimateTargetTempConfig away_config_{};
};

View File

@@ -99,9 +99,7 @@ enum BedjetCommand : uint8_t {
static const uint8_t BEDJET_FAN_SPEED_COUNT = 20;
static const char *const BEDJET_FAN_STEP_NAMES[BEDJET_FAN_SPEED_COUNT] = BEDJET_FAN_STEP_NAMES_;
static const std::string BEDJET_FAN_STEP_NAME_STRINGS[BEDJET_FAN_SPEED_COUNT] = BEDJET_FAN_STEP_NAMES_;
static const std::set<std::string> BEDJET_FAN_STEP_NAMES_SET BEDJET_FAN_STEP_NAMES_;
static constexpr const char *const BEDJET_FAN_STEP_NAMES[BEDJET_FAN_SPEED_COUNT] = BEDJET_FAN_STEP_NAMES_;
} // namespace bedjet
} // namespace esphome

View File

@@ -8,15 +8,15 @@ namespace bedjet {
using namespace esphome::climate;
static const std::string *bedjet_fan_step_to_fan_mode(const uint8_t fan_step) {
static const char *bedjet_fan_step_to_fan_mode(const uint8_t fan_step) {
if (fan_step < BEDJET_FAN_SPEED_COUNT)
return &BEDJET_FAN_STEP_NAME_STRINGS[fan_step];
return BEDJET_FAN_STEP_NAMES[fan_step];
return nullptr;
}
static uint8_t bedjet_fan_speed_to_step(const std::string &fan_step_percent) {
static uint8_t bedjet_fan_speed_to_step(const char *fan_step_percent) {
for (int i = 0; i < BEDJET_FAN_SPEED_COUNT; i++) {
if (fan_step_percent == BEDJET_FAN_STEP_NAME_STRINGS[i]) {
if (strcmp(BEDJET_FAN_STEP_NAMES[i], fan_step_percent) == 0) {
return i;
}
}
@@ -48,7 +48,7 @@ void BedJetClimate::dump_config() {
ESP_LOGCONFIG(TAG, " - %s", LOG_STR_ARG(climate_fan_mode_to_string(mode)));
}
for (const auto &mode : traits.get_supported_custom_fan_modes()) {
ESP_LOGCONFIG(TAG, " - %s (c)", mode.c_str());
ESP_LOGCONFIG(TAG, " - %s (c)", mode);
}
ESP_LOGCONFIG(TAG, " Supported presets:");
@@ -56,7 +56,7 @@ void BedJetClimate::dump_config() {
ESP_LOGCONFIG(TAG, " - %s", LOG_STR_ARG(climate_preset_to_string(preset)));
}
for (const auto &preset : traits.get_supported_custom_presets()) {
ESP_LOGCONFIG(TAG, " - %s (c)", preset.c_str());
ESP_LOGCONFIG(TAG, " - %s (c)", preset);
}
}
@@ -79,7 +79,7 @@ void BedJetClimate::reset_state_() {
this->target_temperature = NAN;
this->current_temperature = NAN;
this->preset.reset();
this->custom_preset.reset();
this->clear_custom_preset_();
this->publish_state();
}
@@ -120,7 +120,7 @@ void BedJetClimate::control(const ClimateCall &call) {
if (button_result) {
this->mode = mode;
// We're using (custom) preset for Turbo, EXT HT, & M1-3 presets, so changing climate mode will clear those
this->custom_preset.reset();
this->clear_custom_preset_();
this->preset.reset();
}
}
@@ -144,8 +144,7 @@ void BedJetClimate::control(const ClimateCall &call) {
if (result) {
this->mode = CLIMATE_MODE_HEAT;
this->preset = CLIMATE_PRESET_BOOST;
this->custom_preset.reset();
this->set_preset_(CLIMATE_PRESET_BOOST);
}
} else if (preset == CLIMATE_PRESET_NONE && this->preset.has_value()) {
if (this->mode == CLIMATE_MODE_HEAT && this->preset == CLIMATE_PRESET_BOOST) {
@@ -153,7 +152,7 @@ void BedJetClimate::control(const ClimateCall &call) {
result = this->parent_->send_button(heat_button(this->heating_mode_));
if (result) {
this->preset.reset();
this->custom_preset.reset();
this->clear_custom_preset_();
}
} else {
ESP_LOGD(TAG, "Ignoring preset '%s' call; with current mode '%s' and preset '%s'",
@@ -164,28 +163,27 @@ void BedJetClimate::control(const ClimateCall &call) {
ESP_LOGW(TAG, "Unsupported preset: %d", preset);
return;
}
} else if (call.get_custom_preset().has_value()) {
std::string preset = *call.get_custom_preset();
} else if (call.has_custom_preset()) {
const char *preset = call.get_custom_preset();
bool result;
if (preset == "M1") {
if (strcmp(preset, "M1") == 0) {
result = this->parent_->button_memory1();
} else if (preset == "M2") {
} else if (strcmp(preset, "M2") == 0) {
result = this->parent_->button_memory2();
} else if (preset == "M3") {
} else if (strcmp(preset, "M3") == 0) {
result = this->parent_->button_memory3();
} else if (preset == "LTD HT") {
} else if (strcmp(preset, "LTD HT") == 0) {
result = this->parent_->button_heat();
} else if (preset == "EXT HT") {
} else if (strcmp(preset, "EXT HT") == 0) {
result = this->parent_->button_ext_heat();
} else {
ESP_LOGW(TAG, "Unsupported preset: %s", preset.c_str());
ESP_LOGW(TAG, "Unsupported preset: %s", preset);
return;
}
if (result) {
this->custom_preset = preset;
this->preset.reset();
this->set_custom_preset_(preset);
}
}
@@ -207,19 +205,16 @@ void BedJetClimate::control(const ClimateCall &call) {
}
if (result) {
this->fan_mode = fan_mode;
this->custom_fan_mode.reset();
this->set_fan_mode_(fan_mode);
}
} else if (call.get_custom_fan_mode().has_value()) {
auto fan_mode = *call.get_custom_fan_mode();
} else if (call.has_custom_fan_mode()) {
const char *fan_mode = call.get_custom_fan_mode();
auto fan_index = bedjet_fan_speed_to_step(fan_mode);
if (fan_index <= 19) {
ESP_LOGV(TAG, "[%s] Converted fan mode %s to bedjet fan step %d", this->get_name().c_str(), fan_mode.c_str(),
fan_index);
ESP_LOGV(TAG, "[%s] Converted fan mode %s to bedjet fan step %d", this->get_name().c_str(), fan_mode, fan_index);
bool result = this->parent_->set_fan_index(fan_index);
if (result) {
this->custom_fan_mode = fan_mode;
this->fan_mode.reset();
this->set_custom_fan_mode_(fan_mode);
}
}
}
@@ -245,7 +240,7 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
const auto *fan_mode_name = bedjet_fan_step_to_fan_mode(data->fan_step);
if (fan_mode_name != nullptr) {
this->custom_fan_mode = *fan_mode_name;
this->set_custom_fan_mode_(fan_mode_name);
}
// TODO: Get biorhythm data to determine which preset (M1-3) is running, if any.
@@ -255,7 +250,7 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
this->mode = CLIMATE_MODE_OFF;
this->action = CLIMATE_ACTION_IDLE;
this->fan_mode = CLIMATE_FAN_OFF;
this->custom_preset.reset();
this->clear_custom_preset_();
this->preset.reset();
break;
@@ -266,7 +261,7 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
this->set_custom_preset_("LTD HT");
} else {
this->custom_preset.reset();
this->clear_custom_preset_();
}
break;
@@ -275,7 +270,7 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
this->action = CLIMATE_ACTION_HEATING;
this->preset.reset();
if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
this->custom_preset.reset();
this->clear_custom_preset_();
} else {
this->set_custom_preset_("EXT HT");
}
@@ -284,20 +279,19 @@ void BedJetClimate::on_status(const BedjetStatusPacket *data) {
case MODE_COOL:
this->mode = CLIMATE_MODE_FAN_ONLY;
this->action = CLIMATE_ACTION_COOLING;
this->custom_preset.reset();
this->clear_custom_preset_();
this->preset.reset();
break;
case MODE_DRY:
this->mode = CLIMATE_MODE_DRY;
this->action = CLIMATE_ACTION_DRYING;
this->custom_preset.reset();
this->clear_custom_preset_();
this->preset.reset();
break;
case MODE_TURBO:
this->preset = CLIMATE_PRESET_BOOST;
this->custom_preset.reset();
this->set_preset_(CLIMATE_PRESET_BOOST);
this->mode = CLIMATE_MODE_HEAT;
this->action = CLIMATE_ACTION_HEATING;
break;

View File

@@ -33,8 +33,7 @@ class BedJetClimate : public climate::Climate, public BedJetClient, public Polli
climate::ClimateTraits traits() override {
auto traits = climate::ClimateTraits();
traits.set_supports_action(true);
traits.set_supports_current_temperature(true);
traits.add_feature_flags(climate::CLIMATE_SUPPORTS_ACTION | climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
traits.set_supported_modes({
climate::CLIMATE_MODE_OFF,
climate::CLIMATE_MODE_HEAT,
@@ -44,28 +43,20 @@ class BedJetClimate : public climate::Climate, public BedJetClient, public Polli
});
// It would be better if we had a slider for the fan modes.
traits.set_supported_custom_fan_modes(BEDJET_FAN_STEP_NAMES_SET);
traits.set_supported_custom_fan_modes(BEDJET_FAN_STEP_NAMES);
traits.set_supported_presets({
// If we support NONE, then have to decide what happens if the user switches to it (turn off?)
// climate::CLIMATE_PRESET_NONE,
// Climate doesn't have a "TURBO" mode, but we can use the BOOST preset instead.
climate::CLIMATE_PRESET_BOOST,
});
// String literals are stored in rodata and valid for program lifetime
traits.set_supported_custom_presets({
// We could fetch biodata from bedjet and set these names that way.
// But then we have to invert the lookup in order to send the right preset.
// For now, we can leave them as M1-3 to match the remote buttons.
// EXT HT added to match remote button.
"EXT HT",
this->heating_mode_ == HEAT_MODE_EXTENDED ? "LTD HT" : "EXT HT",
"M1",
"M2",
"M3",
});
if (this->heating_mode_ == HEAT_MODE_EXTENDED) {
traits.add_supported_custom_preset("LTD HT");
} else {
traits.add_supported_custom_preset("EXT HT");
}
traits.set_visual_min_temperature(19.0);
traits.set_visual_max_temperature(43.0);
traits.set_visual_temperature_step(1.0);

View File

View File

@@ -0,0 +1,54 @@
#include "esphome/core/log.h"
#include "bh1900nux.h"
namespace esphome {
namespace bh1900nux {
static const char *const TAG = "bh1900nux.sensor";
// I2C Registers
static const uint8_t TEMPERATURE_REG = 0x00;
static const uint8_t CONFIG_REG = 0x01; // Not used and supported yet
static const uint8_t TEMPERATURE_LOW_REG = 0x02; // Not used and supported yet
static const uint8_t TEMPERATURE_HIGH_REG = 0x03; // Not used and supported yet
static const uint8_t SOFT_RESET_REG = 0x04;
// I2C Command payloads
static const uint8_t SOFT_RESET_PAYLOAD = 0x01; // Soft Reset value
static const float SENSOR_RESOLUTION = 0.0625f; // Sensor resolution per bit in degrees celsius
void BH1900NUXSensor::setup() {
// Initialize I2C device
i2c::ErrorCode result_code =
this->write_register(SOFT_RESET_REG, &SOFT_RESET_PAYLOAD, 1); // Software Reset to check communication
if (result_code != i2c::ERROR_OK) {
this->mark_failed(ESP_LOG_MSG_COMM_FAIL);
return;
}
}
void BH1900NUXSensor::update() {
uint8_t temperature_raw[2];
if (this->read_register(TEMPERATURE_REG, temperature_raw, 2) != i2c::ERROR_OK) {
ESP_LOGE(TAG, ESP_LOG_MSG_COMM_FAIL);
return;
}
// Combined raw value, unsigned and unaligned 16 bit
// Temperature is represented in just 12 bits, shift needed
int16_t raw_temperature_register_value = encode_uint16(temperature_raw[0], temperature_raw[1]);
raw_temperature_register_value >>= 4;
float temperature_value = raw_temperature_register_value * SENSOR_RESOLUTION; // Apply sensor resolution
this->publish_state(temperature_value);
}
void BH1900NUXSensor::dump_config() {
LOG_SENSOR("", "BH1900NUX", this);
LOG_I2C_DEVICE(this);
LOG_UPDATE_INTERVAL(this);
}
} // namespace bh1900nux
} // namespace esphome

View File

@@ -0,0 +1,18 @@
#pragma once
#include "esphome/core/component.h"
#include "esphome/components/sensor/sensor.h"
#include "esphome/components/i2c/i2c.h"
namespace esphome {
namespace bh1900nux {
class BH1900NUXSensor : public sensor::Sensor, public PollingComponent, public i2c::I2CDevice {
public:
void setup() override;
void update() override;
void dump_config() override;
};
} // namespace bh1900nux
} // namespace esphome

View File

@@ -0,0 +1,34 @@
import esphome.codegen as cg
from esphome.components import i2c, sensor
import esphome.config_validation as cv
from esphome.const import (
DEVICE_CLASS_TEMPERATURE,
STATE_CLASS_MEASUREMENT,
UNIT_CELSIUS,
)
DEPENDENCIES = ["i2c"]
CODEOWNERS = ["@B48D81EFCC"]
sensor_ns = cg.esphome_ns.namespace("bh1900nux")
BH1900NUXSensor = sensor_ns.class_(
"BH1900NUXSensor", cg.PollingComponent, i2c.I2CDevice
)
CONFIG_SCHEMA = (
sensor.sensor_schema(
BH1900NUXSensor,
accuracy_decimals=1,
unit_of_measurement=UNIT_CELSIUS,
device_class=DEVICE_CLASS_TEMPERATURE,
state_class=STATE_CLASS_MEASUREMENT,
)
.extend(cv.polling_component_schema("60s"))
.extend(i2c.i2c_device_schema(0x48))
)
async def to_code(config):
var = await sensor.new_sensor(config)
await cg.register_component(var, config)
await i2c.register_i2c_device(var, config)

View File

@@ -155,6 +155,7 @@ DelayedOffFilter = binary_sensor_ns.class_("DelayedOffFilter", Filter, cg.Compon
InvertFilter = binary_sensor_ns.class_("InvertFilter", Filter)
AutorepeatFilter = binary_sensor_ns.class_("AutorepeatFilter", Filter, cg.Component)
LambdaFilter = binary_sensor_ns.class_("LambdaFilter", Filter)
StatelessLambdaFilter = binary_sensor_ns.class_("StatelessLambdaFilter", Filter)
SettleFilter = binary_sensor_ns.class_("SettleFilter", Filter, cg.Component)
_LOGGER = getLogger(__name__)
@@ -264,20 +265,31 @@ async def delayed_off_filter_to_code(config, filter_id):
),
)
async def autorepeat_filter_to_code(config, filter_id):
timings = []
if len(config) > 0:
timings.extend(
(conf[CONF_DELAY], conf[CONF_TIME_OFF], conf[CONF_TIME_ON])
for conf in config
)
else:
timings.append(
(
cv.time_period_str_unit(DEFAULT_DELAY).total_milliseconds,
cv.time_period_str_unit(DEFAULT_TIME_OFF).total_milliseconds,
cv.time_period_str_unit(DEFAULT_TIME_ON).total_milliseconds,
timings = [
cg.StructInitializer(
cg.MockObj("AutorepeatFilterTiming", "esphome::binary_sensor::"),
("delay", conf[CONF_DELAY]),
("time_off", conf[CONF_TIME_OFF]),
("time_on", conf[CONF_TIME_ON]),
)
)
for conf in config
]
else:
timings = [
cg.StructInitializer(
cg.MockObj("AutorepeatFilterTiming", "esphome::binary_sensor::"),
("delay", cv.time_period_str_unit(DEFAULT_DELAY).total_milliseconds),
(
"time_off",
cv.time_period_str_unit(DEFAULT_TIME_OFF).total_milliseconds,
),
(
"time_on",
cv.time_period_str_unit(DEFAULT_TIME_ON).total_milliseconds,
),
)
]
var = cg.new_Pvariable(filter_id, timings)
await cg.register_component(var, {})
return var
@@ -288,7 +300,7 @@ async def lambda_filter_to_code(config, filter_id):
lambda_ = await cg.process_lambda(
config, [(bool, "x")], return_type=cg.optional.template(bool)
)
return cg.new_Pvariable(filter_id, lambda_)
return automation.new_lambda_pvariable(filter_id, lambda_, StatelessLambdaFilter)
@register_filter(
@@ -536,11 +548,6 @@ def binary_sensor_schema(
return _BINARY_SENSOR_SCHEMA.extend(schema)
# Remove before 2025.11.0
BINARY_SENSOR_SCHEMA = binary_sensor_schema()
BINARY_SENSOR_SCHEMA.add_extra(cv.deprecated_schema_constant("binary_sensor"))
async def setup_binary_sensor_core_(var, config):
await setup_entity(var, config, "binary_sensor")

View File

@@ -2,11 +2,11 @@
#include <cinttypes>
#include <utility>
#include <vector>
#include "esphome/core/component.h"
#include "esphome/core/automation.h"
#include "esphome/core/hal.h"
#include "esphome/core/helpers.h"
#include "esphome/components/binary_sensor/binary_sensor.h"
namespace esphome {
@@ -92,8 +92,8 @@ class DoubleClickTrigger : public Trigger<> {
class MultiClickTrigger : public Trigger<>, public Component {
public:
explicit MultiClickTrigger(BinarySensor *parent, std::vector<MultiClickTriggerEvent> timing)
: parent_(parent), timing_(std::move(timing)) {}
explicit MultiClickTrigger(BinarySensor *parent, std::initializer_list<MultiClickTriggerEvent> timing)
: parent_(parent), timing_(timing) {}
void setup() override {
this->last_state_ = this->parent_->get_state_default(false);
@@ -115,7 +115,7 @@ class MultiClickTrigger : public Trigger<>, public Component {
void trigger_();
BinarySensor *parent_;
std::vector<MultiClickTriggerEvent> timing_;
FixedVector<MultiClickTriggerEvent> timing_;
uint32_t invalid_cooldown_{1000};
optional<size_t> at_index_{};
bool last_state_{false};

View File

@@ -51,7 +51,7 @@ void BinarySensor::add_filter(Filter *filter) {
last_filter->next_ = filter;
}
}
void BinarySensor::add_filters(const std::vector<Filter *> &filters) {
void BinarySensor::add_filters(std::initializer_list<Filter *> filters) {
for (Filter *filter : filters) {
this->add_filter(filter);
}

View File

@@ -4,7 +4,7 @@
#include "esphome/core/helpers.h"
#include "esphome/components/binary_sensor/filter.h"
#include <vector>
#include <initializer_list>
namespace esphome {
@@ -48,7 +48,7 @@ class BinarySensor : public StatefulEntityBase<bool>, public EntityBase_DeviceCl
void publish_initial_state(bool new_state);
void add_filter(Filter *filter);
void add_filters(const std::vector<Filter *> &filters);
void add_filters(std::initializer_list<Filter *> filters);
// ========== INTERNAL METHODS ==========
// (In most use cases you won't need these)

View File

@@ -1,7 +1,6 @@
#include "filter.h"
#include "binary_sensor.h"
#include <utility>
namespace esphome {
@@ -68,7 +67,7 @@ float DelayedOffFilter::get_setup_priority() const { return setup_priority::HARD
optional<bool> InvertFilter::new_value(bool value) { return !value; }
AutorepeatFilter::AutorepeatFilter(std::vector<AutorepeatFilterTiming> timings) : timings_(std::move(timings)) {}
AutorepeatFilter::AutorepeatFilter(std::initializer_list<AutorepeatFilterTiming> timings) : timings_(timings) {}
optional<bool> AutorepeatFilter::new_value(bool value) {
if (value) {

View File

@@ -4,8 +4,6 @@
#include "esphome/core/component.h"
#include "esphome/core/helpers.h"
#include <vector>
namespace esphome {
namespace binary_sensor {
@@ -82,11 +80,6 @@ class InvertFilter : public Filter {
};
struct AutorepeatFilterTiming {
AutorepeatFilterTiming(uint32_t delay, uint32_t off, uint32_t on) {
this->delay = delay;
this->time_off = off;
this->time_on = on;
}
uint32_t delay;
uint32_t time_off;
uint32_t time_on;
@@ -94,7 +87,7 @@ struct AutorepeatFilterTiming {
class AutorepeatFilter : public Filter, public Component {
public:
explicit AutorepeatFilter(std::vector<AutorepeatFilterTiming> timings);
explicit AutorepeatFilter(std::initializer_list<AutorepeatFilterTiming> timings);
optional<bool> new_value(bool value) override;
@@ -104,7 +97,7 @@ class AutorepeatFilter : public Filter, public Component {
void next_timing_();
void next_value_(bool val);
std::vector<AutorepeatFilterTiming> timings_;
FixedVector<AutorepeatFilterTiming> timings_;
uint8_t active_timing_{0};
};
@@ -118,6 +111,21 @@ class LambdaFilter : public Filter {
std::function<optional<bool>(bool)> f_;
};
/** Optimized lambda filter for stateless lambdas (no capture).
*
* Uses function pointer instead of std::function to reduce memory overhead.
* Memory: 4 bytes (function pointer on 32-bit) vs 32 bytes (std::function).
*/
class StatelessLambdaFilter : public Filter {
public:
explicit StatelessLambdaFilter(optional<bool> (*f)(bool)) : f_(f) {}
optional<bool> new_value(bool value) override { return this->f_(value); }
protected:
optional<bool> (*f_)(bool);
};
class SettleFilter : public Filter, public Component {
public:
optional<bool> new_value(bool value) override;

View File

@@ -97,10 +97,10 @@ void BL0906::handle_actions_() {
return;
}
ActionCallbackFuncPtr ptr_func = nullptr;
for (int i = 0; i < this->action_queue_.size(); i++) {
for (size_t i = 0; i < this->action_queue_.size(); i++) {
ptr_func = this->action_queue_[i];
if (ptr_func) {
ESP_LOGI(TAG, "HandleActionCallback[%d]", i);
ESP_LOGI(TAG, "HandleActionCallback[%zu]", i);
(this->*ptr_func)();
}
}

View File

@@ -51,7 +51,7 @@ void BL0942::loop() {
if (!avail) {
return;
}
if (avail < sizeof(buffer)) {
if (static_cast<size_t>(avail) < sizeof(buffer)) {
if (!this->rx_start_) {
this->rx_start_ = millis();
} else if (millis() > this->rx_start_ + PKT_TIMEOUT_MS) {
@@ -148,7 +148,7 @@ void BL0942::setup() {
this->write_reg_(BL0942_REG_USR_WRPROT, 0);
if (this->read_reg_(BL0942_REG_MODE) != mode)
if (static_cast<uint32_t>(this->read_reg_(BL0942_REG_MODE)) != mode)
this->status_set_warning(LOG_STR("BL0942 setup failed!"));
this->flush();

View File

@@ -116,7 +116,7 @@ CONFIG_SCHEMA = cv.All(
)
.extend(cv.COMPONENT_SCHEMA)
.extend(esp32_ble_tracker.ESP_BLE_DEVICE_SCHEMA),
esp32_ble_tracker.consume_connection_slots(1, "ble_client"),
esp32_ble.consume_connection_slots(1, "ble_client"),
)
CONF_BLE_CLIENT_ID = "ble_client_id"

View File

@@ -96,8 +96,11 @@ template<typename... Ts> class BLEClientWriteAction : public Action<Ts...>, publ
BLEClientWriteAction(BLEClient *ble_client) {
ble_client->register_ble_node(this);
ble_client_ = ble_client;
this->construct_simple_value_();
}
~BLEClientWriteAction() { this->destroy_simple_value_(); }
void set_service_uuid16(uint16_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
void set_service_uuid32(uint32_t uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
void set_service_uuid128(uint8_t *uuid) { this->service_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
@@ -106,14 +109,18 @@ template<typename... Ts> class BLEClientWriteAction : public Action<Ts...>, publ
void set_char_uuid32(uint32_t uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
void set_char_uuid128(uint8_t *uuid) { this->char_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
void set_value_template(std::function<std::vector<uint8_t>(Ts...)> func) {
this->value_template_ = std::move(func);
has_simple_value_ = false;
void set_value_template(std::vector<uint8_t> (*func)(Ts...)) {
this->destroy_simple_value_();
this->value_.template_func = func;
this->has_simple_value_ = false;
}
void set_value_simple(const std::vector<uint8_t> &value) {
this->value_simple_ = value;
has_simple_value_ = true;
if (!this->has_simple_value_) {
this->construct_simple_value_();
}
this->value_.simple = value;
this->has_simple_value_ = true;
}
void play(Ts... x) override {}
@@ -121,7 +128,7 @@ template<typename... Ts> class BLEClientWriteAction : public Action<Ts...>, publ
void play_complex(Ts... x) override {
this->num_running_++;
this->var_ = std::make_tuple(x...);
auto value = this->has_simple_value_ ? this->value_simple_ : this->value_template_(x...);
auto value = this->has_simple_value_ ? this->value_.simple : this->value_.template_func(x...);
// on write failure, continue the automation chain rather than stopping so that e.g. disconnect can work.
if (!write(value))
this->play_next_(x...);
@@ -194,10 +201,22 @@ template<typename... Ts> class BLEClientWriteAction : public Action<Ts...>, publ
}
private:
void construct_simple_value_() { new (&this->value_.simple) std::vector<uint8_t>(); }
void destroy_simple_value_() {
if (this->has_simple_value_) {
this->value_.simple.~vector();
}
}
BLEClient *ble_client_;
bool has_simple_value_ = true;
std::vector<uint8_t> value_simple_;
std::function<std::vector<uint8_t>(Ts...)> value_template_{};
union Value {
std::vector<uint8_t> simple;
std::vector<uint8_t> (*template_func)(Ts...);
Value() {} // trivial constructor
~Value() {} // trivial destructor - we manage lifetime via discriminator
} value_;
espbt::ESPBTUUID service_uuid_;
espbt::ESPBTUUID char_uuid_;
std::tuple<Ts...> var_{};
@@ -213,9 +232,9 @@ template<typename... Ts> class BLEClientPasskeyReplyAction : public Action<Ts...
void play(Ts... x) override {
uint32_t passkey;
if (has_simple_value_) {
passkey = this->value_simple_;
passkey = this->value_.simple;
} else {
passkey = this->value_template_(x...);
passkey = this->value_.template_func(x...);
}
if (passkey > 999999)
return;
@@ -224,21 +243,23 @@ template<typename... Ts> class BLEClientPasskeyReplyAction : public Action<Ts...
esp_ble_passkey_reply(remote_bda, true, passkey);
}
void set_value_template(std::function<uint32_t(Ts...)> func) {
this->value_template_ = std::move(func);
has_simple_value_ = false;
void set_value_template(uint32_t (*func)(Ts...)) {
this->value_.template_func = func;
this->has_simple_value_ = false;
}
void set_value_simple(const uint32_t &value) {
this->value_simple_ = value;
has_simple_value_ = true;
this->value_.simple = value;
this->has_simple_value_ = true;
}
private:
BLEClient *parent_{nullptr};
bool has_simple_value_ = true;
uint32_t value_simple_{0};
std::function<uint32_t(Ts...)> value_template_{};
union {
uint32_t simple;
uint32_t (*template_func)(Ts...);
} value_{.simple = 0};
};
template<typename... Ts> class BLEClientNumericComparisonReplyAction : public Action<Ts...> {
@@ -249,27 +270,29 @@ template<typename... Ts> class BLEClientNumericComparisonReplyAction : public Ac
esp_bd_addr_t remote_bda;
memcpy(remote_bda, parent_->get_remote_bda(), sizeof(esp_bd_addr_t));
if (has_simple_value_) {
esp_ble_confirm_reply(remote_bda, this->value_simple_);
esp_ble_confirm_reply(remote_bda, this->value_.simple);
} else {
esp_ble_confirm_reply(remote_bda, this->value_template_(x...));
esp_ble_confirm_reply(remote_bda, this->value_.template_func(x...));
}
}
void set_value_template(std::function<bool(Ts...)> func) {
this->value_template_ = std::move(func);
has_simple_value_ = false;
void set_value_template(bool (*func)(Ts...)) {
this->value_.template_func = func;
this->has_simple_value_ = false;
}
void set_value_simple(const bool &value) {
this->value_simple_ = value;
has_simple_value_ = true;
this->value_.simple = value;
this->has_simple_value_ = true;
}
private:
BLEClient *parent_{nullptr};
bool has_simple_value_ = true;
bool value_simple_{false};
std::function<bool(Ts...)> value_template_{};
union {
bool simple;
bool (*template_func)(Ts...);
} value_{.simple = false};
};
template<typename... Ts> class BLEClientRemoveBondAction : public Action<Ts...> {

View File

@@ -77,6 +77,9 @@ void BLESensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t ga
}
} else {
this->node_state = espbt::ClientState::ESTABLISHED;
// For non-notify characteristics, trigger an immediate read after service discovery
// to avoid peripherals disconnecting due to inactivity
this->update();
}
break;
}
@@ -117,9 +120,9 @@ void BLESensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t ga
}
float BLESensor::parse_data_(uint8_t *value, uint16_t value_len) {
if (this->data_to_value_func_.has_value()) {
if (this->has_data_to_value_) {
std::vector<uint8_t> data(value, value + value_len);
return (*this->data_to_value_func_)(data);
return this->data_to_value_func_(data);
} else {
return value[0];
}

View File

@@ -15,8 +15,6 @@ namespace ble_client {
namespace espbt = esphome::esp32_ble_tracker;
using data_to_value_t = std::function<float(std::vector<uint8_t>)>;
class BLESensor : public sensor::Sensor, public PollingComponent, public BLEClientNode {
public:
void loop() override;
@@ -33,13 +31,17 @@ class BLESensor : public sensor::Sensor, public PollingComponent, public BLEClie
void set_descr_uuid16(uint16_t uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_uint16(uuid); }
void set_descr_uuid32(uint32_t uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_uint32(uuid); }
void set_descr_uuid128(uint8_t *uuid) { this->descr_uuid_ = espbt::ESPBTUUID::from_raw(uuid); }
void set_data_to_value(data_to_value_t &&lambda) { this->data_to_value_func_ = lambda; }
void set_data_to_value(float (*lambda)(const std::vector<uint8_t> &)) {
this->data_to_value_func_ = lambda;
this->has_data_to_value_ = true;
}
void set_enable_notify(bool notify) { this->notify_ = notify; }
uint16_t handle;
protected:
float parse_data_(uint8_t *value, uint16_t value_len);
optional<data_to_value_t> data_to_value_func_{};
bool has_data_to_value_{false};
float (*data_to_value_func_)(const std::vector<uint8_t> &){};
bool notify_;
espbt::ESPBTUUID service_uuid_;
espbt::ESPBTUUID char_uuid_;

View File

@@ -79,6 +79,9 @@ void BLETextSensor::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_
}
} else {
this->node_state = espbt::ClientState::ESTABLISHED;
// For non-notify characteristics, trigger an immediate read after service discovery
// to avoid peripherals disconnecting due to inactivity
this->update();
}
break;
}

View File

@@ -0,0 +1,29 @@
import esphome.codegen as cg
from esphome.components.zephyr import zephyr_add_prj_conf
import esphome.config_validation as cv
from esphome.const import CONF_ID, CONF_LOGS, CONF_TYPE
AUTO_LOAD = ["zephyr_ble_server"]
CODEOWNERS = ["@tomaszduda23"]
ble_nus_ns = cg.esphome_ns.namespace("ble_nus")
BLENUS = ble_nus_ns.class_("BLENUS", cg.Component)
CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(BLENUS),
cv.Optional(CONF_TYPE, default=CONF_LOGS): cv.one_of(
*[CONF_LOGS], lower=True
),
}
).extend(cv.COMPONENT_SCHEMA),
cv.only_with_framework("zephyr"),
)
async def to_code(config):
var = cg.new_Pvariable(config[CONF_ID])
zephyr_add_prj_conf("BT_NUS", True)
cg.add(var.set_expose_log(config[CONF_TYPE] == CONF_LOGS))
await cg.register_component(var, config)

View File

@@ -0,0 +1,157 @@
#ifdef USE_ZEPHYR
#include "ble_nus.h"
#include <zephyr/kernel.h>
#include <bluetooth/services/nus.h>
#include "esphome/core/log.h"
#ifdef USE_LOGGER
#include "esphome/components/logger/logger.h"
#include "esphome/core/application.h"
#endif
#include <zephyr/sys/ring_buffer.h>
namespace esphome::ble_nus {
constexpr size_t BLE_TX_BUF_SIZE = 2048;
// NOLINTBEGIN(cppcoreguidelines-avoid-non-const-global-variables)
BLENUS *global_ble_nus;
RING_BUF_DECLARE(global_ble_tx_ring_buf, BLE_TX_BUF_SIZE);
// NOLINTEND(cppcoreguidelines-avoid-non-const-global-variables)
static const char *const TAG = "ble_nus";
size_t BLENUS::write_array(const uint8_t *data, size_t len) {
if (atomic_get(&this->tx_status_) == TX_DISABLED) {
return 0;
}
return ring_buf_put(&global_ble_tx_ring_buf, data, len);
}
void BLENUS::connected(bt_conn *conn, uint8_t err) {
if (err == 0) {
global_ble_nus->conn_.store(bt_conn_ref(conn));
}
}
void BLENUS::disconnected(bt_conn *conn, uint8_t reason) {
if (global_ble_nus->conn_) {
bt_conn_unref(global_ble_nus->conn_.load());
// Connection array is global static.
// Reference can be kept even if disconnected.
}
}
void BLENUS::tx_callback(bt_conn *conn) {
atomic_cas(&global_ble_nus->tx_status_, TX_BUSY, TX_ENABLED);
ESP_LOGVV(TAG, "Sent operation completed");
}
void BLENUS::send_enabled_callback(bt_nus_send_status status) {
switch (status) {
case BT_NUS_SEND_STATUS_ENABLED:
atomic_set(&global_ble_nus->tx_status_, TX_ENABLED);
#ifdef USE_LOGGER
if (global_ble_nus->expose_log_) {
App.schedule_dump_config();
}
#endif
ESP_LOGD(TAG, "NUS notification has been enabled");
break;
case BT_NUS_SEND_STATUS_DISABLED:
atomic_set(&global_ble_nus->tx_status_, TX_DISABLED);
ESP_LOGD(TAG, "NUS notification has been disabled");
break;
}
}
void BLENUS::rx_callback(bt_conn *conn, const uint8_t *const data, uint16_t len) {
ESP_LOGD(TAG, "Received %d bytes.", len);
}
void BLENUS::setup() {
bt_nus_cb callbacks = {
.received = rx_callback,
.sent = tx_callback,
.send_enabled = send_enabled_callback,
};
bt_nus_init(&callbacks);
static bt_conn_cb conn_callbacks = {
.connected = BLENUS::connected,
.disconnected = BLENUS::disconnected,
};
bt_conn_cb_register(&conn_callbacks);
global_ble_nus = this;
#ifdef USE_LOGGER
if (logger::global_logger != nullptr && this->expose_log_) {
logger::global_logger->add_on_log_callback(
[this](int level, const char *tag, const char *message, size_t message_len) {
this->write_array(reinterpret_cast<const uint8_t *>(message), message_len);
const char c = '\n';
this->write_array(reinterpret_cast<const uint8_t *>(&c), 1);
});
}
#endif
}
void BLENUS::dump_config() {
ESP_LOGCONFIG(TAG, "ble nus:");
ESP_LOGCONFIG(TAG, " log: %s", YESNO(this->expose_log_));
uint32_t mtu = 0;
bt_conn *conn = this->conn_.load();
if (conn) {
mtu = bt_nus_get_mtu(conn);
}
ESP_LOGCONFIG(TAG, " MTU: %u", mtu);
}
void BLENUS::loop() {
if (ring_buf_is_empty(&global_ble_tx_ring_buf)) {
return;
}
if (!atomic_cas(&this->tx_status_, TX_ENABLED, TX_BUSY)) {
if (atomic_get(&this->tx_status_) == TX_DISABLED) {
ring_buf_reset(&global_ble_tx_ring_buf);
}
return;
}
bt_conn *conn = this->conn_.load();
if (conn) {
conn = bt_conn_ref(conn);
}
if (nullptr == conn) {
atomic_cas(&this->tx_status_, TX_BUSY, TX_ENABLED);
return;
}
uint32_t req_len = bt_nus_get_mtu(conn);
uint8_t *buf;
uint32_t size = ring_buf_get_claim(&global_ble_tx_ring_buf, &buf, req_len);
int err, err2;
err = bt_nus_send(conn, buf, size);
err2 = ring_buf_get_finish(&global_ble_tx_ring_buf, size);
if (err2) {
// It should no happen.
ESP_LOGE(TAG, "Size %u exceeds valid bytes in the ring buffer (%d error)", size, err2);
}
if (err == 0) {
ESP_LOGVV(TAG, "Sent %d bytes", size);
} else {
ESP_LOGE(TAG, "Failed to send %d bytes (%d error)", size, err);
atomic_cas(&this->tx_status_, TX_BUSY, TX_ENABLED);
}
bt_conn_unref(conn);
}
} // namespace esphome::ble_nus
#endif

View File

@@ -0,0 +1,37 @@
#pragma once
#ifdef USE_ZEPHYR
#include "esphome/core/defines.h"
#include "esphome/core/component.h"
#include <shell/shell_bt_nus.h>
#include <atomic>
namespace esphome::ble_nus {
class BLENUS : public Component {
enum TxStatus {
TX_DISABLED,
TX_ENABLED,
TX_BUSY,
};
public:
void setup() override;
void dump_config() override;
void loop() override;
size_t write_array(const uint8_t *data, size_t len);
void set_expose_log(bool expose_log) { this->expose_log_ = expose_log; }
protected:
static void send_enabled_callback(bt_nus_send_status status);
static void tx_callback(bt_conn *conn);
static void rx_callback(bt_conn *conn, const uint8_t *data, uint16_t len);
static void connected(bt_conn *conn, uint8_t err);
static void disconnected(bt_conn *conn, uint8_t reason);
std::atomic<bt_conn *> conn_ = nullptr;
bool expose_log_ = false;
atomic_t tx_status_ = ATOMIC_INIT(TX_DISABLED);
};
} // namespace esphome::ble_nus
#endif

View File

@@ -42,9 +42,7 @@ def validate_connections(config):
)
elif config[CONF_ACTIVE]:
connection_slots: int = config[CONF_CONNECTION_SLOTS]
esp32_ble_tracker.consume_connection_slots(connection_slots, "bluetooth_proxy")(
config
)
esp32_ble.consume_connection_slots(connection_slots, "bluetooth_proxy")(config)
return {
**config,
@@ -65,11 +63,11 @@ CONFIG_SCHEMA = cv.All(
default=DEFAULT_CONNECTION_SLOTS,
): cv.All(
cv.positive_int,
cv.Range(min=1, max=esp32_ble_tracker.IDF_MAX_CONNECTIONS),
cv.Range(min=1, max=esp32_ble.IDF_MAX_CONNECTIONS),
),
cv.Optional(CONF_CONNECTIONS): cv.All(
cv.ensure_list(CONNECTION_SCHEMA),
cv.Length(min=1, max=esp32_ble_tracker.IDF_MAX_CONNECTIONS),
cv.Length(min=1, max=esp32_ble.IDF_MAX_CONNECTIONS),
),
}
)

View File

@@ -230,8 +230,8 @@ void BluetoothConnection::send_service_for_discovery_() {
service_resp.handle = service_result.start_handle;
if (total_char_count > 0) {
// Reserve space and process characteristics
service_resp.characteristics.reserve(total_char_count);
// Initialize FixedVector with exact count and process characteristics
service_resp.characteristics.init(total_char_count);
uint16_t char_offset = 0;
esp_gattc_char_elem_t char_result;
while (true) { // characteristics
@@ -253,9 +253,7 @@ void BluetoothConnection::send_service_for_discovery_() {
service_resp.characteristics.emplace_back();
auto &characteristic_resp = service_resp.characteristics.back();
fill_gatt_uuid(characteristic_resp.uuid, characteristic_resp.short_uuid, char_result.uuid, use_efficient_uuids);
characteristic_resp.handle = char_result.char_handle;
characteristic_resp.properties = char_result.properties;
char_offset++;
@@ -271,12 +269,11 @@ void BluetoothConnection::send_service_for_discovery_() {
return;
}
if (total_desc_count == 0) {
// No descriptors, continue to next characteristic
continue;
}
// Reserve space and process descriptors
characteristic_resp.descriptors.reserve(total_desc_count);
// Initialize FixedVector with exact count and process descriptors
characteristic_resp.descriptors.init(total_desc_count);
uint16_t desc_offset = 0;
esp_gattc_descr_elem_t desc_result;
while (true) { // descriptors
@@ -297,9 +294,7 @@ void BluetoothConnection::send_service_for_discovery_() {
characteristic_resp.descriptors.emplace_back();
auto &descriptor_resp = characteristic_resp.descriptors.back();
fill_gatt_uuid(descriptor_resp.uuid, descriptor_resp.short_uuid, desc_result.uuid, use_efficient_uuids);
descriptor_resp.handle = desc_result.handle;
desc_offset++;
}

View File

@@ -155,16 +155,12 @@ esp32_ble_tracker::AdvertisementParserType BluetoothProxy::get_advertisement_par
BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool reserve) {
for (uint8_t i = 0; i < this->connection_count_; i++) {
auto *connection = this->connections_[i];
if (connection->get_address() == address)
uint64_t conn_addr = connection->get_address();
if (conn_addr == address)
return connection;
}
if (!reserve)
return nullptr;
for (uint8_t i = 0; i < this->connection_count_; i++) {
auto *connection = this->connections_[i];
if (connection->get_address() == 0) {
if (reserve && conn_addr == 0) {
connection->send_service_ = INIT_SENDING_SERVICES;
connection->set_address(address);
// All connections must start at INIT
@@ -175,7 +171,6 @@ BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool rese
return connection;
}
}
return nullptr;
}

View File

@@ -16,7 +16,9 @@
#include "bluetooth_connection.h"
#ifndef CONFIG_ESP_HOSTED_ENABLE_BT_BLUEDROID
#include <esp_bt.h>
#endif
#include <esp_bt_device.h>
namespace esphome::bluetooth_proxy {

View File

@@ -41,7 +41,7 @@ CONFIG_SCHEMA = cv.All(
cv.Schema(
{
cv.GenerateID(): cv.declare_id(BME680BSECComponent),
cv.Optional(CONF_TEMPERATURE_OFFSET, default=0): cv.temperature,
cv.Optional(CONF_TEMPERATURE_OFFSET, default=0): cv.temperature_delta,
cv.Optional(CONF_IAQ_MODE, default="STATIC"): cv.enum(
IAQ_MODE_OPTIONS, upper=True
),

View File

@@ -139,7 +139,7 @@ CONFIG_SCHEMA_BASE = (
cv.Optional(CONF_SUPPLY_VOLTAGE, default="3.3V"): cv.enum(
VOLTAGE_OPTIONS, upper=True
),
cv.Optional(CONF_TEMPERATURE_OFFSET, default=0): cv.temperature,
cv.Optional(CONF_TEMPERATURE_OFFSET, default=0): cv.temperature_delta,
cv.Optional(
CONF_STATE_SAVE_INTERVAL, default="6hours"
): cv.positive_time_period_minutes,

View File

@@ -84,11 +84,6 @@ def button_schema(
return _BUTTON_SCHEMA.extend(schema)
# Remove before 2025.11.0
BUTTON_SCHEMA = button_schema(Button)
BUTTON_SCHEMA.add_extra(cv.deprecated_schema_constant("button"))
async def setup_button_core_(var, config):
await setup_entity(var, config, "button")

View File

@@ -105,9 +105,9 @@ class Canbus : public Component {
CallbackManager<void(uint32_t can_id, bool extended_id, bool rtr, const std::vector<uint8_t> &data)>
callback_manager_{};
virtual bool setup_internal();
virtual Error send_message(struct CanFrame *frame);
virtual Error read_message(struct CanFrame *frame);
virtual bool setup_internal() = 0;
virtual Error send_message(struct CanFrame *frame) = 0;
virtual Error read_message(struct CanFrame *frame) = 0;
};
template<typename... Ts> class CanbusSendAction : public Action<Ts...>, public Parented<Canbus> {

View File

@@ -8,17 +8,30 @@ namespace cap1188 {
static const char *const TAG = "cap1188";
void CAP1188Component::setup() {
// Reset device using the reset pin
if (this->reset_pin_ != nullptr) {
this->reset_pin_->setup();
this->reset_pin_->digital_write(false);
delay(100); // NOLINT
this->reset_pin_->digital_write(true);
delay(100); // NOLINT
this->reset_pin_->digital_write(false);
delay(100); // NOLINT
this->disable_loop();
// no reset pin
if (this->reset_pin_ == nullptr) {
this->finish_setup_();
return;
}
// reset pin configured so reset before finishing setup
this->reset_pin_->setup();
this->reset_pin_->digital_write(false);
// delay after reset pin write
this->set_timeout(100, [this]() {
this->reset_pin_->digital_write(true);
// delay after reset pin write
this->set_timeout(100, [this]() {
this->reset_pin_->digital_write(false);
// delay after reset pin write
this->set_timeout(100, [this]() { this->finish_setup_(); });
});
});
}
void CAP1188Component::finish_setup_() {
// Check if CAP1188 is actually connected
this->read_byte(CAP1188_PRODUCT_ID, &this->cap1188_product_id_);
this->read_byte(CAP1188_MANUFACTURE_ID, &this->cap1188_manufacture_id_);
@@ -44,6 +57,9 @@ void CAP1188Component::setup() {
// Speed up a bit
this->write_byte(CAP1188_STAND_BY_CONFIGURATION, 0x30);
// Setup successful, so enable loop
this->enable_loop();
}
void CAP1188Component::dump_config() {

View File

@@ -49,6 +49,8 @@ class CAP1188Component : public Component, public i2c::I2CDevice {
void loop() override;
protected:
void finish_setup_();
std::vector<CAP1188Channel *> channels_{};
uint8_t touch_threshold_{0x20};
uint8_t allow_multiple_touches_{0x80};

View File

@@ -270,11 +270,6 @@ def climate_schema(
return _CLIMATE_SCHEMA.extend(schema)
# Remove before 2025.11.0
CLIMATE_SCHEMA = climate_schema(Climate)
CLIMATE_SCHEMA.add_extra(cv.deprecated_schema_constant("climate"))
async def setup_climate_core_(var, config):
await setup_entity(var, config, "climate")

View File

@@ -6,6 +6,42 @@ namespace climate {
static const char *const TAG = "climate";
// Memory-efficient lookup tables
struct StringToUint8 {
const char *str;
const uint8_t value;
};
constexpr StringToUint8 CLIMATE_MODES_BY_STR[] = {
{"OFF", CLIMATE_MODE_OFF},
{"AUTO", CLIMATE_MODE_AUTO},
{"COOL", CLIMATE_MODE_COOL},
{"HEAT", CLIMATE_MODE_HEAT},
{"FAN_ONLY", CLIMATE_MODE_FAN_ONLY},
{"DRY", CLIMATE_MODE_DRY},
{"HEAT_COOL", CLIMATE_MODE_HEAT_COOL},
};
constexpr StringToUint8 CLIMATE_FAN_MODES_BY_STR[] = {
{"ON", CLIMATE_FAN_ON}, {"OFF", CLIMATE_FAN_OFF}, {"AUTO", CLIMATE_FAN_AUTO},
{"LOW", CLIMATE_FAN_LOW}, {"MEDIUM", CLIMATE_FAN_MEDIUM}, {"HIGH", CLIMATE_FAN_HIGH},
{"MIDDLE", CLIMATE_FAN_MIDDLE}, {"FOCUS", CLIMATE_FAN_FOCUS}, {"DIFFUSE", CLIMATE_FAN_DIFFUSE},
{"QUIET", CLIMATE_FAN_QUIET},
};
constexpr StringToUint8 CLIMATE_PRESETS_BY_STR[] = {
{"ECO", CLIMATE_PRESET_ECO}, {"AWAY", CLIMATE_PRESET_AWAY}, {"BOOST", CLIMATE_PRESET_BOOST},
{"COMFORT", CLIMATE_PRESET_COMFORT}, {"HOME", CLIMATE_PRESET_HOME}, {"SLEEP", CLIMATE_PRESET_SLEEP},
{"ACTIVITY", CLIMATE_PRESET_ACTIVITY}, {"NONE", CLIMATE_PRESET_NONE},
};
constexpr StringToUint8 CLIMATE_SWING_MODES_BY_STR[] = {
{"OFF", CLIMATE_SWING_OFF},
{"BOTH", CLIMATE_SWING_BOTH},
{"VERTICAL", CLIMATE_SWING_VERTICAL},
{"HORIZONTAL", CLIMATE_SWING_HORIZONTAL},
};
void ClimateCall::perform() {
this->parent_->control_callback_.call(*this);
ESP_LOGD(TAG, "'%s' - Setting", this->parent_->get_name().c_str());
@@ -14,21 +50,21 @@ void ClimateCall::perform() {
const LogString *mode_s = climate_mode_to_string(*this->mode_);
ESP_LOGD(TAG, " Mode: %s", LOG_STR_ARG(mode_s));
}
if (this->custom_fan_mode_.has_value()) {
if (this->custom_fan_mode_ != nullptr) {
this->fan_mode_.reset();
ESP_LOGD(TAG, " Custom Fan: %s", this->custom_fan_mode_.value().c_str());
ESP_LOGD(TAG, " Custom Fan: %s", this->custom_fan_mode_);
}
if (this->fan_mode_.has_value()) {
this->custom_fan_mode_.reset();
this->custom_fan_mode_ = nullptr;
const LogString *fan_mode_s = climate_fan_mode_to_string(*this->fan_mode_);
ESP_LOGD(TAG, " Fan: %s", LOG_STR_ARG(fan_mode_s));
}
if (this->custom_preset_.has_value()) {
if (this->custom_preset_ != nullptr) {
this->preset_.reset();
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset_.value().c_str());
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset_);
}
if (this->preset_.has_value()) {
this->custom_preset_.reset();
this->custom_preset_ = nullptr;
const LogString *preset_s = climate_preset_to_string(*this->preset_);
ESP_LOGD(TAG, " Preset: %s", LOG_STR_ARG(preset_s));
}
@@ -50,206 +86,179 @@ void ClimateCall::perform() {
}
this->parent_->control(*this);
}
void ClimateCall::validate_() {
auto traits = this->parent_->get_traits();
if (this->mode_.has_value()) {
auto mode = *this->mode_;
if (!traits.supports_mode(mode)) {
ESP_LOGW(TAG, " Mode %s is not supported by this device!", LOG_STR_ARG(climate_mode_to_string(mode)));
ESP_LOGW(TAG, " Mode %s not supported", LOG_STR_ARG(climate_mode_to_string(mode)));
this->mode_.reset();
}
}
if (this->custom_fan_mode_.has_value()) {
auto custom_fan_mode = *this->custom_fan_mode_;
if (!traits.supports_custom_fan_mode(custom_fan_mode)) {
ESP_LOGW(TAG, " Fan Mode %s is not supported by this device!", custom_fan_mode.c_str());
this->custom_fan_mode_.reset();
if (this->custom_fan_mode_ != nullptr) {
if (!traits.supports_custom_fan_mode(this->custom_fan_mode_)) {
ESP_LOGW(TAG, " Fan Mode %s not supported", this->custom_fan_mode_);
this->custom_fan_mode_ = nullptr;
}
} else if (this->fan_mode_.has_value()) {
auto fan_mode = *this->fan_mode_;
if (!traits.supports_fan_mode(fan_mode)) {
ESP_LOGW(TAG, " Fan Mode %s is not supported by this device!",
LOG_STR_ARG(climate_fan_mode_to_string(fan_mode)));
ESP_LOGW(TAG, " Fan Mode %s not supported", LOG_STR_ARG(climate_fan_mode_to_string(fan_mode)));
this->fan_mode_.reset();
}
}
if (this->custom_preset_.has_value()) {
auto custom_preset = *this->custom_preset_;
if (!traits.supports_custom_preset(custom_preset)) {
ESP_LOGW(TAG, " Preset %s is not supported by this device!", custom_preset.c_str());
this->custom_preset_.reset();
if (this->custom_preset_ != nullptr) {
if (!traits.supports_custom_preset(this->custom_preset_)) {
ESP_LOGW(TAG, " Preset %s not supported", this->custom_preset_);
this->custom_preset_ = nullptr;
}
} else if (this->preset_.has_value()) {
auto preset = *this->preset_;
if (!traits.supports_preset(preset)) {
ESP_LOGW(TAG, " Preset %s is not supported by this device!", LOG_STR_ARG(climate_preset_to_string(preset)));
ESP_LOGW(TAG, " Preset %s not supported", LOG_STR_ARG(climate_preset_to_string(preset)));
this->preset_.reset();
}
}
if (this->swing_mode_.has_value()) {
auto swing_mode = *this->swing_mode_;
if (!traits.supports_swing_mode(swing_mode)) {
ESP_LOGW(TAG, " Swing Mode %s is not supported by this device!",
LOG_STR_ARG(climate_swing_mode_to_string(swing_mode)));
ESP_LOGW(TAG, " Swing Mode %s not supported", LOG_STR_ARG(climate_swing_mode_to_string(swing_mode)));
this->swing_mode_.reset();
}
}
if (this->target_temperature_.has_value()) {
auto target = *this->target_temperature_;
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
ESP_LOGW(TAG, " Cannot set target temperature for climate device "
"with two-point target temperature!");
"with two-point target temperature");
this->target_temperature_.reset();
} else if (std::isnan(target)) {
ESP_LOGW(TAG, " Target temperature must not be NAN!");
ESP_LOGW(TAG, " Target temperature must not be NAN");
this->target_temperature_.reset();
}
}
if (this->target_temperature_low_.has_value() || this->target_temperature_high_.has_value()) {
if (!traits.get_supports_two_point_target_temperature()) {
ESP_LOGW(TAG, " Cannot set low/high target temperature for this device!");
if (!traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
ESP_LOGW(TAG, " Cannot set low/high target temperature");
this->target_temperature_low_.reset();
this->target_temperature_high_.reset();
}
}
if (this->target_temperature_low_.has_value() && std::isnan(*this->target_temperature_low_)) {
ESP_LOGW(TAG, " Target temperature low must not be NAN!");
ESP_LOGW(TAG, " Target temperature low must not be NAN");
this->target_temperature_low_.reset();
}
if (this->target_temperature_high_.has_value() && std::isnan(*this->target_temperature_high_)) {
ESP_LOGW(TAG, " Target temperature low must not be NAN!");
ESP_LOGW(TAG, " Target temperature high must not be NAN");
this->target_temperature_high_.reset();
}
if (this->target_temperature_low_.has_value() && this->target_temperature_high_.has_value()) {
float low = *this->target_temperature_low_;
float high = *this->target_temperature_high_;
if (low > high) {
ESP_LOGW(TAG, " Target temperature low %.2f must be smaller than target temperature high %.2f!", low, high);
ESP_LOGW(TAG, " Target temperature low %.2f must be less than target temperature high %.2f", low, high);
this->target_temperature_low_.reset();
this->target_temperature_high_.reset();
}
}
}
ClimateCall &ClimateCall::set_mode(ClimateMode mode) {
this->mode_ = mode;
return *this;
}
ClimateCall &ClimateCall::set_mode(const std::string &mode) {
if (str_equals_case_insensitive(mode, "OFF")) {
this->set_mode(CLIMATE_MODE_OFF);
} else if (str_equals_case_insensitive(mode, "AUTO")) {
this->set_mode(CLIMATE_MODE_AUTO);
} else if (str_equals_case_insensitive(mode, "COOL")) {
this->set_mode(CLIMATE_MODE_COOL);
} else if (str_equals_case_insensitive(mode, "HEAT")) {
this->set_mode(CLIMATE_MODE_HEAT);
} else if (str_equals_case_insensitive(mode, "FAN_ONLY")) {
this->set_mode(CLIMATE_MODE_FAN_ONLY);
} else if (str_equals_case_insensitive(mode, "DRY")) {
this->set_mode(CLIMATE_MODE_DRY);
} else if (str_equals_case_insensitive(mode, "HEAT_COOL")) {
this->set_mode(CLIMATE_MODE_HEAT_COOL);
} else {
ESP_LOGW(TAG, "'%s' - Unrecognized mode %s", this->parent_->get_name().c_str(), mode.c_str());
}
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(ClimateFanMode fan_mode) {
this->fan_mode_ = fan_mode;
this->custom_fan_mode_.reset();
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(const std::string &fan_mode) {
if (str_equals_case_insensitive(fan_mode, "ON")) {
this->set_fan_mode(CLIMATE_FAN_ON);
} else if (str_equals_case_insensitive(fan_mode, "OFF")) {
this->set_fan_mode(CLIMATE_FAN_OFF);
} else if (str_equals_case_insensitive(fan_mode, "AUTO")) {
this->set_fan_mode(CLIMATE_FAN_AUTO);
} else if (str_equals_case_insensitive(fan_mode, "LOW")) {
this->set_fan_mode(CLIMATE_FAN_LOW);
} else if (str_equals_case_insensitive(fan_mode, "MEDIUM")) {
this->set_fan_mode(CLIMATE_FAN_MEDIUM);
} else if (str_equals_case_insensitive(fan_mode, "HIGH")) {
this->set_fan_mode(CLIMATE_FAN_HIGH);
} else if (str_equals_case_insensitive(fan_mode, "MIDDLE")) {
this->set_fan_mode(CLIMATE_FAN_MIDDLE);
} else if (str_equals_case_insensitive(fan_mode, "FOCUS")) {
this->set_fan_mode(CLIMATE_FAN_FOCUS);
} else if (str_equals_case_insensitive(fan_mode, "DIFFUSE")) {
this->set_fan_mode(CLIMATE_FAN_DIFFUSE);
} else if (str_equals_case_insensitive(fan_mode, "QUIET")) {
this->set_fan_mode(CLIMATE_FAN_QUIET);
} else {
if (this->parent_->get_traits().supports_custom_fan_mode(fan_mode)) {
this->custom_fan_mode_ = fan_mode;
this->fan_mode_.reset();
} else {
ESP_LOGW(TAG, "'%s' - Unrecognized fan mode %s", this->parent_->get_name().c_str(), fan_mode.c_str());
for (const auto &mode_entry : CLIMATE_MODES_BY_STR) {
if (str_equals_case_insensitive(mode, mode_entry.str)) {
this->set_mode(static_cast<ClimateMode>(mode_entry.value));
return *this;
}
}
ESP_LOGW(TAG, "'%s' - Unrecognized mode %s", this->parent_->get_name().c_str(), mode.c_str());
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(ClimateFanMode fan_mode) {
this->fan_mode_ = fan_mode;
this->custom_fan_mode_ = nullptr;
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(const char *custom_fan_mode) {
// Check if it's a standard enum mode first
for (const auto &mode_entry : CLIMATE_FAN_MODES_BY_STR) {
if (str_equals_case_insensitive(custom_fan_mode, mode_entry.str)) {
return this->set_fan_mode(static_cast<ClimateFanMode>(mode_entry.value));
}
}
// Find the matching pointer from parent climate device
if (const char *mode_ptr = this->parent_->find_custom_fan_mode_(custom_fan_mode)) {
this->custom_fan_mode_ = mode_ptr;
this->fan_mode_.reset();
return *this;
}
ESP_LOGW(TAG, "'%s' - Unrecognized fan mode %s", this->parent_->get_name().c_str(), custom_fan_mode);
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(const std::string &fan_mode) { return this->set_fan_mode(fan_mode.c_str()); }
ClimateCall &ClimateCall::set_fan_mode(optional<std::string> fan_mode) {
if (fan_mode.has_value()) {
this->set_fan_mode(fan_mode.value());
}
return *this;
}
ClimateCall &ClimateCall::set_preset(ClimatePreset preset) {
this->preset_ = preset;
this->custom_preset_.reset();
this->custom_preset_ = nullptr;
return *this;
}
ClimateCall &ClimateCall::set_preset(const std::string &preset) {
if (str_equals_case_insensitive(preset, "ECO")) {
this->set_preset(CLIMATE_PRESET_ECO);
} else if (str_equals_case_insensitive(preset, "AWAY")) {
this->set_preset(CLIMATE_PRESET_AWAY);
} else if (str_equals_case_insensitive(preset, "BOOST")) {
this->set_preset(CLIMATE_PRESET_BOOST);
} else if (str_equals_case_insensitive(preset, "COMFORT")) {
this->set_preset(CLIMATE_PRESET_COMFORT);
} else if (str_equals_case_insensitive(preset, "HOME")) {
this->set_preset(CLIMATE_PRESET_HOME);
} else if (str_equals_case_insensitive(preset, "SLEEP")) {
this->set_preset(CLIMATE_PRESET_SLEEP);
} else if (str_equals_case_insensitive(preset, "ACTIVITY")) {
this->set_preset(CLIMATE_PRESET_ACTIVITY);
} else if (str_equals_case_insensitive(preset, "NONE")) {
this->set_preset(CLIMATE_PRESET_NONE);
} else {
if (this->parent_->get_traits().supports_custom_preset(preset)) {
this->custom_preset_ = preset;
this->preset_.reset();
} else {
ESP_LOGW(TAG, "'%s' - Unrecognized preset %s", this->parent_->get_name().c_str(), preset.c_str());
ClimateCall &ClimateCall::set_preset(const char *custom_preset) {
// Check if it's a standard enum preset first
for (const auto &preset_entry : CLIMATE_PRESETS_BY_STR) {
if (str_equals_case_insensitive(custom_preset, preset_entry.str)) {
return this->set_preset(static_cast<ClimatePreset>(preset_entry.value));
}
}
// Find the matching pointer from parent climate device
if (const char *preset_ptr = this->parent_->find_custom_preset_(custom_preset)) {
this->custom_preset_ = preset_ptr;
this->preset_.reset();
return *this;
}
ESP_LOGW(TAG, "'%s' - Unrecognized preset %s", this->parent_->get_name().c_str(), custom_preset);
return *this;
}
ClimateCall &ClimateCall::set_preset(const std::string &preset) { return this->set_preset(preset.c_str()); }
ClimateCall &ClimateCall::set_preset(optional<std::string> preset) {
if (preset.has_value()) {
this->set_preset(preset.value());
}
return *this;
}
ClimateCall &ClimateCall::set_swing_mode(ClimateSwingMode swing_mode) {
this->swing_mode_ = swing_mode;
return *this;
}
ClimateCall &ClimateCall::set_swing_mode(const std::string &swing_mode) {
if (str_equals_case_insensitive(swing_mode, "OFF")) {
this->set_swing_mode(CLIMATE_SWING_OFF);
} else if (str_equals_case_insensitive(swing_mode, "BOTH")) {
this->set_swing_mode(CLIMATE_SWING_BOTH);
} else if (str_equals_case_insensitive(swing_mode, "VERTICAL")) {
this->set_swing_mode(CLIMATE_SWING_VERTICAL);
} else if (str_equals_case_insensitive(swing_mode, "HORIZONTAL")) {
this->set_swing_mode(CLIMATE_SWING_HORIZONTAL);
} else {
ESP_LOGW(TAG, "'%s' - Unrecognized swing mode %s", this->parent_->get_name().c_str(), swing_mode.c_str());
for (const auto &mode_entry : CLIMATE_SWING_MODES_BY_STR) {
if (str_equals_case_insensitive(swing_mode, mode_entry.str)) {
this->set_swing_mode(static_cast<ClimateSwingMode>(mode_entry.value));
return *this;
}
}
ESP_LOGW(TAG, "'%s' - Unrecognized swing mode %s", this->parent_->get_name().c_str(), swing_mode.c_str());
return *this;
}
@@ -257,59 +266,69 @@ ClimateCall &ClimateCall::set_target_temperature(float target_temperature) {
this->target_temperature_ = target_temperature;
return *this;
}
ClimateCall &ClimateCall::set_target_temperature_low(float target_temperature_low) {
this->target_temperature_low_ = target_temperature_low;
return *this;
}
ClimateCall &ClimateCall::set_target_temperature_high(float target_temperature_high) {
this->target_temperature_high_ = target_temperature_high;
return *this;
}
ClimateCall &ClimateCall::set_target_humidity(float target_humidity) {
this->target_humidity_ = target_humidity;
return *this;
}
const optional<ClimateMode> &ClimateCall::get_mode() const { return this->mode_; }
const optional<float> &ClimateCall::get_target_temperature() const { return this->target_temperature_; }
const optional<float> &ClimateCall::get_target_temperature_low() const { return this->target_temperature_low_; }
const optional<float> &ClimateCall::get_target_temperature_high() const { return this->target_temperature_high_; }
const optional<float> &ClimateCall::get_target_humidity() const { return this->target_humidity_; }
const optional<ClimateMode> &ClimateCall::get_mode() const { return this->mode_; }
const optional<ClimateFanMode> &ClimateCall::get_fan_mode() const { return this->fan_mode_; }
const optional<std::string> &ClimateCall::get_custom_fan_mode() const { return this->custom_fan_mode_; }
const optional<ClimatePreset> &ClimateCall::get_preset() const { return this->preset_; }
const optional<std::string> &ClimateCall::get_custom_preset() const { return this->custom_preset_; }
const optional<ClimateSwingMode> &ClimateCall::get_swing_mode() const { return this->swing_mode_; }
const optional<ClimatePreset> &ClimateCall::get_preset() const { return this->preset_; }
ClimateCall &ClimateCall::set_target_temperature_high(optional<float> target_temperature_high) {
this->target_temperature_high_ = target_temperature_high;
return *this;
}
ClimateCall &ClimateCall::set_target_temperature_low(optional<float> target_temperature_low) {
this->target_temperature_low_ = target_temperature_low;
return *this;
}
ClimateCall &ClimateCall::set_target_temperature(optional<float> target_temperature) {
this->target_temperature_ = target_temperature;
return *this;
}
ClimateCall &ClimateCall::set_target_humidity(optional<float> target_humidity) {
this->target_humidity_ = target_humidity;
return *this;
}
ClimateCall &ClimateCall::set_mode(optional<ClimateMode> mode) {
this->mode_ = mode;
return *this;
}
ClimateCall &ClimateCall::set_fan_mode(optional<ClimateFanMode> fan_mode) {
this->fan_mode_ = fan_mode;
this->custom_fan_mode_.reset();
this->custom_fan_mode_ = nullptr;
return *this;
}
ClimateCall &ClimateCall::set_preset(optional<ClimatePreset> preset) {
this->preset_ = preset;
this->custom_preset_.reset();
this->custom_preset_ = nullptr;
return *this;
}
ClimateCall &ClimateCall::set_swing_mode(optional<ClimateSwingMode> swing_mode) {
this->swing_mode_ = swing_mode;
return *this;
@@ -334,6 +353,7 @@ optional<ClimateDeviceRestoreState> Climate::restore_state_() {
return {};
return recovered;
}
void Climate::save_state_() {
#if (defined(USE_ESP_IDF) || (defined(USE_ESP8266) && USE_ARDUINO_VERSION_CODE >= VERSION_CODE(3, 0, 0))) && \
!defined(CLANG_TIDY)
@@ -350,43 +370,48 @@ void Climate::save_state_() {
state.mode = this->mode;
auto traits = this->get_traits();
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
state.target_temperature_low = this->target_temperature_low;
state.target_temperature_high = this->target_temperature_high;
} else {
state.target_temperature = this->target_temperature;
}
if (traits.get_supports_target_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
state.target_humidity = this->target_humidity;
}
if (traits.get_supports_fan_modes() && fan_mode.has_value()) {
state.uses_custom_fan_mode = false;
state.fan_mode = this->fan_mode.value();
}
if (!traits.get_supported_custom_fan_modes().empty() && custom_fan_mode.has_value()) {
if (!traits.get_supported_custom_fan_modes().empty() && this->has_custom_fan_mode()) {
state.uses_custom_fan_mode = true;
const auto &supported = traits.get_supported_custom_fan_modes();
std::vector<std::string> vec{supported.begin(), supported.end()};
for (size_t i = 0; i < vec.size(); i++) {
if (vec[i] == custom_fan_mode) {
// std::vector maintains insertion order
size_t i = 0;
for (const char *mode : supported) {
if (strcmp(mode, this->custom_fan_mode_) == 0) {
state.custom_fan_mode = i;
break;
}
i++;
}
}
if (traits.get_supports_presets() && preset.has_value()) {
state.uses_custom_preset = false;
state.preset = this->preset.value();
}
if (!traits.get_supported_custom_presets().empty() && custom_preset.has_value()) {
if (!traits.get_supported_custom_presets().empty() && this->has_custom_preset()) {
state.uses_custom_preset = true;
const auto &supported = traits.get_supported_custom_presets();
std::vector<std::string> vec{supported.begin(), supported.end()};
for (size_t i = 0; i < vec.size(); i++) {
if (vec[i] == custom_preset) {
// std::vector maintains insertion order
size_t i = 0;
for (const char *preset : supported) {
if (strcmp(preset, this->custom_preset_) == 0) {
state.custom_preset = i;
break;
}
i++;
}
}
if (traits.get_supports_swing_modes()) {
@@ -395,42 +420,44 @@ void Climate::save_state_() {
this->rtc_.save(&state);
}
void Climate::publish_state() {
ESP_LOGD(TAG, "'%s' - Sending state:", this->name_.c_str());
auto traits = this->get_traits();
ESP_LOGD(TAG, " Mode: %s", LOG_STR_ARG(climate_mode_to_string(this->mode)));
if (traits.get_supports_action()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION)) {
ESP_LOGD(TAG, " Action: %s", LOG_STR_ARG(climate_action_to_string(this->action)));
}
if (traits.get_supports_fan_modes() && this->fan_mode.has_value()) {
ESP_LOGD(TAG, " Fan Mode: %s", LOG_STR_ARG(climate_fan_mode_to_string(this->fan_mode.value())));
}
if (!traits.get_supported_custom_fan_modes().empty() && this->custom_fan_mode.has_value()) {
ESP_LOGD(TAG, " Custom Fan Mode: %s", this->custom_fan_mode.value().c_str());
if (!traits.get_supported_custom_fan_modes().empty() && this->has_custom_fan_mode()) {
ESP_LOGD(TAG, " Custom Fan Mode: %s", this->custom_fan_mode_);
}
if (traits.get_supports_presets() && this->preset.has_value()) {
ESP_LOGD(TAG, " Preset: %s", LOG_STR_ARG(climate_preset_to_string(this->preset.value())));
}
if (!traits.get_supported_custom_presets().empty() && this->custom_preset.has_value()) {
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset.value().c_str());
if (!traits.get_supported_custom_presets().empty() && this->has_custom_preset()) {
ESP_LOGD(TAG, " Custom Preset: %s", this->custom_preset_);
}
if (traits.get_supports_swing_modes()) {
ESP_LOGD(TAG, " Swing Mode: %s", LOG_STR_ARG(climate_swing_mode_to_string(this->swing_mode)));
}
if (traits.get_supports_current_temperature()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)) {
ESP_LOGD(TAG, " Current Temperature: %.2f°C", this->current_temperature);
}
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
ESP_LOGD(TAG, " Target Temperature: Low: %.2f°C High: %.2f°C", this->target_temperature_low,
this->target_temperature_high);
} else {
ESP_LOGD(TAG, " Target Temperature: %.2f°C", this->target_temperature);
}
if (traits.get_supports_current_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY)) {
ESP_LOGD(TAG, " Current Humidity: %.0f%%", this->current_humidity);
}
if (traits.get_supports_target_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
ESP_LOGD(TAG, " Target Humidity: %.0f%%", this->target_humidity);
}
@@ -465,16 +492,20 @@ ClimateTraits Climate::get_traits() {
void Climate::set_visual_min_temperature_override(float visual_min_temperature_override) {
this->visual_min_temperature_override_ = visual_min_temperature_override;
}
void Climate::set_visual_max_temperature_override(float visual_max_temperature_override) {
this->visual_max_temperature_override_ = visual_max_temperature_override;
}
void Climate::set_visual_temperature_step_override(float target, float current) {
this->visual_target_temperature_step_override_ = target;
this->visual_current_temperature_step_override_ = current;
}
void Climate::set_visual_min_humidity_override(float visual_min_humidity_override) {
this->visual_min_humidity_override_ = visual_min_humidity_override;
}
void Climate::set_visual_max_humidity_override(float visual_max_humidity_override) {
this->visual_max_humidity_override_ = visual_max_humidity_override;
}
@@ -485,154 +516,244 @@ ClimateCall ClimateDeviceRestoreState::to_call(Climate *climate) {
auto call = climate->make_call();
auto traits = climate->get_traits();
call.set_mode(this->mode);
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
call.set_target_temperature_low(this->target_temperature_low);
call.set_target_temperature_high(this->target_temperature_high);
} else {
call.set_target_temperature(this->target_temperature);
}
if (traits.get_supports_target_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
call.set_target_humidity(this->target_humidity);
}
if (traits.get_supports_fan_modes() || !traits.get_supported_custom_fan_modes().empty()) {
if (this->uses_custom_fan_mode) {
if (this->custom_fan_mode < traits.get_supported_custom_fan_modes().size()) {
call.fan_mode_.reset();
call.custom_fan_mode_ = traits.get_supported_custom_fan_modes()[this->custom_fan_mode];
}
} else if (traits.supports_fan_mode(this->fan_mode)) {
call.set_fan_mode(this->fan_mode);
}
if (traits.get_supports_presets() || !traits.get_supported_custom_presets().empty()) {
if (this->uses_custom_preset) {
if (this->custom_preset < traits.get_supported_custom_presets().size()) {
call.preset_.reset();
call.custom_preset_ = traits.get_supported_custom_presets()[this->custom_preset];
}
} else if (traits.supports_preset(this->preset)) {
call.set_preset(this->preset);
}
if (traits.get_supports_swing_modes()) {
if (traits.supports_swing_mode(this->swing_mode)) {
call.set_swing_mode(this->swing_mode);
}
return call;
}
void ClimateDeviceRestoreState::apply(Climate *climate) {
auto traits = climate->get_traits();
climate->mode = this->mode;
if (traits.get_supports_two_point_target_temperature()) {
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
climate->target_temperature_low = this->target_temperature_low;
climate->target_temperature_high = this->target_temperature_high;
} else {
climate->target_temperature = this->target_temperature;
}
if (traits.get_supports_target_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
climate->target_humidity = this->target_humidity;
}
if (traits.get_supports_fan_modes() && !this->uses_custom_fan_mode) {
if (this->uses_custom_fan_mode) {
if (this->custom_fan_mode < traits.get_supported_custom_fan_modes().size()) {
climate->fan_mode.reset();
climate->custom_fan_mode_ = traits.get_supported_custom_fan_modes()[this->custom_fan_mode];
}
} else if (traits.supports_fan_mode(this->fan_mode)) {
climate->fan_mode = this->fan_mode;
climate->clear_custom_fan_mode_();
}
if (!traits.get_supported_custom_fan_modes().empty() && this->uses_custom_fan_mode) {
// std::set has consistent order (lexicographic for strings), so this is ok
const auto &modes = traits.get_supported_custom_fan_modes();
std::vector<std::string> modes_vec{modes.begin(), modes.end()};
if (custom_fan_mode < modes_vec.size()) {
climate->custom_fan_mode = modes_vec[this->custom_fan_mode];
if (this->uses_custom_preset) {
if (this->custom_preset < traits.get_supported_custom_presets().size()) {
climate->preset.reset();
climate->custom_preset_ = traits.get_supported_custom_presets()[this->custom_preset];
}
}
if (traits.get_supports_presets() && !this->uses_custom_preset) {
} else if (traits.supports_preset(this->preset)) {
climate->preset = this->preset;
climate->clear_custom_preset_();
}
if (!traits.get_supported_custom_presets().empty() && uses_custom_preset) {
// std::set has consistent order (lexicographic for strings), so this is ok
const auto &presets = traits.get_supported_custom_presets();
std::vector<std::string> presets_vec{presets.begin(), presets.end()};
if (custom_preset < presets_vec.size()) {
climate->custom_preset = presets_vec[this->custom_preset];
}
}
if (traits.get_supports_swing_modes()) {
if (traits.supports_swing_mode(this->swing_mode)) {
climate->swing_mode = this->swing_mode;
}
climate->publish_state();
}
template<typename T1, typename T2> bool set_alternative(optional<T1> &dst, optional<T2> &alt, const T1 &src) {
bool is_changed = alt.has_value();
alt.reset();
if (is_changed || dst != src) {
dst = src;
is_changed = true;
/** Template helper for setting primary modes (fan_mode, preset) with mutual exclusion.
*
* Climate devices have mutually exclusive mode pairs:
* - fan_mode (enum) vs custom_fan_mode_ (const char*)
* - preset (enum) vs custom_preset_ (const char*)
*
* Only one mode in each pair can be active at a time. This helper ensures setting a primary
* mode automatically clears its corresponding custom mode.
*
* Example state transitions:
* Before: custom_fan_mode_="Turbo", fan_mode=nullopt
* Call: set_fan_mode_(CLIMATE_FAN_HIGH)
* After: custom_fan_mode_=nullptr, fan_mode=CLIMATE_FAN_HIGH
*
* @param primary The primary mode optional (fan_mode or preset)
* @param custom_ptr Reference to the custom mode pointer (custom_fan_mode_ or custom_preset_)
* @param value The new primary mode value to set
* @return true if state changed, false if already set to this value
*/
template<typename T> bool set_primary_mode(optional<T> &primary, const char *&custom_ptr, T value) {
// Clear the custom mode (mutual exclusion)
bool changed = custom_ptr != nullptr;
custom_ptr = nullptr;
// Set the primary mode
if (changed || !primary.has_value() || primary.value() != value) {
primary = value;
return true;
}
return is_changed;
return false;
}
/** Template helper for setting custom modes (custom_fan_mode_, custom_preset_) with mutual exclusion.
*
* This helper ensures setting a custom mode automatically clears its corresponding primary mode.
* It also validates that the custom mode exists in the device's supported modes (lifetime safety).
*
* Example state transitions:
* Before: fan_mode=CLIMATE_FAN_HIGH, custom_fan_mode_=nullptr
* Call: set_custom_fan_mode_("Turbo")
* After: fan_mode=nullopt, custom_fan_mode_="Turbo" (pointer from traits)
*
* Lifetime Safety:
* - found_ptr must come from traits.find_custom_*_mode_()
* - Only pointers found in traits are stored, ensuring they remain valid
* - Prevents dangling pointers from temporary strings
*
* @param custom_ptr Reference to the custom mode pointer to set
* @param primary The primary mode optional to clear
* @param found_ptr The validated pointer from traits (nullptr if not found)
* @param has_custom Whether a custom mode is currently active
* @return true if state changed, false otherwise
*/
template<typename T>
bool set_custom_mode(const char *&custom_ptr, optional<T> &primary, const char *found_ptr, bool has_custom) {
if (found_ptr != nullptr) {
// Clear the primary mode (mutual exclusion)
bool changed = primary.has_value();
primary.reset();
// Set the custom mode (pointer is validated by caller from traits)
if (changed || custom_ptr != found_ptr) {
custom_ptr = found_ptr;
return true;
}
return false;
}
// Mode not found in supported modes, clear it if currently set
if (has_custom) {
custom_ptr = nullptr;
return true;
}
return false;
}
bool Climate::set_fan_mode_(ClimateFanMode mode) {
return set_alternative(this->fan_mode, this->custom_fan_mode, mode);
return set_primary_mode(this->fan_mode, this->custom_fan_mode_, mode);
}
bool Climate::set_custom_fan_mode_(const std::string &mode) {
return set_alternative(this->custom_fan_mode, this->fan_mode, mode);
bool Climate::set_custom_fan_mode_(const char *mode) {
auto traits = this->get_traits();
return set_custom_mode<ClimateFanMode>(this->custom_fan_mode_, this->fan_mode, traits.find_custom_fan_mode_(mode),
this->has_custom_fan_mode());
}
bool Climate::set_preset_(ClimatePreset preset) { return set_alternative(this->preset, this->custom_preset, preset); }
void Climate::clear_custom_fan_mode_() { this->custom_fan_mode_ = nullptr; }
bool Climate::set_custom_preset_(const std::string &preset) {
return set_alternative(this->custom_preset, this->preset, preset);
bool Climate::set_preset_(ClimatePreset preset) { return set_primary_mode(this->preset, this->custom_preset_, preset); }
bool Climate::set_custom_preset_(const char *preset) {
auto traits = this->get_traits();
return set_custom_mode<ClimatePreset>(this->custom_preset_, this->preset, traits.find_custom_preset_(preset),
this->has_custom_preset());
}
void Climate::clear_custom_preset_() { this->custom_preset_ = nullptr; }
const char *Climate::find_custom_fan_mode_(const char *custom_fan_mode) {
return this->get_traits().find_custom_fan_mode_(custom_fan_mode);
}
const char *Climate::find_custom_preset_(const char *custom_preset) {
return this->get_traits().find_custom_preset_(custom_preset);
}
void Climate::dump_traits_(const char *tag) {
auto traits = this->get_traits();
ESP_LOGCONFIG(tag, "ClimateTraits:");
ESP_LOGCONFIG(tag,
" [x] Visual settings:\n"
" - Min temperature: %.1f\n"
" - Max temperature: %.1f\n"
" - Temperature step:\n"
" Target: %.1f",
" Visual settings:\n"
" - Min temperature: %.1f\n"
" - Max temperature: %.1f\n"
" - Temperature step:\n"
" Target: %.1f",
traits.get_visual_min_temperature(), traits.get_visual_max_temperature(),
traits.get_visual_target_temperature_step());
if (traits.get_supports_current_temperature()) {
ESP_LOGCONFIG(tag, " Current: %.1f", traits.get_visual_current_temperature_step());
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)) {
ESP_LOGCONFIG(tag, " Current: %.1f", traits.get_visual_current_temperature_step());
}
if (traits.get_supports_target_humidity() || traits.get_supports_current_humidity()) {
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY |
climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY)) {
ESP_LOGCONFIG(tag,
" - Min humidity: %.0f\n"
" - Max humidity: %.0f",
" - Min humidity: %.0f\n"
" - Max humidity: %.0f",
traits.get_visual_min_humidity(), traits.get_visual_max_humidity());
}
if (traits.get_supports_two_point_target_temperature()) {
ESP_LOGCONFIG(tag, " [x] Supports two-point target temperature");
if (traits.has_feature_flags(CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE |
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE)) {
ESP_LOGCONFIG(tag, " Supports two-point target temperature");
}
if (traits.get_supports_current_temperature()) {
ESP_LOGCONFIG(tag, " [x] Supports current temperature");
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE)) {
ESP_LOGCONFIG(tag, " Supports current temperature");
}
if (traits.get_supports_target_humidity()) {
ESP_LOGCONFIG(tag, " [x] Supports target humidity");
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_TARGET_HUMIDITY)) {
ESP_LOGCONFIG(tag, " Supports target humidity");
}
if (traits.get_supports_current_humidity()) {
ESP_LOGCONFIG(tag, " [x] Supports current humidity");
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_HUMIDITY)) {
ESP_LOGCONFIG(tag, " Supports current humidity");
}
if (traits.get_supports_action()) {
ESP_LOGCONFIG(tag, " [x] Supports action");
if (traits.has_feature_flags(climate::CLIMATE_SUPPORTS_ACTION)) {
ESP_LOGCONFIG(tag, " Supports action");
}
if (!traits.get_supported_modes().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported modes:");
ESP_LOGCONFIG(tag, " Supported modes:");
for (ClimateMode m : traits.get_supported_modes())
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_mode_to_string(m)));
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_mode_to_string(m)));
}
if (!traits.get_supported_fan_modes().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported fan modes:");
ESP_LOGCONFIG(tag, " Supported fan modes:");
for (ClimateFanMode m : traits.get_supported_fan_modes())
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_fan_mode_to_string(m)));
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_fan_mode_to_string(m)));
}
if (!traits.get_supported_custom_fan_modes().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported custom fan modes:");
for (const std::string &s : traits.get_supported_custom_fan_modes())
ESP_LOGCONFIG(tag, " - %s", s.c_str());
ESP_LOGCONFIG(tag, " Supported custom fan modes:");
for (const char *s : traits.get_supported_custom_fan_modes())
ESP_LOGCONFIG(tag, " - %s", s);
}
if (!traits.get_supported_presets().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported presets:");
ESP_LOGCONFIG(tag, " Supported presets:");
for (ClimatePreset p : traits.get_supported_presets())
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_preset_to_string(p)));
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_preset_to_string(p)));
}
if (!traits.get_supported_custom_presets().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported custom presets:");
for (const std::string &s : traits.get_supported_custom_presets())
ESP_LOGCONFIG(tag, " - %s", s.c_str());
ESP_LOGCONFIG(tag, " Supported custom presets:");
for (const char *s : traits.get_supported_custom_presets())
ESP_LOGCONFIG(tag, " - %s", s);
}
if (!traits.get_supported_swing_modes().empty()) {
ESP_LOGCONFIG(tag, " [x] Supported swing modes:");
ESP_LOGCONFIG(tag, " Supported swing modes:");
for (ClimateSwingMode m : traits.get_supported_swing_modes())
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_swing_mode_to_string(m)));
ESP_LOGCONFIG(tag, " - %s", LOG_STR_ARG(climate_swing_mode_to_string(m)));
}
}

View File

@@ -33,6 +33,7 @@ class Climate;
class ClimateCall {
public:
explicit ClimateCall(Climate *parent) : parent_(parent) {}
friend struct ClimateDeviceRestoreState;
/// Set the mode of the climate device.
ClimateCall &set_mode(ClimateMode mode);
@@ -76,6 +77,8 @@ class ClimateCall {
ClimateCall &set_fan_mode(const std::string &fan_mode);
/// Set the fan mode of the climate device based on a string.
ClimateCall &set_fan_mode(optional<std::string> fan_mode);
/// Set the custom fan mode of the climate device.
ClimateCall &set_fan_mode(const char *custom_fan_mode);
/// Set the swing mode of the climate device.
ClimateCall &set_swing_mode(ClimateSwingMode swing_mode);
/// Set the swing mode of the climate device.
@@ -90,34 +93,41 @@ class ClimateCall {
ClimateCall &set_preset(const std::string &preset);
/// Set the preset of the climate device based on a string.
ClimateCall &set_preset(optional<std::string> preset);
/// Set the custom preset of the climate device.
ClimateCall &set_preset(const char *custom_preset);
void perform();
const optional<ClimateMode> &get_mode() const;
const optional<float> &get_target_temperature() const;
const optional<float> &get_target_temperature_low() const;
const optional<float> &get_target_temperature_high() const;
const optional<float> &get_target_humidity() const;
const optional<ClimateMode> &get_mode() const;
const optional<ClimateFanMode> &get_fan_mode() const;
const optional<ClimateSwingMode> &get_swing_mode() const;
const optional<std::string> &get_custom_fan_mode() const;
const optional<ClimatePreset> &get_preset() const;
const optional<std::string> &get_custom_preset() const;
const char *get_custom_fan_mode() const { return this->custom_fan_mode_; }
const char *get_custom_preset() const { return this->custom_preset_; }
bool has_custom_fan_mode() const { return this->custom_fan_mode_ != nullptr; }
bool has_custom_preset() const { return this->custom_preset_ != nullptr; }
protected:
void validate_();
Climate *const parent_;
optional<ClimateMode> mode_;
optional<float> target_temperature_;
optional<float> target_temperature_low_;
optional<float> target_temperature_high_;
optional<float> target_humidity_;
optional<ClimateMode> mode_;
optional<ClimateFanMode> fan_mode_;
optional<ClimateSwingMode> swing_mode_;
optional<std::string> custom_fan_mode_;
optional<ClimatePreset> preset_;
optional<std::string> custom_preset_;
private:
const char *custom_fan_mode_{nullptr};
const char *custom_preset_{nullptr};
};
/// Struct used to save the state of the climate device in restore memory.
@@ -169,47 +179,6 @@ class Climate : public EntityBase {
public:
Climate() {}
/// The active mode of the climate device.
ClimateMode mode{CLIMATE_MODE_OFF};
/// The active state of the climate device.
ClimateAction action{CLIMATE_ACTION_OFF};
/// The current temperature of the climate device, as reported from the integration.
float current_temperature{NAN};
/// The current humidity of the climate device, as reported from the integration.
float current_humidity{NAN};
union {
/// The target temperature of the climate device.
float target_temperature;
struct {
/// The minimum target temperature of the climate device, for climate devices with split target temperature.
float target_temperature_low{NAN};
/// The maximum target temperature of the climate device, for climate devices with split target temperature.
float target_temperature_high{NAN};
};
};
/// The target humidity of the climate device.
float target_humidity;
/// The active fan mode of the climate device.
optional<ClimateFanMode> fan_mode;
/// The active swing mode of the climate device.
ClimateSwingMode swing_mode;
/// The active custom fan mode of the climate device.
optional<std::string> custom_fan_mode;
/// The active preset of the climate device.
optional<ClimatePreset> preset;
/// The active custom preset mode of the climate device.
optional<std::string> custom_preset;
/** Add a callback for the climate device state, each time the state of the climate device is updated
* (using publish_state), this callback will be called.
*
@@ -251,20 +220,78 @@ class Climate : public EntityBase {
void set_visual_min_humidity_override(float visual_min_humidity_override);
void set_visual_max_humidity_override(float visual_max_humidity_override);
/// Check if a custom fan mode is currently active.
bool has_custom_fan_mode() const { return this->custom_fan_mode_ != nullptr; }
/// Check if a custom preset is currently active.
bool has_custom_preset() const { return this->custom_preset_ != nullptr; }
/// The current temperature of the climate device, as reported from the integration.
float current_temperature{NAN};
/// The current humidity of the climate device, as reported from the integration.
float current_humidity{NAN};
union {
/// The target temperature of the climate device.
float target_temperature;
struct {
/// The minimum target temperature of the climate device, for climate devices with split target temperature.
float target_temperature_low{NAN};
/// The maximum target temperature of the climate device, for climate devices with split target temperature.
float target_temperature_high{NAN};
};
};
/// The target humidity of the climate device.
float target_humidity;
/// The active fan mode of the climate device.
optional<ClimateFanMode> fan_mode;
/// The active preset of the climate device.
optional<ClimatePreset> preset;
/// The active mode of the climate device.
ClimateMode mode{CLIMATE_MODE_OFF};
/// The active state of the climate device.
ClimateAction action{CLIMATE_ACTION_OFF};
/// The active swing mode of the climate device.
ClimateSwingMode swing_mode{CLIMATE_SWING_OFF};
/// Get the active custom fan mode (read-only access).
const char *get_custom_fan_mode() const { return this->custom_fan_mode_; }
/// Get the active custom preset (read-only access).
const char *get_custom_preset() const { return this->custom_preset_; }
protected:
friend ClimateCall;
friend struct ClimateDeviceRestoreState;
/// Set fan mode. Reset custom fan mode. Return true if fan mode has been changed.
bool set_fan_mode_(ClimateFanMode mode);
/// Set custom fan mode. Reset primary fan mode. Return true if fan mode has been changed.
bool set_custom_fan_mode_(const std::string &mode);
bool set_custom_fan_mode_(const char *mode);
/// Clear custom fan mode.
void clear_custom_fan_mode_();
/// Set preset. Reset custom preset. Return true if preset has been changed.
bool set_preset_(ClimatePreset preset);
/// Set custom preset. Reset primary preset. Return true if preset has been changed.
bool set_custom_preset_(const std::string &preset);
bool set_custom_preset_(const char *preset);
/// Clear custom preset.
void clear_custom_preset_();
/// Find and return the matching custom fan mode pointer from traits, or nullptr if not found.
const char *find_custom_fan_mode_(const char *custom_fan_mode);
/// Find and return the matching custom preset pointer from traits, or nullptr if not found.
const char *find_custom_preset_(const char *custom_preset);
/** Get the default traits of this climate device.
*
@@ -301,6 +328,21 @@ class Climate : public EntityBase {
optional<float> visual_current_temperature_step_override_{};
optional<float> visual_min_humidity_override_{};
optional<float> visual_max_humidity_override_{};
private:
/** The active custom fan mode (private - enforces use of safe setters).
*
* Points to an entry in traits.supported_custom_fan_modes_ or nullptr.
* Use get_custom_fan_mode() to read, set_custom_fan_mode_() to modify.
*/
const char *custom_fan_mode_{nullptr};
/** The active custom preset (private - enforces use of safe setters).
*
* Points to an entry in traits.supported_custom_presets_ or nullptr.
* Use get_custom_preset() to read, set_custom_preset_() to modify.
*/
const char *custom_preset_{nullptr};
};
} // namespace climate

View File

@@ -7,6 +7,7 @@ namespace esphome {
namespace climate {
/// Enum for all modes a climate device can be in.
/// NOTE: If adding values, update ClimateModeMask in climate_traits.h to use the new last value
enum ClimateMode : uint8_t {
/// The climate device is off
CLIMATE_MODE_OFF = 0,
@@ -24,7 +25,7 @@ enum ClimateMode : uint8_t {
* For example, the target temperature can be adjusted based on a schedule, or learned behavior.
* The target temperature can't be adjusted when in this mode.
*/
CLIMATE_MODE_AUTO = 6
CLIMATE_MODE_AUTO = 6 // Update ClimateModeMask in climate_traits.h if adding values after this
};
/// Enum for the current action of the climate device. Values match those of ClimateMode.
@@ -43,6 +44,7 @@ enum ClimateAction : uint8_t {
CLIMATE_ACTION_FAN = 6,
};
/// NOTE: If adding values, update ClimateFanModeMask in climate_traits.h to use the new last value
enum ClimateFanMode : uint8_t {
/// The fan mode is set to On
CLIMATE_FAN_ON = 0,
@@ -63,10 +65,11 @@ enum ClimateFanMode : uint8_t {
/// The fan mode is set to Diffuse
CLIMATE_FAN_DIFFUSE = 8,
/// The fan mode is set to Quiet
CLIMATE_FAN_QUIET = 9,
CLIMATE_FAN_QUIET = 9, // Update ClimateFanModeMask in climate_traits.h if adding values after this
};
/// Enum for all modes a climate swing can be in
/// NOTE: If adding values, update ClimateSwingModeMask in climate_traits.h to use the new last value
enum ClimateSwingMode : uint8_t {
/// The swing mode is set to Off
CLIMATE_SWING_OFF = 0,
@@ -75,10 +78,11 @@ enum ClimateSwingMode : uint8_t {
/// The fan mode is set to Vertical
CLIMATE_SWING_VERTICAL = 2,
/// The fan mode is set to Horizontal
CLIMATE_SWING_HORIZONTAL = 3,
CLIMATE_SWING_HORIZONTAL = 3, // Update ClimateSwingModeMask in climate_traits.h if adding values after this
};
/// Enum for all preset modes
/// NOTE: If adding values, update ClimatePresetMask in climate_traits.h to use the new last value
enum ClimatePreset : uint8_t {
/// No preset is active
CLIMATE_PRESET_NONE = 0,
@@ -95,7 +99,22 @@ enum ClimatePreset : uint8_t {
/// Device is prepared for sleep
CLIMATE_PRESET_SLEEP = 6,
/// Device is reacting to activity (e.g., movement sensors)
CLIMATE_PRESET_ACTIVITY = 7,
CLIMATE_PRESET_ACTIVITY = 7, // Update ClimatePresetMask in climate_traits.h if adding values after this
};
enum ClimateFeature : uint32_t {
// Reporting current temperature is supported
CLIMATE_SUPPORTS_CURRENT_TEMPERATURE = 1 << 0,
// Setting two target temperatures is supported (used in conjunction with CLIMATE_MODE_HEAT_COOL)
CLIMATE_SUPPORTS_TWO_POINT_TARGET_TEMPERATURE = 1 << 1,
// Single-point mode is NOT supported (UI always displays two handles, setting 'target_temperature' is not supported)
CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE = 1 << 2,
// Reporting current humidity is supported
CLIMATE_SUPPORTS_CURRENT_HUMIDITY = 1 << 3,
// Setting a target humidity is supported
CLIMATE_SUPPORTS_TARGET_HUMIDITY = 1 << 4,
// Reporting current climate action is supported
CLIMATE_SUPPORTS_ACTION = 1 << 5,
};
/// Convert the given ClimateMode to a human-readable string.

View File

@@ -1,19 +1,43 @@
#pragma once
#include "esphome/core/helpers.h"
#include <cstring>
#include <vector>
#include "climate_mode.h"
#include <set>
#include "esphome/core/finite_set_mask.h"
#include "esphome/core/helpers.h"
namespace esphome {
#ifdef USE_API
namespace api {
class APIConnection;
} // namespace api
#endif
namespace climate {
// Type aliases for climate enum bitmasks
// These replace std::set<EnumType> to eliminate red-black tree overhead
// For contiguous enums starting at 0, DefaultBitPolicy provides 1:1 mapping (enum value = bit position)
// Bitmask size is automatically calculated from the last enum value
using ClimateModeMask = FiniteSetMask<ClimateMode, DefaultBitPolicy<ClimateMode, CLIMATE_MODE_AUTO + 1>>;
using ClimateFanModeMask = FiniteSetMask<ClimateFanMode, DefaultBitPolicy<ClimateFanMode, CLIMATE_FAN_QUIET + 1>>;
using ClimateSwingModeMask =
FiniteSetMask<ClimateSwingMode, DefaultBitPolicy<ClimateSwingMode, CLIMATE_SWING_HORIZONTAL + 1>>;
using ClimatePresetMask = FiniteSetMask<ClimatePreset, DefaultBitPolicy<ClimatePreset, CLIMATE_PRESET_ACTIVITY + 1>>;
// Lightweight linear search for small vectors (1-20 items) of const char* pointers
// Avoids std::find template overhead
inline bool vector_contains(const std::vector<const char *> &vec, const char *value) {
for (const char *item : vec) {
if (strcmp(item, value) == 0)
return true;
}
return false;
}
// Find and return matching pointer from vector, or nullptr if not found
inline const char *vector_find(const std::vector<const char *> &vec, const char *value) {
for (const char *item : vec) {
if (strcmp(item, value) == 0)
return item;
}
return nullptr;
}
/** This class contains all static data for climate devices.
*
* All climate devices must support these features:
@@ -21,135 +45,164 @@ namespace climate {
* - Target Temperature
*
* All other properties and modes are optional and the integration must mark
* each of them as supported by setting the appropriate flag here.
* each of them as supported by setting the appropriate flag(s) here.
*
* - supports current temperature - if the climate device supports reporting a current temperature
* - supports two point target temperature - if the climate device's target temperature should be
* split in target_temperature_low and target_temperature_high instead of just the single target_temperature
* - feature flags: see ClimateFeatures enum in climate_mode.h
* - supports modes:
* - auto mode (automatic control)
* - cool mode (lowers current temperature)
* - heat mode (increases current temperature)
* - dry mode (removes humidity from air)
* - fan mode (only turns on fan)
* - supports action - if the climate device supports reporting the active
* current action of the device with the action property.
* - supports fan modes - optionally, if it has a fan which can be configured in different ways:
* - on, off, auto, high, medium, low, middle, focus, diffuse, quiet
* - supports swing modes - optionally, if it has a swing which can be configured in different ways:
* - off, both, vertical, horizontal
*
* This class also contains static data for the climate device display:
* - visual min/max temperature - tells the frontend what range of temperatures the climate device
* should display (gauge min/max values)
* - visual min/max temperature/humidity - tells the frontend what range of temperature/humidity the
* climate device should display (gauge min/max values)
* - temperature step - the step with which to increase/decrease target temperature.
* This also affects with how many decimal places the temperature is shown
*/
class Climate; // Forward declaration
class ClimateTraits {
friend class Climate; // Allow Climate to access protected find methods
public:
bool get_supports_current_temperature() const { return this->supports_current_temperature_; }
/// Get/set feature flags (see ClimateFeatures enum in climate_mode.h)
uint32_t get_feature_flags() const { return this->feature_flags_; }
void add_feature_flags(uint32_t feature_flags) { this->feature_flags_ |= feature_flags; }
void clear_feature_flags(uint32_t feature_flags) { this->feature_flags_ &= ~feature_flags; }
bool has_feature_flags(uint32_t feature_flags) const { return this->feature_flags_ & feature_flags; }
void set_feature_flags(uint32_t feature_flags) { this->feature_flags_ = feature_flags; }
ESPDEPRECATED("This method is deprecated, use get_feature_flags() instead", "2025.11.0")
bool get_supports_current_temperature() const {
return this->has_feature_flags(CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
}
ESPDEPRECATED("This method is deprecated, use add_feature_flags() instead", "2025.11.0")
void set_supports_current_temperature(bool supports_current_temperature) {
this->supports_current_temperature_ = supports_current_temperature;
if (supports_current_temperature) {
this->add_feature_flags(CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
} else {
this->clear_feature_flags(CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
}
}
bool get_supports_current_humidity() const { return this->supports_current_humidity_; }
ESPDEPRECATED("This method is deprecated, use get_feature_flags() instead", "2025.11.0")
bool get_supports_current_humidity() const { return this->has_feature_flags(CLIMATE_SUPPORTS_CURRENT_HUMIDITY); }
ESPDEPRECATED("This method is deprecated, use add_feature_flags() instead", "2025.11.0")
void set_supports_current_humidity(bool supports_current_humidity) {
this->supports_current_humidity_ = supports_current_humidity;
if (supports_current_humidity) {
this->add_feature_flags(CLIMATE_SUPPORTS_CURRENT_HUMIDITY);
} else {
this->clear_feature_flags(CLIMATE_SUPPORTS_CURRENT_HUMIDITY);
}
}
bool get_supports_two_point_target_temperature() const { return this->supports_two_point_target_temperature_; }
ESPDEPRECATED("This method is deprecated, use get_feature_flags() instead", "2025.11.0")
bool get_supports_two_point_target_temperature() const {
return this->has_feature_flags(CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE);
}
ESPDEPRECATED("This method is deprecated, use add_feature_flags() instead", "2025.11.0")
void set_supports_two_point_target_temperature(bool supports_two_point_target_temperature) {
this->supports_two_point_target_temperature_ = supports_two_point_target_temperature;
if (supports_two_point_target_temperature)
// Use CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE to mimic previous behavior
{
this->add_feature_flags(CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE);
} else {
this->clear_feature_flags(CLIMATE_REQUIRES_TWO_POINT_TARGET_TEMPERATURE);
}
}
bool get_supports_target_humidity() const { return this->supports_target_humidity_; }
ESPDEPRECATED("This method is deprecated, use get_feature_flags() instead", "2025.11.0")
bool get_supports_target_humidity() const { return this->has_feature_flags(CLIMATE_SUPPORTS_TARGET_HUMIDITY); }
ESPDEPRECATED("This method is deprecated, use add_feature_flags() instead", "2025.11.0")
void set_supports_target_humidity(bool supports_target_humidity) {
this->supports_target_humidity_ = supports_target_humidity;
if (supports_target_humidity) {
this->add_feature_flags(CLIMATE_SUPPORTS_TARGET_HUMIDITY);
} else {
this->clear_feature_flags(CLIMATE_SUPPORTS_TARGET_HUMIDITY);
}
}
void set_supported_modes(std::set<ClimateMode> modes) { this->supported_modes_ = std::move(modes); }
ESPDEPRECATED("This method is deprecated, use get_feature_flags() instead", "2025.11.0")
bool get_supports_action() const { return this->has_feature_flags(CLIMATE_SUPPORTS_ACTION); }
ESPDEPRECATED("This method is deprecated, use add_feature_flags() instead", "2025.11.0")
void set_supports_action(bool supports_action) {
if (supports_action) {
this->add_feature_flags(CLIMATE_SUPPORTS_ACTION);
} else {
this->clear_feature_flags(CLIMATE_SUPPORTS_ACTION);
}
}
void set_supported_modes(ClimateModeMask modes) { this->supported_modes_ = modes; }
void add_supported_mode(ClimateMode mode) { this->supported_modes_.insert(mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_auto_mode(bool supports_auto_mode) { set_mode_support_(CLIMATE_MODE_AUTO, supports_auto_mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_cool_mode(bool supports_cool_mode) { set_mode_support_(CLIMATE_MODE_COOL, supports_cool_mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_heat_mode(bool supports_heat_mode) { set_mode_support_(CLIMATE_MODE_HEAT, supports_heat_mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_heat_cool_mode(bool supported) { set_mode_support_(CLIMATE_MODE_HEAT_COOL, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_fan_only_mode(bool supports_fan_only_mode) {
set_mode_support_(CLIMATE_MODE_FAN_ONLY, supports_fan_only_mode);
}
ESPDEPRECATED("This method is deprecated, use set_supported_modes() instead", "v1.20")
void set_supports_dry_mode(bool supports_dry_mode) { set_mode_support_(CLIMATE_MODE_DRY, supports_dry_mode); }
bool supports_mode(ClimateMode mode) const { return this->supported_modes_.count(mode); }
const std::set<ClimateMode> &get_supported_modes() const { return this->supported_modes_; }
const ClimateModeMask &get_supported_modes() const { return this->supported_modes_; }
void set_supports_action(bool supports_action) { this->supports_action_ = supports_action; }
bool get_supports_action() const { return this->supports_action_; }
void set_supported_fan_modes(std::set<ClimateFanMode> modes) { this->supported_fan_modes_ = std::move(modes); }
void set_supported_fan_modes(ClimateFanModeMask modes) { this->supported_fan_modes_ = modes; }
void add_supported_fan_mode(ClimateFanMode mode) { this->supported_fan_modes_.insert(mode); }
void add_supported_custom_fan_mode(const std::string &mode) { this->supported_custom_fan_modes_.insert(mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_on(bool supported) { set_fan_mode_support_(CLIMATE_FAN_ON, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_off(bool supported) { set_fan_mode_support_(CLIMATE_FAN_OFF, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_auto(bool supported) { set_fan_mode_support_(CLIMATE_FAN_AUTO, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_low(bool supported) { set_fan_mode_support_(CLIMATE_FAN_LOW, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_medium(bool supported) { set_fan_mode_support_(CLIMATE_FAN_MEDIUM, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_high(bool supported) { set_fan_mode_support_(CLIMATE_FAN_HIGH, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_middle(bool supported) { set_fan_mode_support_(CLIMATE_FAN_MIDDLE, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_focus(bool supported) { set_fan_mode_support_(CLIMATE_FAN_FOCUS, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_fan_modes() instead", "v1.20")
void set_supports_fan_mode_diffuse(bool supported) { set_fan_mode_support_(CLIMATE_FAN_DIFFUSE, supported); }
bool supports_fan_mode(ClimateFanMode fan_mode) const { return this->supported_fan_modes_.count(fan_mode); }
bool get_supports_fan_modes() const {
return !this->supported_fan_modes_.empty() || !this->supported_custom_fan_modes_.empty();
}
const std::set<ClimateFanMode> &get_supported_fan_modes() const { return this->supported_fan_modes_; }
const ClimateFanModeMask &get_supported_fan_modes() const { return this->supported_fan_modes_; }
void set_supported_custom_fan_modes(std::set<std::string> supported_custom_fan_modes) {
this->supported_custom_fan_modes_ = std::move(supported_custom_fan_modes);
void set_supported_custom_fan_modes(std::initializer_list<const char *> modes) {
this->supported_custom_fan_modes_ = modes;
}
void set_supported_custom_fan_modes(const std::vector<const char *> &modes) {
this->supported_custom_fan_modes_ = modes;
}
template<size_t N> void set_supported_custom_fan_modes(const char *const (&modes)[N]) {
this->supported_custom_fan_modes_.assign(modes, modes + N);
}
// Deleted overloads to catch incorrect std::string usage at compile time with clear error messages
void set_supported_custom_fan_modes(const std::vector<std::string> &modes) = delete;
void set_supported_custom_fan_modes(std::initializer_list<std::string> modes) = delete;
const std::vector<const char *> &get_supported_custom_fan_modes() const { return this->supported_custom_fan_modes_; }
bool supports_custom_fan_mode(const char *custom_fan_mode) const {
return vector_contains(this->supported_custom_fan_modes_, custom_fan_mode);
}
const std::set<std::string> &get_supported_custom_fan_modes() const { return this->supported_custom_fan_modes_; }
bool supports_custom_fan_mode(const std::string &custom_fan_mode) const {
return this->supported_custom_fan_modes_.count(custom_fan_mode);
return this->supports_custom_fan_mode(custom_fan_mode.c_str());
}
void set_supported_presets(std::set<ClimatePreset> presets) { this->supported_presets_ = std::move(presets); }
void set_supported_presets(ClimatePresetMask presets) { this->supported_presets_ = presets; }
void add_supported_preset(ClimatePreset preset) { this->supported_presets_.insert(preset); }
void add_supported_custom_preset(const std::string &preset) { this->supported_custom_presets_.insert(preset); }
bool supports_preset(ClimatePreset preset) const { return this->supported_presets_.count(preset); }
bool get_supports_presets() const { return !this->supported_presets_.empty(); }
const std::set<climate::ClimatePreset> &get_supported_presets() const { return this->supported_presets_; }
const ClimatePresetMask &get_supported_presets() const { return this->supported_presets_; }
void set_supported_custom_presets(std::set<std::string> supported_custom_presets) {
this->supported_custom_presets_ = std::move(supported_custom_presets);
void set_supported_custom_presets(std::initializer_list<const char *> presets) {
this->supported_custom_presets_ = presets;
}
void set_supported_custom_presets(const std::vector<const char *> &presets) {
this->supported_custom_presets_ = presets;
}
template<size_t N> void set_supported_custom_presets(const char *const (&presets)[N]) {
this->supported_custom_presets_.assign(presets, presets + N);
}
// Deleted overloads to catch incorrect std::string usage at compile time with clear error messages
void set_supported_custom_presets(const std::vector<std::string> &presets) = delete;
void set_supported_custom_presets(std::initializer_list<std::string> presets) = delete;
const std::vector<const char *> &get_supported_custom_presets() const { return this->supported_custom_presets_; }
bool supports_custom_preset(const char *custom_preset) const {
return vector_contains(this->supported_custom_presets_, custom_preset);
}
const std::set<std::string> &get_supported_custom_presets() const { return this->supported_custom_presets_; }
bool supports_custom_preset(const std::string &custom_preset) const {
return this->supported_custom_presets_.count(custom_preset);
return this->supports_custom_preset(custom_preset.c_str());
}
void set_supported_swing_modes(std::set<ClimateSwingMode> modes) { this->supported_swing_modes_ = std::move(modes); }
void set_supported_swing_modes(ClimateSwingModeMask modes) { this->supported_swing_modes_ = modes; }
void add_supported_swing_mode(ClimateSwingMode mode) { this->supported_swing_modes_.insert(mode); }
ESPDEPRECATED("This method is deprecated, use set_supported_swing_modes() instead", "v1.20")
void set_supports_swing_mode_off(bool supported) { set_swing_mode_support_(CLIMATE_SWING_OFF, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_swing_modes() instead", "v1.20")
void set_supports_swing_mode_both(bool supported) { set_swing_mode_support_(CLIMATE_SWING_BOTH, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_swing_modes() instead", "v1.20")
void set_supports_swing_mode_vertical(bool supported) { set_swing_mode_support_(CLIMATE_SWING_VERTICAL, supported); }
ESPDEPRECATED("This method is deprecated, use set_supported_swing_modes() instead", "v1.20")
void set_supports_swing_mode_horizontal(bool supported) {
set_swing_mode_support_(CLIMATE_SWING_HORIZONTAL, supported);
}
bool supports_swing_mode(ClimateSwingMode swing_mode) const { return this->supported_swing_modes_.count(swing_mode); }
bool get_supports_swing_modes() const { return !this->supported_swing_modes_.empty(); }
const std::set<ClimateSwingMode> &get_supported_swing_modes() const { return this->supported_swing_modes_; }
const ClimateSwingModeMask &get_supported_swing_modes() const { return this->supported_swing_modes_; }
float get_visual_min_temperature() const { return this->visual_min_temperature_; }
void set_visual_min_temperature(float visual_min_temperature) {
@@ -180,23 +233,6 @@ class ClimateTraits {
void set_visual_max_humidity(float visual_max_humidity) { this->visual_max_humidity_ = visual_max_humidity; }
protected:
#ifdef USE_API
// The API connection is a friend class to access internal methods
friend class api::APIConnection;
// These methods return references to internal data structures.
// They are used by the API to avoid copying data when encoding messages.
// Warning: Do not use these methods outside of the API connection code.
// They return references to internal data that can be invalidated.
const std::set<ClimateMode> &get_supported_modes_for_api_() const { return this->supported_modes_; }
const std::set<ClimateFanMode> &get_supported_fan_modes_for_api_() const { return this->supported_fan_modes_; }
const std::set<std::string> &get_supported_custom_fan_modes_for_api_() const {
return this->supported_custom_fan_modes_;
}
const std::set<climate::ClimatePreset> &get_supported_presets_for_api_() const { return this->supported_presets_; }
const std::set<std::string> &get_supported_custom_presets_for_api_() const { return this->supported_custom_presets_; }
const std::set<ClimateSwingMode> &get_supported_swing_modes_for_api_() const { return this->supported_swing_modes_; }
#endif
void set_mode_support_(climate::ClimateMode mode, bool supported) {
if (supported) {
this->supported_modes_.insert(mode);
@@ -219,24 +255,41 @@ class ClimateTraits {
}
}
bool supports_current_temperature_{false};
bool supports_current_humidity_{false};
bool supports_two_point_target_temperature_{false};
bool supports_target_humidity_{false};
std::set<climate::ClimateMode> supported_modes_ = {climate::CLIMATE_MODE_OFF};
bool supports_action_{false};
std::set<climate::ClimateFanMode> supported_fan_modes_;
std::set<climate::ClimateSwingMode> supported_swing_modes_;
std::set<climate::ClimatePreset> supported_presets_;
std::set<std::string> supported_custom_fan_modes_;
std::set<std::string> supported_custom_presets_;
/// Find and return the matching custom fan mode pointer from supported modes, or nullptr if not found
/// This is protected as it's an implementation detail - use Climate::find_custom_fan_mode_() instead
const char *find_custom_fan_mode_(const char *custom_fan_mode) const {
return vector_find(this->supported_custom_fan_modes_, custom_fan_mode);
}
/// Find and return the matching custom preset pointer from supported presets, or nullptr if not found
/// This is protected as it's an implementation detail - use Climate::find_custom_preset_() instead
const char *find_custom_preset_(const char *custom_preset) const {
return vector_find(this->supported_custom_presets_, custom_preset);
}
uint32_t feature_flags_{0};
float visual_min_temperature_{10};
float visual_max_temperature_{30};
float visual_target_temperature_step_{0.1};
float visual_current_temperature_step_{0.1};
float visual_min_humidity_{30};
float visual_max_humidity_{99};
climate::ClimateModeMask supported_modes_{climate::CLIMATE_MODE_OFF};
climate::ClimateFanModeMask supported_fan_modes_;
climate::ClimateSwingModeMask supported_swing_modes_;
climate::ClimatePresetMask supported_presets_;
/** Custom mode storage using const char* pointers to eliminate std::string overhead.
*
* Pointers must remain valid for the ClimateTraits lifetime. Safe patterns:
* - String literals: set_supported_custom_fan_modes({"Turbo", "Silent"})
* - Static const data: static const char* MODE = "Eco";
*
* Climate class setters validate pointers are from these vectors before storing.
*/
std::vector<const char *> supported_custom_fan_modes_;
std::vector<const char *> supported_custom_presets_;
};
} // namespace climate

View File

@@ -1,10 +1,9 @@
import logging
from esphome import core
import esphome.codegen as cg
from esphome.components import climate, remote_base, sensor
import esphome.config_validation as cv
from esphome.const import CONF_ID, CONF_SENSOR, CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT
from esphome.const import CONF_SENSOR, CONF_SUPPORTS_COOL, CONF_SUPPORTS_HEAT
from esphome.cpp_generator import MockObjClass
_LOGGER = logging.getLogger(__name__)
@@ -52,26 +51,6 @@ def climate_ir_with_receiver_schema(
)
# Remove before 2025.11.0
def deprecated_schema_constant(config):
type: str = "unknown"
if (id := config.get(CONF_ID)) is not None and isinstance(id, core.ID):
type = str(id.type).split("::", maxsplit=1)[0]
_LOGGER.warning(
"Using `climate_ir.CLIMATE_IR_WITH_RECEIVER_SCHEMA` is deprecated and will be removed in ESPHome 2025.11.0. "
"Please use `climate_ir.climate_ir_with_receiver_schema(...)` instead. "
"If you are seeing this, report an issue to the external_component author and ask them to update it. "
"https://developers.esphome.io/blog/2025/05/14/_schema-deprecations/. "
"Component using this schema: %s",
type,
)
return config
CLIMATE_IR_WITH_RECEIVER_SCHEMA = climate_ir_with_receiver_schema(ClimateIR)
CLIMATE_IR_WITH_RECEIVER_SCHEMA.add_extra(deprecated_schema_constant)
async def register_climate_ir(var, config):
await cg.register_component(var, config)
await remote_base.register_transmittable(var, config)

View File

@@ -8,7 +8,10 @@ static const char *const TAG = "climate_ir";
climate::ClimateTraits ClimateIR::traits() {
auto traits = climate::ClimateTraits();
traits.set_supports_current_temperature(this->sensor_ != nullptr);
if (this->sensor_ != nullptr) {
traits.add_feature_flags(climate::CLIMATE_SUPPORTS_CURRENT_TEMPERATURE);
}
traits.set_supported_modes({climate::CLIMATE_MODE_OFF, climate::CLIMATE_MODE_HEAT_COOL});
if (this->supports_cool_)
traits.add_supported_mode(climate::CLIMATE_MODE_COOL);
@@ -19,7 +22,6 @@ climate::ClimateTraits ClimateIR::traits() {
if (this->supports_fan_only_)
traits.add_supported_mode(climate::CLIMATE_MODE_FAN_ONLY);
traits.set_supports_two_point_target_temperature(false);
traits.set_visual_min_temperature(this->minimum_temperature_);
traits.set_visual_max_temperature(this->maximum_temperature_);
traits.set_visual_temperature_step(this->temperature_step_);

View File

@@ -24,16 +24,18 @@ class ClimateIR : public Component,
public remote_base::RemoteTransmittable {
public:
ClimateIR(float minimum_temperature, float maximum_temperature, float temperature_step = 1.0f,
bool supports_dry = false, bool supports_fan_only = false, std::set<climate::ClimateFanMode> fan_modes = {},
std::set<climate::ClimateSwingMode> swing_modes = {}, std::set<climate::ClimatePreset> presets = {}) {
bool supports_dry = false, bool supports_fan_only = false,
climate::ClimateFanModeMask fan_modes = climate::ClimateFanModeMask(),
climate::ClimateSwingModeMask swing_modes = climate::ClimateSwingModeMask(),
climate::ClimatePresetMask presets = climate::ClimatePresetMask()) {
this->minimum_temperature_ = minimum_temperature;
this->maximum_temperature_ = maximum_temperature;
this->temperature_step_ = temperature_step;
this->supports_dry_ = supports_dry;
this->supports_fan_only_ = supports_fan_only;
this->fan_modes_ = std::move(fan_modes);
this->swing_modes_ = std::move(swing_modes);
this->presets_ = std::move(presets);
this->fan_modes_ = fan_modes;
this->swing_modes_ = swing_modes;
this->presets_ = presets;
}
void setup() override;
@@ -60,9 +62,9 @@ class ClimateIR : public Component,
bool supports_heat_{true};
bool supports_dry_{false};
bool supports_fan_only_{false};
std::set<climate::ClimateFanMode> fan_modes_ = {};
std::set<climate::ClimateSwingMode> swing_modes_ = {};
std::set<climate::ClimatePreset> presets_ = {};
climate::ClimateFanModeMask fan_modes_{};
climate::ClimateSwingModeMask swing_modes_{};
climate::ClimatePresetMask presets_{};
sensor::Sensor *sensor_{nullptr};
};

View File

@@ -13,7 +13,7 @@ static const uint8_t C_M1106_CMD_SET_CO2_CALIB_RESPONSE[4] = {0x16, 0x01, 0x03,
uint8_t cm1106_checksum(const uint8_t *response, size_t len) {
uint8_t crc = 0;
for (int i = 0; i < len - 1; i++) {
for (size_t i = 0; i < len - 1; i++) {
crc -= response[i];
}
return crc;

View File

@@ -11,4 +11,5 @@ CONF_DRAW_ROUNDING = "draw_rounding"
CONF_ON_RECEIVE = "on_receive"
CONF_ON_STATE_CHANGE = "on_state_change"
CONF_REQUEST_HEADERS = "request_headers"
CONF_ROWS = "rows"
CONF_USE_PSRAM = "use_psram"

Some files were not shown because too many files have changed in this diff Show More