@@ -137,21 +137,37 @@ async def _async_get_unmanaged_codes(
137137 lock_instances : dict [str , Any ] = {}
138138 for lock_entity_id in lock_entity_ids :
139139 lock_entry = ent_reg .async_get (lock_entity_id )
140- if not lock_entry or lock_entry .platform not in INTEGRATIONS_CLASS_MAP :
140+ if not lock_entry :
141+ _LOGGER .warning (
142+ "Entity %s not found in registry; skipping usercode check" ,
143+ lock_entity_id ,
144+ )
145+ continue
146+ if lock_entry .platform not in INTEGRATIONS_CLASS_MAP :
147+ _LOGGER .debug (
148+ "Lock %s uses unsupported platform %s; skipping usercode check" ,
149+ lock_entity_id ,
150+ lock_entry .platform ,
151+ )
141152 continue
142153 lock_config_entry = hass .config_entries .async_get_entry (
143154 lock_entry .config_entry_id
144155 )
145156 if lock_config_entry is None :
157+ _LOGGER .warning (
158+ "Config entry for lock %s not found; skipping usercode check" ,
159+ lock_entity_id ,
160+ )
146161 continue
147162 lock_instance = INTEGRATIONS_CLASS_MAP [lock_entry .platform ](
148163 hass , dev_reg , ent_reg , lock_config_entry , lock_entry
149164 )
150165 try :
151166 usercodes = await lock_instance .async_internal_get_usercodes ()
152167 except Exception : # noqa: BLE001
153- _LOGGER .debug (
154- "Failed to get usercodes from %s during lock reset check" ,
168+ _LOGGER .warning (
169+ "Failed to get usercodes from %s during lock reset check; "
170+ "this lock's codes will not be shown" ,
155171 lock_entity_id ,
156172 exc_info = True ,
157173 )
@@ -265,6 +281,10 @@ async def async_step_lock_reset_clear(
265281 for lock_entity_id , codes in self ._unmanaged_codes .items ():
266282 lock_instance = self ._lock_instances .get (lock_entity_id )
267283 if not lock_instance :
284+ _LOGGER .warning (
285+ "No lock instance for %s; cannot clear unmanaged codes" ,
286+ lock_entity_id ,
287+ )
268288 continue
269289 for slot in codes :
270290 try :
@@ -314,6 +334,10 @@ async def async_step_lock_reset_adopt(
314334 continue
315335 lock_instance = self ._lock_instances .get (lock_entity_id )
316336 if not lock_instance :
337+ _LOGGER .warning (
338+ "No lock instance for %s; cannot clear masked codes" ,
339+ lock_entity_id ,
340+ )
317341 continue
318342 for slot in masked_slots :
319343 try :
0 commit comments