mirror of
https://github.com/home-assistant/core.git
synced 2026-12-03 04:08:19 -04:00
Replace unreachable MQTT discovery teardown guard with TYPE_CHECKING assert (#183913)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
3a68fd7b05
commit
1590549e5b
@@ -1261,8 +1261,8 @@ class MqttDiscoveryUpdateMixin(Entity):
|
||||
disabled entity), a registry hook is installed so the retained discovery
|
||||
topic is cleared if the entity is later removed from the registry.
|
||||
"""
|
||||
if self._discovery_data is None:
|
||||
return
|
||||
if TYPE_CHECKING:
|
||||
assert self._discovery_data is not None
|
||||
if not self._added_to_hass and self.registry_entry is not None:
|
||||
discovery_hash: tuple[str, str] = self._discovery_data[ATTR_DISCOVERY_HASH]
|
||||
self._registry_hooks[discovery_hash] = (
|
||||
|
||||
Reference in New Issue
Block a user