mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Remove deprecated async_setup_platforms (#91929)
This commit is contained in:
parent
a203149133
commit
739963b5ee
@ -10,7 +10,7 @@ from .const import PLATFORMS
|
|||||||
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Set up brottsplatskartan from a config entry."""
|
"""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
|
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))
|
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
|
return True
|
||||||
|
|
||||||
|
@ -1356,26 +1356,6 @@ class ConfigEntries:
|
|||||||
self.hass, SIGNAL_CONFIG_ENTRY_CHANGED, change_type, entry
|
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(
|
async def async_forward_entry_setups(
|
||||||
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
|
self, entry: ConfigEntry, platforms: Iterable[Platform | str]
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -276,7 +276,7 @@ async def test_remove_entry(
|
|||||||
hass: HomeAssistant, entry: config_entries.ConfigEntry
|
hass: HomeAssistant, entry: config_entries.ConfigEntry
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Mock setting up entry."""
|
"""Mock setting up entry."""
|
||||||
hass.config_entries.async_setup_platforms(entry, ["light"])
|
await hass.config_entries.async_forward_entry_setups(entry, ["light"])
|
||||||
return True
|
return True
|
||||||
|
|
||||||
async def mock_unload_entry(
|
async def mock_unload_entry(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user