mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 05:07:41 +00:00
Bump config version to 2 for AVM Fritz Tools (#51176)
This commit is contained in:
parent
538a03ee0c
commit
d200f1e504
@ -3,6 +3,10 @@ import logging
|
|||||||
|
|
||||||
from fritzconnection.core.exceptions import FritzConnectionException, FritzSecurityError
|
from fritzconnection.core.exceptions import FritzConnectionException, FritzSecurityError
|
||||||
|
|
||||||
|
from homeassistant.components.device_tracker.const import (
|
||||||
|
CONF_CONSIDER_HOME,
|
||||||
|
DEFAULT_CONSIDER_HOME,
|
||||||
|
)
|
||||||
from homeassistant.config_entries import ConfigEntry
|
from homeassistant.config_entries import ConfigEntry
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
@ -63,6 +67,22 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
async def async_migrate_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> bool:
|
||||||
|
"""Migrate config entry."""
|
||||||
|
_LOGGER.debug("Migrating from version %s", config_entry.version)
|
||||||
|
|
||||||
|
if config_entry.version == 1:
|
||||||
|
config_entry.version = 2
|
||||||
|
hass.config_entries.async_update_entry(
|
||||||
|
config_entry,
|
||||||
|
options={CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.total_seconds()},
|
||||||
|
)
|
||||||
|
|
||||||
|
_LOGGER.info("Migration to version %s successful", config_entry.version)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
async def async_unload_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
"""Unload FRITZ!Box Tools config entry."""
|
"""Unload FRITZ!Box Tools config entry."""
|
||||||
fritzbox: FritzBoxTools = hass.data[DOMAIN][entry.entry_id]
|
fritzbox: FritzBoxTools = hass.data[DOMAIN][entry.entry_id]
|
||||||
|
@ -38,7 +38,7 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
class FritzBoxToolsFlowHandler(ConfigFlow, domain=DOMAIN):
|
||||||
"""Handle a FRITZ!Box Tools config flow."""
|
"""Handle a FRITZ!Box Tools config flow."""
|
||||||
|
|
||||||
VERSION = 1
|
VERSION = 2
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@callback
|
@callback
|
||||||
|
Loading…
x
Reference in New Issue
Block a user