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:
1 parent
dbcdc32f05
commit
60c787c2e6
10 files changed
+192
-70
No files matched your search
@@ -4,7 +4,8 @@ import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import (
|
||||
CONF_DEVICE, CONF_NAME, CONF_TRIGGER_TIME, EVENT_HOMEASSISTANT_STOP)
|
||||
CONF_DEVICE, CONF_MAC, CONF_NAME, CONF_TRIGGER_TIME,
|
||||
EVENT_HOMEASSISTANT_STOP)
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
|
||||
from .config_flow import DEVICE_SCHEMA
|
||||
@@ -55,6 +56,12 @@ async def async_setup_entry(hass, config_entry):
|
||||
return True
|
||||
|
||||
|
||||
async def async_unload_entry(hass, config_entry):
|
||||
"""Unload Axis device config entry."""
|
||||
device = hass.data[DOMAIN].pop(config_entry.data[CONF_MAC])
|
||||
return await device.async_reset()
|
||||
|
||||
|
||||
async def async_populate_options(hass, config_entry):
|
||||
"""Populate default options for device."""
|
||||
from axis.vapix import VAPIX_IMAGE_FORMAT
|
||||
|
||||
Reference in new issue
Block a user