Part of #670
Summary
Buttons and code-slot event entities carry no coordinator-derived value; move them off the value
fan-out with a targeted availability signal and audit whether any config entities' coordinator
coupling can be reduced without losing parent/child inheritance, Rental Control writes, provider
PIN read-backs, or access-limit decrements. This implements the new secondary goal raised by
@raman325: reduce entity↔coordinator coupling where safe.
Scope / changes
- Refactor button coordinator handling at
button.py:84-101; it currently updates only
availability and writes state.
- Refactor the code-slot event coordinator-update handler at
event.py:137-152; the displayed
"last used" value remains bus-driven, and coordinator updates only set availability.
- Revisit the base
CoordinatorEntity binding at entity.py:61 for these availability-only
entity types so they no longer subscribe to the coordinator value fan-out.
- Add a lightweight targeted availability dispatch signal fired when a lock's
connected state or
code-slot set changes, and subscribe buttons/code-slot event entities to that signal instead.
- Value-bearing config entities are out of scope for detachment: text name/PIN entities,
datetime/time entities, number access-limit count entities, and config switches must remain
coordinator-driven because parent→child inheritance, Rental Control writes, provider PIN
read-backs, and access-limit decrements propagate through coordinator data. They are in scope
only for a written coupling audit.
Plan reference
New secondary goal in §2 Goals; complements §5.9 change-detection (task-3) and §5.2/§5.8
per-lock work.
Dependencies
Depends on: #677, #681
Acceptance criteria
Risk / notes
Main risk is stale availability if the targeted signal misses a connect, disconnect, or slot-set
transition. Keep value-bearing entities coordinator-driven. This is largely an optimization because
#677 change-detection already neutralizes the storm contribution by making availability-only
entities no-op unless availability flips.
Size
M
Part of #670
Summary
Buttons and code-slot event entities carry no coordinator-derived value; move them off the value
fan-out with a targeted availability signal and audit whether any config entities' coordinator
coupling can be reduced without losing parent/child inheritance, Rental Control writes, provider
PIN read-backs, or access-limit decrements. This implements the new secondary goal raised by
@raman325: reduce entity↔coordinator coupling where safe.
Scope / changes
button.py:84-101; it currently updates onlyavailability and writes state.
event.py:137-152; the displayed"last used" value remains bus-driven, and coordinator updates only set availability.
CoordinatorEntitybinding atentity.py:61for these availability-onlyentity types so they no longer subscribe to the coordinator value fan-out.
connectedstate orcode-slot set changes, and subscribe buttons/code-slot event entities to that signal instead.
datetime/time entities, number access-limit count entities, and config switches must remain
coordinator-driven because parent→child inheritance, Rental Control writes, provider PIN
read-backs, and access-limit decrements propagate through coordinator data. They are in scope
only for a written coupling audit.
Plan reference
New secondary goal in §2 Goals; complements §5.9 change-detection (task-3) and §5.2/§5.8
per-lock work.
Dependencies
Depends on: #677, #681
Acceptance criteria
fan-out and no longer re-render on unrelated coordinator updates.
slot add/remove transitions, with tests.
cannot be detached without losing parent/child, Rental Control, provider read-back, or
access-limit propagation.
ruff check custom_components/ tests/,mypy custom_components/keymaster/,and the targeted platform/entity tests for buttons, events, and audited config entities.
Risk / notes
Main risk is stale availability if the targeted signal misses a connect, disconnect, or slot-set
transition. Keep value-bearing entities coordinator-driven. This is largely an optimization because
#677 change-detection already neutralizes the storm contribution by making availability-only
entities no-op unless availability flips.
Size
M