mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Axis component support unloading entries (#22692)
* Add support for unloading entries * Improve config entry tests * Improve coverage for device * Remove callback when relevant
This commit is contained in:
committed by
Paulus Schoutsen
parent
dbcdc32f05
commit
60c787c2e6
@@ -159,6 +159,24 @@ class AxisNetworkDevice:
|
||||
"""Stop the event stream."""
|
||||
self.api.stop()
|
||||
|
||||
async def async_reset(self):
|
||||
"""Reset this device to default state."""
|
||||
self.api.stop()
|
||||
|
||||
if self.config_entry.options[CONF_CAMERA]:
|
||||
await self.hass.config_entries.async_forward_entry_unload(
|
||||
self.config_entry, 'camera')
|
||||
|
||||
if self.config_entry.options[CONF_EVENTS]:
|
||||
await self.hass.config_entries.async_forward_entry_unload(
|
||||
self.config_entry, 'binary_sensor')
|
||||
|
||||
for unsub_dispatcher in self.listeners:
|
||||
unsub_dispatcher()
|
||||
self.listeners = []
|
||||
|
||||
return True
|
||||
|
||||
|
||||
async def get_device(hass, config):
|
||||
"""Create a Axis device."""
|
||||
|
||||
Reference in New Issue
Block a user