Skip to content

Commit

Permalink
Replace deprecated async_forward_entry_setup call (#171)
Browse files Browse the repository at this point in the history
Fixes #165
  • Loading branch information
slyoldfox authored Aug 8, 2024
1 parent 4de4575 commit 412d9b2
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions custom_components/dyson_local/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,8 @@ async def async_setup_account(hass: HomeAssistant, entry: ConfigEntry) -> bool:
DATA_ACCOUNT: account,
DATA_DEVICES: devices,
}
for component in PLATFORMS:
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)

await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
return True


Expand Down Expand Up @@ -135,12 +132,6 @@ async def async_update_data():
else:
coordinator = None

async def _async_forward_entry_setup():
for component in _async_get_platforms(device):
hass.async_create_task(
hass.config_entries.async_forward_entry_setup(entry, component)
)

def setup_entry(host: str, is_discovery: bool = True) -> bool:
try:
device.connect(host)
Expand All @@ -156,7 +147,7 @@ def setup_entry(host: str, is_discovery: bool = True) -> bool:
hass.data[DOMAIN][DATA_DEVICES][entry.entry_id] = device
hass.data[DOMAIN][DATA_COORDINATORS][entry.entry_id] = coordinator
asyncio.run_coroutine_threadsafe(
_async_forward_entry_setup(), hass.loop
hass.config_entries.async_forward_entry_setups(entry, _async_get_platforms(device)), hass.loop
).result()

host = entry.data.get(CONF_HOST)
Expand Down

0 comments on commit 412d9b2

Please sign in to comment.