Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
24 changes: 11 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ jobs:
- uses: actions/checkout@v7.0.1
- run: git sparse-checkout disable || true

- uses: actions/setup-node@v7
with:
node-version: 26

- name: Install dependencies
run: |
NPM_CACHE="${HOME}/.cache/espcontrol-actions/npm"
mkdir -p "${NPM_CACHE}"
npm ci --prefer-offline --cache "${NPM_CACHE}"
bash scripts/prune_actions_cache.sh "${NPM_CACHE}" "${ESPCONTROL_NPM_CACHE_MAX_MB}" --strategy reset

- name: Generate icon outputs
run: python3 scripts/build.py icons

Expand All @@ -74,19 +85,6 @@ jobs:
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- uses: actions/setup-node@v7
if: steps.icon_changes.outputs.changed == 'true'
with:
node-version: 26

- name: Install dependencies
if: steps.icon_changes.outputs.changed == 'true'
run: |
NPM_CACHE="${HOME}/.cache/espcontrol-actions/npm"
mkdir -p "${NPM_CACHE}"
npm ci --prefer-offline --cache "${NPM_CACHE}"
bash scripts/prune_actions_cache.sh "${NPM_CACHE}" "${ESPCONTROL_NPM_CACHE_MAX_MB}" --strategy reset

- name: Build generated web bundles
if: steps.icon_changes.outputs.changed == 'true'
run: python3 scripts/build.py www
Expand Down
6 changes: 3 additions & 3 deletions common/addon/backlight.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1242,7 +1242,7 @@ script:
condition:
lambda: |-
return !id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
!id(button_order).state.empty();
espcontrol::application_grid_configured(!id(button_order).state.empty());
then:
- delay: 120s
- if:
Expand Down Expand Up @@ -1270,7 +1270,7 @@ script:
lambda: |-
float val = id(home_screen_timeout).state;
return !id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
!id(button_order).state.empty() &&
espcontrol::application_grid_configured(!id(button_order).state.empty()) &&
!std::isnan(val) && val > 0;
then:
- delay: !lambda |-
Expand All @@ -1279,7 +1279,7 @@ script:
return (int)(val * 1000);
- lambda: |-
if (!id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
!id(button_order).state.empty() &&
espcontrol::application_grid_configured(!id(button_order).state.empty()) &&
!alarm_display_takeover_active()) {
navigation_return_home(id(main_page)->obj);
}
Expand Down
5 changes: 4 additions & 1 deletion common/addon/connectivity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,12 @@ script:
mode: restart
then:
- script.execute: setup_screen_dim_cancel
- wait_until:
condition:
lambda: 'return !espcontrol::pooled_application_selected() || espcontrol_navigation_ready();'
- if:
condition:
lambda: 'return !id(button_order).state.empty();'
lambda: 'return espcontrol::application_grid_configured(!id(button_order).state.empty());'
then:
- wait_until:
condition:
Expand Down
5 changes: 4 additions & 1 deletion common/addon/connectivity_deployed.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,12 @@ script:
mode: restart
then:
- script.execute: setup_screen_dim_cancel
- wait_until:
condition:
lambda: 'return !espcontrol::pooled_application_selected() || espcontrol_navigation_ready();'
- if:
condition:
lambda: 'return !id(button_order).state.empty();'
lambda: 'return espcontrol::application_grid_configured(!id(button_order).state.empty());'
then:
- wait_until:
condition:
Expand Down
5 changes: 4 additions & 1 deletion common/addon/connectivity_ethernet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,12 @@ script:
mode: restart
then:
- script.execute: setup_screen_dim_cancel
- wait_until:
condition:
lambda: 'return !espcontrol::pooled_application_selected() || espcontrol_navigation_ready();'
- if:
condition:
lambda: 'return !id(button_order).state.empty();'
lambda: 'return espcontrol::application_grid_configured(!id(button_order).state.empty());'
then:
- wait_until:
condition:
Expand Down
28 changes: 26 additions & 2 deletions common/addon/memory_diagnostics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# MEMORY DIAGNOSTICS - Device memory exposed to Home Assistant
# =============================================================================
# Current free internal heap and free PSRAM exposed as percentages. Raw byte
# sensors are internal and update once per minute through ESPHome's debug
# component.
# sensors update once per minute. Historical minimum-free sensors retain boot
# and temporary allocation peaks that periodic polling can otherwise miss.
# =============================================================================

debug:
Expand All @@ -22,6 +22,30 @@ sensor:
entity_category: diagnostic
internal: true

- platform: template
name: "Memory: Heap Minimum Free Bytes"
id: memory_heap_minimum_free_bytes
icon: mdi:memory
unit_of_measurement: "B"
accuracy_decimals: 0
entity_category: diagnostic
internal: true
update_interval: 60s
lambda: |-
return (float) heap_caps_get_minimum_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_INTERNAL);

