mirror of
https://github.com/home-assistant/core.git
synced 2025-07-26 06:37:52 +00:00
Group wemo platform forwards to reduce overhead (#113972)
This commit is contained in:
parent
79f2eaaf41
commit
abb217086f
@ -193,6 +193,7 @@ class WemoDispatcher:
|
|||||||
|
|
||||||
platforms = set(WEMO_MODEL_DISPATCH.get(wemo.model_name, [Platform.SWITCH]))
|
platforms = set(WEMO_MODEL_DISPATCH.get(wemo.model_name, [Platform.SWITCH]))
|
||||||
platforms.add(Platform.SENSOR)
|
platforms.add(Platform.SENSOR)
|
||||||
|
platforms_to_load: list[Platform] = []
|
||||||
for platform in platforms:
|
for platform in platforms:
|
||||||
# Three cases:
|
# Three cases:
|
||||||
# - Platform is loaded, dispatch discovery
|
# - Platform is loaded, dispatch discovery
|
||||||
@ -205,9 +206,12 @@ class WemoDispatcher:
|
|||||||
self._dispatch_backlog[platform].append(coordinator)
|
self._dispatch_backlog[platform].append(coordinator)
|
||||||
else:
|
else:
|
||||||
self._dispatch_backlog[platform] = [coordinator]
|
self._dispatch_backlog[platform] = [coordinator]
|
||||||
|
platforms_to_load.append(platform)
|
||||||
|
|
||||||
|
if platforms_to_load:
|
||||||
hass.async_create_task(
|
hass.async_create_task(
|
||||||
hass.config_entries.async_forward_entry_setup(
|
hass.config_entries.async_forward_entry_setups(
|
||||||
self._config_entry, platform
|
self._config_entry, platforms_to_load
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user