Skip to content

Commit 126ceec

Browse files
raman325claude
andcommitted
Remove unused fallback pin_used event type
Since the event entity becomes unavailable when no locks support code slot events, the fallback to EVENT_PIN_USED was never visible. - Remove fallback in _compute_event_types() - return empty list instead - Remove fallback in _handle_event() - log warning and return early if event data is missing lock entity ID Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent f329b79 commit 126ceec

File tree

1 file changed

+5
-6
lines changed
  • custom_components/lock_code_manager

1 file changed

+5
-6
lines changed

custom_components/lock_code_manager/event.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ def _compute_event_types(self) -> list[str]:
127127
if last_event_type and last_event_type not in supported_lock_ids:
128128
return list(supported_lock_ids | {last_event_type})
129129

130-
return list(supported_lock_ids) if supported_lock_ids else [EVENT_PIN_USED]
130+
return list(supported_lock_ids)
131131

132132
@property
133133
def event_types(self) -> list[str]:
@@ -176,11 +176,10 @@ def _handle_event(self, event: Event) -> None:
176176
_trigger_event stores the event type internally in EventEntity.
177177
"""
178178
lock_entity_id = event.data.get(ATTR_ENTITY_ID)
179-
if lock_entity_id:
180-
self._trigger_event(lock_entity_id, event.data)
181-
else:
182-
# Fallback to generic event type if no lock entity ID
183-
self._trigger_event(EVENT_PIN_USED, event.data)
179+
if not lock_entity_id:
180+
_LOGGER.warning("Received event without lock entity ID: %s", event.data)
181+
return
182+
self._trigger_event(lock_entity_id, event.data)
184183
self.async_write_ha_state()
185184

186185
@callback

0 commit comments

Comments
 (0)