Only check support_entry_unload/support_remove_from_device once (#92041)

This commit is contained in:
J. Nick Koston
2023-04-26 03:23:18 -05:00
committed by GitHub
parent 5399dfd39d
commit cf69da40f3
2 changed files with 10 additions and 8 deletions

View File

@@ -294,10 +294,10 @@ class ConfigEntry:
self.disabled_by = disabled_by
# Supports unload
self.supports_unload = False
self.supports_unload: bool | None = None
# Supports remove device
self.supports_remove_device = False
self.supports_remove_device: bool | None = None
# Listeners to call on update
self.update_listeners: list[
@@ -340,10 +340,12 @@ class ConfigEntry:
if self.domain == integration.domain:
self.async_set_state(hass, ConfigEntryState.SETUP_IN_PROGRESS, None)
self.supports_unload = await support_entry_unload(hass, self.domain)
self.supports_remove_device = await support_remove_from_device(
hass, self.domain
)
if self.supports_unload is None:
self.supports_unload = await support_entry_unload(hass, self.domain)
if self.supports_remove_device is None:
self.supports_remove_device = await support_remove_from_device(
hass, self.domain
)
try:
component = integration.get_component()