Skip to content

fix: respect hide_pins on child lock parent-view dashboard#600

Open
raman325 wants to merge 2 commits intoFutureTense:mainfrom
raman325:fix/597-child-hide-pins
Open

fix: respect hide_pins on child lock parent-view dashboard#600
raman325 wants to merge 2 commits intoFutureTense:mainfrom
raman325:fix/597-child-hide-pins

Conversation

@raman325
Copy link
Copy Markdown
Collaborator

@raman325 raman325 commented Apr 17, 2026

Summary

  • Fixes ISSUE: Hide Pin Not working on Child Lock v.0.3.0 (similar to Issue #476) #597: child lock dashboard showed parent's PINs in plaintext even when hide_pins was enabled on both locks.
  • When hide_pins is true, removes the simple-entity PIN row from the parent-view entities card and adds a read-only Jinja2 markdown card (via vertical-stack) showing "Slot occupied" / "Empty" instead.
  • Extracts resolve_entity_id() from the _map_property_to_entity_id pipeline so callers can resolve individual property paths to real HA entity IDs without the full recursive mapping.

Why

The child lock's parent-view card (shown when override_parent is off) used type: simple-entity for all parent entities including the PIN. The simple-entity card type renders the raw entity state, bypassing TextMode.PASSWORD masking — so PINs were visible on the child dashboard even when hide_pins was enabled.

The default text entity row can't be used either because it has inline editing that tap_action: none doesn't block. A markdown card is read-only by nature, uses no custom card dependencies, and uses Jinja2 to show occupancy status without revealing the PIN value. Since markdown is a card type (not a valid entities-row type), it's placed alongside the entities card in a vertical-stack.

Test plan

  • pytest --no-cov -q — 648 passed
  • test_generate_view_config_child_lock_hide_pins — verifies vertical-stack structure: entities card (no PIN row) + markdown card with "Slot occupied"/"Empty" template
  • test_generate_view_config_child_lock_no_hide_pins — verifies entities card keeps simple-entity PIN row, no vertical-stack
  • Manual verification on a child lock dashboard with hide_pins enabled

🤖 Generated with Claude Code

…se#597)

The child lock's auto-generated dashboard has a parent-view card (shown
when override_parent is off) that displayed the parent's PIN using
`type: simple-entity`. That card type renders the raw entity state,
bypassing the text entity's `TextMode.PASSWORD` masking — so PINs were
visible on the child dashboard even when hide_pins was enabled on both
parent and child.

When hide_pins is true, replace the simple-entity PIN row with a
read-only Jinja2 markdown card that shows "Slot occupied" or "Empty"
without revealing the PIN value. When hide_pins is false, keep the
existing simple-entity behavior.

Also extract `resolve_entity_id()` from the `_map_property_to_entity_id`
pipeline so callers can resolve individual property paths to real HA
entity IDs without running the full recursive mapping. The markdown card
needs the resolved entity ID at generation time for the Jinja2 template.

Fixes FutureTense#597.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 17, 2026 03:26
@github-actions github-actions Bot added the bugfix Fixes a bug label Apr 17, 2026
@raman325 raman325 changed the title fix: respect hide_pins on child lock parent-view dashboard (#597) fix: respect hide_pins on child lock parent-view dashboard Apr 17, 2026
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.24%. Comparing base (cdb4922) to head (7fdff60).
⚠️ Report is 80 commits behind head on main.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #600      +/-   ##
==========================================
+ Coverage   84.14%   90.24%   +6.09%     
==========================================
  Files          10       28      +18     
  Lines         801     3535    +2734     
==========================================
+ Hits          674     3190    +2516     
- Misses        127      345     +218     
Flag Coverage Δ
python 90.24% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes a security/privacy leak where a child lock’s parent-view dashboard could display the parent lock’s PINs in plaintext despite hide_pins being enabled.

Changes:

  • Plumbs hide_pins through lovelace generation entrypoints (setup/service/websocket) into view/section generation.
  • Updates child-lock parent-view generation to replace the parent PIN row when hide_pins=True.
  • Adds tests covering hide-pins vs non-hide-pins behavior for child lock parent-view.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
custom_components/keymaster/lovelace.py Adds hide_pins support, resolves parent PIN entity id, and changes child parent-view PIN rendering.
custom_components/keymaster/__init__.py Passes hide_pins from config entry into lovelace generation at setup time.
custom_components/keymaster/services.py Passes hide_pins into regenerated lovelace output.
custom_components/keymaster/websocket.py Includes hide_pins in websocket-generated section config.
tests/test_lovelace.py Adds tests asserting the PIN row structure changes based on hide_pins.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread custom_components/keymaster/lovelace.py Outdated
Comment thread tests/test_lovelace.py Outdated
The markdown card type cannot be used as an entities-row inside an
entities card. When hide_pins is active, wrap the parent-view content
in a vertical-stack: the entities card (with the PIN row removed) plus
a standalone markdown card showing slot occupancy.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ISSUE: Hide Pin Not working on Child Lock v.0.3.0 (similar to Issue #476)

3 participants