Remove deprecated async_setup_platforms (#91929)
parent
a203149133
commit
739963b5ee
|
@ -10,7 +10,7 @@ from .const import PLATFORMS
|
|||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||
"""Set up brottsplatskartan from a config entry."""
|
||||
|
||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||
|
||||
entry.async_on_unload(entry.add_update_listener(async_update_listener))
|
||||
|
||||
hass.config_entries.async_setup_platforms(entry, PLATFORMS)
|
||||
await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
|
||||
|
||||
return True
|
||||
|
||||
|
|
|
@ -1356,26 +1356,6 @@ class ConfigEntries:
|
|||
self.hass, SIGNAL_CONFIG_ENTRY_CHANGED, change_type, entry
|
||||
)
|
||||
|
||||
@callback
|
||||
def async_setup_platforms(
|
||||
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
|
||||
) -> None:
|
||||
"""Forward the setup of an entry to platforms."""
|
||||
report(
|
||||
(
|
||||
"called async_setup_platforms instead of awaiting"
|
||||
" async_forward_entry_setups; this will fail in version 2023.3"
|
||||
),
|
||||
# Raise this to warning once all core integrations have been migrated
|
||||
level=logging.WARNING,
|
||||
error_if_core=False,
|
||||
)
|
||||
for platform in platforms:
|
||||
self.hass.async_create_task(
|
||||
self.async_forward_entry_setup(entry, platform),
|
||||
f"config entry forward setup {entry.title} {entry.domain} {entry.entry_id} {platform}",
|
||||
)
|
||||
|
||||
async def async_forward_entry_setups(
|
||||
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
|
||||
) -> None:
|
||||
|
|
|
@ -276,7 +276,7 @@ async def test_remove_entry(
|
|||
hass: HomeAssistant, entry: config_entries.ConfigEntry
|
||||
) -> bool:
|
||||
"""Mock setting up entry."""
|
||||
hass.config_entries.async_setup_platforms(entry, ["light"])
|
||||
await hass.config_entries.async_forward_entry_setups(entry, ["light"])
|
||||
return True
|
||||
|
||||
async def mock_unload_entry(
|
||||
|
|
Loading…
Reference in New Issue