Skip to content

feat: add keymaster/list_locks websocket command for dashboard strategy#543

Merged
raman325 merged 5 commits intoFutureTense:betafrom
raman325:fix/dashboard-use-title
Jan 15, 2026
Merged

feat: add keymaster/list_locks websocket command for dashboard strategy#543
raman325 merged 5 commits intoFutureTense:betafrom
raman325:fix/dashboard-use-title

Conversation

@raman325
Copy link
Collaborator

@raman325 raman325 commented Jan 15, 2026

Summary

Add a new keymaster/list_locks WebSocket command that returns entry_id and lock_name for all configured locks. This replaces the use of Home Assistant's generic config_entries/get API which excludes the data field for security reasons.

Proposed change

  • Add ws_list_locks WebSocket command to websocket.py that returns a list of locks with entry_id and lock_name
  • Update dashboard-strategy.ts to use keymaster/list_locks instead of config_entries/get
  • Simplify types.ts with new KeymasterLockEntry interface
  • Add Python tests for the new WebSocket command

Type of change

  • Bugfix (non-breaking change which fixes an issue)

Additional information

🤖 Generated with Claude Code

The config_entries/get WebSocket API does not return the 'data' field
(it's excluded for security reasons). Use 'title' instead, which
contains the lock name set during config flow.

Fixes dashboard strategy showing "No Keymaster configurations found!"
for fully managed dashboards.

Introduced in FutureTense#536.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings January 15, 2026 00:21
Copy link

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

This PR fixes a bug where the dashboard strategy was attempting to access entry.data.lockname, which is not available because Home Assistant's config_entries/get WebSocket API intentionally excludes the data field for security reasons. The fix uses entry.title instead, which contains the lock name.

Changes:

  • Removed the data field from the KeymasterConfigEntry interface
  • Updated all references from entry.data.lockname to entry.title in the dashboard strategy
  • Updated tests to reflect the new structure and validation logic

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
lovelace_strategy/types.ts Removed data field from KeymasterConfigEntry interface and added documentation explaining the API behavior
lovelace_strategy/dashboard-strategy.ts Updated filtering, sorting, and title assignment to use entry.title instead of entry.data.lockname
lovelace_strategy/dashboard-strategy.test.ts Updated mock factory and test cases to remove data field and validate title filtering

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

@codecov-commenter
Copy link

codecov-commenter commented Jan 15, 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 81.86%. Comparing base (a9a30ef) to head (ff6ace8).
⚠️ Report is 4 commits behind head on beta.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             beta     #543      +/-   ##
==========================================
+ Coverage   80.86%   81.86%   +0.99%     
==========================================
  Files          19       28       +9     
  Lines        2341     2569     +228     
  Branches        0       24      +24     
==========================================
+ Hits         1893     2103     +210     
- Misses        448      466      +18     
Flag Coverage Δ
python 82.17% <100.00%> (?)
typescript 71.79% <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.

raman325 and others added 2 commits January 14, 2026 19:23
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace config_entries/get with a custom keymaster/list_locks command
that returns entry_id and lock_name directly. This avoids issues with
HA's config_entries/get API not exposing the 'data' field.

Changes:
- Add ws_list_locks to websocket.py
- Update dashboard-strategy.ts to use keymaster/list_locks
- Simplify types.ts with KeymasterLockEntry
- Update tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@raman325 raman325 changed the title fix: use entry.title instead of entry.data for config entries feat: add keymaster/list_locks websocket command for dashboard strategy Jan 15, 2026
@raman325 raman325 added bug Something isn't working enhancement New feature or request bugfix Fixes a bug labels Jan 15, 2026
- Update test_async_setup_registers_commands for 3 commands
- Add test_ws_list_locks_returns_all_locks
- Add test_ws_list_locks_empty_when_no_entries

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@raman325 raman325 removed bug Something isn't working enhancement New feature or request labels Jan 15, 2026
Only return enabled config entries from the keymaster/list_locks
WebSocket command.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@raman325 raman325 merged commit 2db5a9f into FutureTense:beta Jan 15, 2026
6 checks passed
@raman325 raman325 deleted the fix/dashboard-use-title branch January 18, 2026 17:22
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.

3 participants