Skip to content

Fix missing page title when calling action entity_details_show#65

Merged
edwardtfn merged 5 commits intomainfrom
v9999.99.9
Mar 25, 2026
Merged

Fix missing page title when calling action entity_details_show#65
edwardtfn merged 5 commits intomainfrom
v9999.99.9

Conversation

@edwardtfn
Copy link
Copy Markdown
Owner

@edwardtfn edwardtfn commented Mar 25, 2026

Summary by CodeRabbit

  • New Features

    • Dynamic page routing for more reliable navigation and accurate page-specific UI updates.
    • Standardized entity title/icon behavior for consistent headers across pages.
  • Chores

    • Blueprint bumped from 12 → 13.
    • Removed many static page ID overrides in favor of runtime page resolution across pages.
  • Documentation

    • API/docs examples updated: removed page_title and friendly_name action parameters.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 79cccfc8-8de6-4139-9afc-396bcfb6f171

📥 Commits

Reviewing files that changed from the base of the PR and between 18ab2b2 and acd449f.

📒 Files selected for processing (1)
  • esphome/nspanel_esphome_page_media_player.yaml

📝 Walkthrough

Walkthrough

This PR replaces many compile-time PAGE/BOOT_STEP substitutions with runtime get_page_id("...") lookups across ESPHome YAMLs, removes several unused substitutions, and bumps the blueprint version while consolidating entity-detail title/icon rendering.

Changes

Cohort / File(s) Summary
Runtime page ID resolution
esphome/nspanel_esphome_addon_climate_base.yaml, esphome/nspanel_esphome_api.yaml, esphome/nspanel_esphome_page_alarm.yaml, esphome/nspanel_esphome_page_boot.yaml, esphome/nspanel_esphome_page_climate.yaml, esphome/nspanel_esphome_page_confirm.yaml, esphome/nspanel_esphome_page_fan.yaml, esphome/nspanel_esphome_page_home.yaml, esphome/nspanel_esphome_page_keyb_num.yaml, esphome/nspanel_esphome_page_light.yaml, esphome/nspanel_esphome_page_media_player.yaml, esphome/nspanel_esphome_page_notification.yaml, esphome/nspanel_esphome_page_qrcode.yaml, esphome/nspanel_esphome_page_screensaver.yaml, esphome/nspanel_esphome_page_settings.yaml, esphome/nspanel_esphome_page_water_heater.yaml, esphome/nspanel_esphome_page_weather.yaml
Replaced static ${PAGE_*_ID}/${BOOT_STEP_*} comparisons and navigation targets with get_page_id("page_name") calls in lambdas, guards, page-change handlers, and goto_page executions.
Substitution removals / minor pages
esphome/nspanel_esphome_page_button.yaml, esphome/nspanel_esphome_page_buttons.yaml, esphome/nspanel_esphome_page_cover.yaml, esphome/nspanel_esphome_page_entities.yaml, esphome/nspanel_esphome_page_utilities.yaml
Deleted unused PAGE_*_ID / BOOT_STEP_* substitutions; retained page logic, adapting to dynamic lookups where applicable.
Screensaver / display light examples
esphome/nspanel_esphome_addon_display_light.yaml, .test/esphome_common_customizations.yaml, esphome/nspanel_esphome_page_screensaver.yaml
Replaced ${PAGE_SCREENSAVER_ID} with get_page_id("screensaver") in wake/sleep, brightness, and navigation guards.
Blueprint & version bump
nspanel_easy_blueprint.yaml, esphome/nspanel_esphome_version.yaml
Bumped blueprint min version 12→13; added reusable anchor &entity_details_title_with_icon, unified per-page entity variables to entity_id, and applied shared title/icon rendering across entity-detail refresh flows.
Docs and examples
docs/api.md, docs/customization.md
Removed page_title from page_alarm and friendly_name from page_media_player docs; updated examples to use get_page_id("screensaver") instead of substitution constants.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 I hopped through YAML, swapped IDs at runtime,
No more carved numbers — pages dance in rhyme.
I tuck icons and titles in a neat little stash,
Version bumped, anchors set — a happy little dash.
Carrots for code, and a joyful hop — hooray!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses a specific bug fix: restoring missing page title when the entity_details_show action is called. It aligns well with the blueprint-level changes that introduced entity_details_title_with_icon and updated page refresh flows to properly set page titles.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v9999.99.9

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

