mirror of
https://github.com/home-assistant/core.git
synced 2025-11-14 13:30:43 +00:00
Allow platform unloading (#13784)
* Allow platform unloading * Add tests * Add last test
This commit is contained in:
committed by
Pascal Vizeli
parent
dd7e6edf61
commit
f47572d3c0
@@ -113,6 +113,18 @@ class EntityComponent(object):
|
||||
|
||||
return await self._platforms[key].async_setup_entry(config_entry)
|
||||
|
||||
async def async_unload_entry(self, config_entry):
|
||||
"""Unload a config entry."""
|
||||
key = config_entry.entry_id
|
||||
|
||||
platform = self._platforms.pop(key, None)
|
||||
|
||||
if platform is None:
|
||||
raise ValueError('Config entry was never loaded!')
|
||||
|
||||
await platform.async_reset()
|
||||
return True
|
||||
|
||||
@callback
|
||||
def async_extract_from_service(self, service, expand_group=True):
|
||||
"""Extract all known and available entities from a service call.
|
||||
|
||||
Reference in New Issue
Block a user