Reduce boilerplate to setup config entry platforms A-C (#49681)

Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
J. Nick Koston 2021-04-26 07:46:55 -10:00 committed by GitHub
parent 922eec0909
commit 51be2f860a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
34 changed files with 119 additions and 409 deletions

View file

@ -264,20 +264,9 @@ class AxisNetworkDevice:
"""Reset this device to default state."""
self.disconnect_from_stream()
unload_ok = all(
await asyncio.gather(
*[
self.hass.config_entries.async_forward_entry_unload(
self.config_entry, platform
)
for platform in PLATFORMS
]
)
return await self.hass.config_entries.async_unload_platforms(
self.config_entry, PLATFORMS
)
if not unload_ok:
return False
return True
async def get_device(hass, host, port, username, password):