- platform: template
name: "Memory: PSRAM Minimum Free Bytes"
id: memory_psram_minimum_free_bytes
icon: mdi:memory
unit_of_measurement: "B"
accuracy_decimals: 0
entity_category: diagnostic
internal: true
update_interval: 60s
lambda: |-
return (float) heap_caps_get_minimum_free_size(MALLOC_CAP_8BIT | MALLOC_CAP_SPIRAM);

- platform: template
name: "Memory: Heap Free"
id: memory_heap_free_percent
Expand Down
2 changes: 1 addition & 1 deletion common/config/display.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ select:
then:
- if:
condition:
lambda: 'return grid_phase2_complete();'
lambda: 'return espcontrol_navigation_ready();'
then:
- script.execute: refresh_subpage_grid

Expand Down
12 changes: 4 additions & 8 deletions common/device/api_remote_actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ script:
lambda: |-
return espcontrol_can_open_modal(entity_id,
!id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
grid_phase2_complete() &&
!navigation_home_targets().empty());
espcontrol_navigation_ready());
then:
- script.execute: screensaver_wake
- script.wait: screensaver_wake
Expand All @@ -37,8 +36,7 @@ script:
lambda: |-
return espcontrol_open_modal(entity_id,
!id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
grid_phase2_complete() &&
!navigation_home_targets().empty());
espcontrol_navigation_ready());
then:
- script.execute: screensaver_idle_check
- script.execute: home_screen_idle_check
Expand All @@ -55,8 +53,7 @@ script:
lambda: |-
return espcontrol_can_open_subpage(label,
!id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
grid_phase2_complete() &&
!navigation_home_targets().empty());
espcontrol_navigation_ready());
then:
- script.execute: screensaver_wake
- script.wait: screensaver_wake
Expand All @@ -65,8 +62,7 @@ script:
lambda: |-
return espcontrol_can_open_subpage(label,
!id(connectivity_setup_display_active) && !id(ha_connection_warning_active) &&
grid_phase2_complete() &&
!navigation_home_targets().empty());
espcontrol_navigation_ready());
then:
- lambda: |-
espcontrol_open_subpage(label,
Expand Down
7 changes: 4 additions & 3 deletions common/device/button_widget.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ button:
return id(espcontrol_app).display().target_mode_is(
espcontrol::DisplayMode::ACTIVE);
then:
- lambda: 'handle_button_press(id(button_${num}_config).state, ${num}, id(button_${num}));'
- lambda: 'if (!espcontrol::pooled_application_selected()) handle_button_press(id(button_${num}_config).state, ${num}, id(button_${num}));'
on_short_click:
- if:
condition:
Expand All @@ -94,7 +94,7 @@ button:
then:
- script.execute: screensaver_wake
else:
- lambda: 'handle_button_click(id(button_${num}_config).state, ${num}, id(button_${num}));'
- lambda: 'if (!espcontrol::pooled_application_selected()) handle_button_click(id(button_${num}_config).state, ${num}, id(button_${num}));'
on_long_press:
- if:
condition:
Expand All @@ -116,4 +116,5 @@ button:
else:
- lambda: |-
ESP_LOGD("button", "Treating grid card long press as normal tap for slot ${num}");
handle_button_click(id(button_${num}_config).state, ${num}, id(button_${num}));
if (!espcontrol::pooled_application_selected())
handle_button_click(id(button_${num}_config).state, ${num}, id(button_${num}));
9 changes: 9 additions & 0 deletions common/device/psram_malloc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Large SDK-owned containers also need PSRAM; explicit RAMAllocator users do
# not cover ordinary std::vector allocations such as native HA subscriptions.
# Keep small allocations internal and protect DMA/cache-disabled allocations.
esp32:
framework:
sdkconfig_options:
CONFIG_SPIRAM_USE_MALLOC: "y"
CONFIG_SPIRAM_MALLOC_ALWAYSINTERNAL: "4096"
CONFIG_SPIRAM_MALLOC_RESERVE_INTERNAL: "32768"
6 changes: 6 additions & 0 deletions compatibility/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ Use these fixtures for saved button config strings, subpage config strings,
backup import/export behavior, cross-device layout adaptation, and legacy card
migrations. Do not change fixture expectations unless the user-facing migration
behavior is intentionally changing.

The [page runtime baseline](page-runtime-baseline.md) records the device capacity
contract and measurement procedure for the staged architecture migration.

- [Modal lifetime and climate adapter](page-modal-lifecycle.md): deferred
context retirement, input guards and the remaining physical cutover gates.
57 changes: 57 additions & 0 deletions compatibility/application-scene-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Application scene integration

This #1825 stage connects a prepared scene's lifetime to the actual ESPHome
application. It also incorporates current main, including ESPHome 2026.10.0 and
stale forecast cards retaining normal geometry. The concrete pooled scene and
device widget/port wiring are still being assembled; production still selects
the existing renderer. No nesting, migration, backup format or physical memory
saving is enabled by this bridge alone.

`ApplicationSceneRuntime` implements the existing configuration runtime adapter
and provides structural readiness, safe-maintenance readiness, loop and stop.
The firmware application's UI owner installs one fully initialized scene before
native configuration begins. The scene and its resources outlive the component.
An unready scene, replacement owner, late installation or shutdown registration
is rejected. Reinstalling the same ready owner is idempotent. A running legacy
grid is never silently replaced.

When installed, the actual application chooses this adapter for the native
configuration service, so browser writes and boot restore use the existing
prepare/commit/activate protocol and downgrade mirror. Without an installed
scene the legacy adapter and startup timing remain selected.

The application only processes queued configuration transactions when scene
maintenance is safe. The initial boot timeout still establishes the restoration
delay. If a producer/native/LVGL callback boundary is busy when it fires, boot
application stays pending for a later safe loop without allocating more timers.
The reload uses the latest durable document, so a browser save cannot be undone
by an earlier startup snapshot. Scene readiness is queried again after HA/core
maintenance before the scene's loop runs.

Shutdown stops the transaction queue before revoking scene input/actions. The
scene's stop implementation must defer widget/context collection if dispatch is
active. Further app loops, delayed boot application and installations are
rejected after shutdown. This does not add an alternative store, HTTP path,
per-card callback or document copy.

Host sanitizer tests extract the complete production application methods and
exercise them with the real configuration service, durable store and main-loop
transaction queue. ESPHome endpoint/core/device storage objects are doubled.
Checks include selected/legacy adapter behavior, registration timing, queued
browser writes while busy, a due boot restore reloading the newest committed
document, prepare failure, an HA callback changing readiness, pending requests
released during shutdown, and 1,000 startup/restore/shutdown cycles.

Current-main forecast behavior is shared by the legacy widgets and pooled draw
frame: stale status stays in the details modal and cannot shrink card geometry
or introduce the retired side-by-side list. The independent forecast widget
checks and native frame parity remain required after integration.

The [native modal bank](native-modal-bank.md) now assembles the fifteen demanded
panel kinds and their deferred command adapters under one owner.

Next assemble and install the concrete scene, retire compiled eager grid/action
wiring, qualify all current factory builds and capture matched S3/20-slot P4
runtime memory and interaction behavior. Keep P4-86 reserved for its separate
USB diagnosis. Device testing and storage/compatibility gates precede nested
pages; do not merge hardware-dependent work before user confirmation.
4 changes: 2 additions & 2 deletions compatibility/fixtures/card_runtime_coverage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Card Runtime Coverage

Generated by `scripts/generate_card_runtime_coverage.js` from the card contract and runtime inventory.
It records the pre-migration baseline; it does not move executable behaviour into generated data.
It records the declared runtime surface; it does not move executable behaviour into generated data.

- Contract types: 45
- Runtime-only types: 3
Expand Down Expand Up @@ -47,7 +47,7 @@ It records the pre-migration baseline; it does not move executable behaviour int
| sensor | canonical | sensor | informationOnly, subscriptions, runtimeAllocation, subpage | sensor | sensor | SENSOR | 5 |
| local_sensor | accepted_legacy_input | sensor | informationOnly, subscriptions, subpage | sensor | sensor | LOCAL_SENSOR | 1 |
| slider | canonical | numeric | subscriptions, actions, numericControl, runtimeAllocation, subpage | slider | slider | SLIDER | 1 |
| subpage | canonical | subpage | actions, runtimeAllocation | subpage | subpage | SUBPAGE | 1 |
| subpage | canonical | subpage | actions, runtimeAllocation, subpage | subpage | subpage | SUBPAGE | 1 |
| timezone | canonical | date_time | informationOnly, subscriptions, subpage | timezone | timezone | DATE_TIME | 1 |
| weather | canonical | weather | informationOnly, subscriptions, actions, modal, runtimeAllocation, subpage | weather | weather | WEATHER | 15 |
| image | canonical | image | informationOnly, subscriptions, actions, modal, runtimeAllocation, subpage | image | image | IMAGE | 1 |
Expand Down
2 changes: 1 addition & 1 deletion compatibility/fixtures/card_runtime_surface_baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2688,7 +2688,7 @@
"registration": "subpage",
"picker": {
"main": true,
"subpage": false,
"subpage": true,
"infoOnly": false
},
"preview": {
Expand Down
Loading