It should still be resolved at compiling time
@edwardtfn edwardtfn marked this pull request as ready for review March 25, 2026 15:37
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nspanel_easy_blueprint.yaml`:
- Around line 7756-7782: The shared alias &entity_details_title_with_icon
currently writes both page_label and icon_state, causing duplicate writers when
used by pages that already own those fields (e.g.,
nspanel_esphome_page_media_player.yaml owns page_label and
nspanel_esphome_page_alarm.yaml owns both); split this helper into two smaller
aliases (e.g., &entity_details_title and &entity_details_icon) or add guards so
it only writes page_label or icon_state when the target page does not already
define them — update references that call &entity_details_title_with_icon to
call the appropriate new alias(es) instead, and ensure the actions referencing
ids page_label and icon_state and the alias name &entity_details_title_with_icon
are adjusted accordingly.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6f67410a-1c64-4590-871a-2cda0fa2c0c8

📥 Commits

Reviewing files that changed from the base of the PR and between 777f6a5 and d7c6c8e.

📒 Files selected for processing (24)
  • esphome/nspanel_esphome_addon_climate_base.yaml
  • esphome/nspanel_esphome_api.yaml
  • esphome/nspanel_esphome_page_alarm.yaml
  • esphome/nspanel_esphome_page_boot.yaml
  • esphome/nspanel_esphome_page_button.yaml
  • esphome/nspanel_esphome_page_buttons.yaml
  • esphome/nspanel_esphome_page_climate.yaml
  • esphome/nspanel_esphome_page_confirm.yaml
  • esphome/nspanel_esphome_page_cover.yaml
  • esphome/nspanel_esphome_page_entities.yaml
  • esphome/nspanel_esphome_page_fan.yaml
  • esphome/nspanel_esphome_page_home.yaml
  • esphome/nspanel_esphome_page_keyb_num.yaml
  • esphome/nspanel_esphome_page_light.yaml
  • esphome/nspanel_esphome_page_media_player.yaml
  • esphome/nspanel_esphome_page_notification.yaml
  • esphome/nspanel_esphome_page_qrcode.yaml
  • esphome/nspanel_esphome_page_screensaver.yaml
  • esphome/nspanel_esphome_page_settings.yaml
  • esphome/nspanel_esphome_page_utilities.yaml
  • esphome/nspanel_esphome_page_water_heater.yaml
  • esphome/nspanel_esphome_page_weather.yaml
  • esphome/nspanel_esphome_version.yaml
  • nspanel_easy_blueprint.yaml
💤 Files with no reviewable changes (4)
  • esphome/nspanel_esphome_page_button.yaml
  • esphome/nspanel_esphome_page_cover.yaml
  • esphome/nspanel_esphome_page_utilities.yaml
  • esphome/nspanel_esphome_page_buttons.yaml

Comment thread nspanel_easy_blueprint.yaml
Same thing for some remaining points
Prefer on Blueprint side to keep a common constructor between pages
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
esphome/nspanel_esphome_page_media_player.yaml (1)

73-75: Keep get_page_id() keyed off the existing page-name substitution.

Line 14 already centralizes the page name, and Line 195 still uses ${PAGE_MEDIA_PLAYER_NAME} for display events. Hardcoding "media_player" here creates a second source of truth, so a later rename/override will desync the page gate from the event handler and page_change hook.

Proposed fix
-            if (current_page_id != get_page_id("media_player")) {
+            if (current_page_id != get_page_id("${PAGE_MEDIA_PLAYER_NAME}")) {
               ESP_LOGW("${TAG_PAGE_MEDIA_PLAYER}", "Not on Media Player page");
               return;
             }
@@
-      - lambda: if (new_page_id == get_page_id("media_player")) page_media_player->execute();
+      - lambda: if (new_page_id == get_page_id("${PAGE_MEDIA_PLAYER_NAME}")) page_media_player->execute();

Also applies to: 254-254

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@esphome/nspanel_esphome_page_media_player.yaml` around lines 73 - 75, Replace
the hardcoded page name literal in the page-check with the centralized
substitution variable so the gate stays in sync: use the existing
PAGE_MEDIA_PLAYER_NAME substitution when calling get_page_id (i.e., call
get_page_id("${PAGE_MEDIA_PLAYER_NAME}") wherever get_page_id("media_player")
appears). Update both occurrences (the one comparing current_page_id in the
handler and the other at line ~254) so get_page_id, current_page_id,
TAG_PAGE_MEDIA_PLAYER and the page_change hook all reference the same
"${PAGE_MEDIA_PLAYER_NAME}" substitution.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@nspanel_easy_blueprint.yaml`:
- Around line 7756-7782: The helper alias entity_details_title_with_icon
currently writes page_label and icon_state to page: "" which can race with
navigation; change the helper to target a variable page (use page: '{{
entity_details_page }}' instead of empty string) and ensure every call site that
invokes *entity_details_title_with_icon sets entity_details_page beforehand
(e.g., variables: { entity_details_page: '{{ pages.cover }}' } or the
appropriate pages.fan/pages.media_player/etc.) so the header writes are directed
to the intended details page and avoid stale-page races.

---

Nitpick comments:
In `@esphome/nspanel_esphome_page_media_player.yaml`:
- Around line 73-75: Replace the hardcoded page name literal in the page-check
with the centralized substitution variable so the gate stays in sync: use the
existing PAGE_MEDIA_PLAYER_NAME substitution when calling get_page_id (i.e.,
call get_page_id("${PAGE_MEDIA_PLAYER_NAME}") wherever
get_page_id("media_player") appears). Update both occurrences (the one comparing
current_page_id in the handler and the other at line ~254) so get_page_id,
current_page_id, TAG_PAGE_MEDIA_PLAYER and the page_change hook all reference
the same "${PAGE_MEDIA_PLAYER_NAME}" substitution.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6c492762-945f-40b6-8457-87f53962937f

📥 Commits

Reviewing files that changed from the base of the PR and between d7c6c8e and 18ab2b2.

📒 Files selected for processing (8)
  • .test/esphome_common_customizations.yaml
  • docs/api.md
  • docs/customization.md
  • esphome/nspanel_esphome_addon_display_light.yaml
  • esphome/nspanel_esphome_page_alarm.yaml
  • esphome/nspanel_esphome_page_media_player.yaml
  • esphome/nspanel_esphome_page_screensaver.yaml
  • nspanel_easy_blueprint.yaml
💤 Files with no reviewable changes (1)
  • docs/api.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • esphome/nspanel_esphome_page_screensaver.yaml

Comment thread nspanel_easy_blueprint.yaml
Page name won't change without sync everywhere, so there's no need for a substitution here
@edwardtfn edwardtfn enabled auto-merge March 25, 2026 17:20
@edwardtfn edwardtfn merged commit bb1523d into main Mar 25, 2026
32 checks passed
@edwardtfn edwardtfn deleted the v9999.99.9 branch March 25, 2026 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant