Reduce config entry setup/unload boilerplate G-J (#49737)

This commit is contained in:
J. Nick Koston 2021-04-27 04:09:59 -10:00 committed by GitHub
parent 157dd273da
commit a1fdf84dba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 172 additions and 493 deletions

View file

@ -269,17 +269,9 @@ class HKDevice:
await self.pairing.unsubscribe(self.watchable_characteristics)
unloads = []
for platform in self.platforms:
unloads.append(
self.hass.config_entries.async_forward_entry_unload(
self.config_entry, platform
)
)
results = await asyncio.gather(*unloads)
return False not in results
return await self.hass.config_entries.async_unload_platforms(
self.config_entry, self.platforms
)
async def async_refresh_entity_map(self, config_num):
"""Handle setup of a HomeKit accessory."""