1 """The dnsip component."""
3 from __future__
import annotations
9 from .const
import CONF_PORT_IPV6, DEFAULT_PORT, PLATFORMS
13 """Set up DNS IP from a config entry."""
15 await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)
16 entry.async_on_unload(entry.add_update_listener(update_listener))
21 """Handle options update."""
22 await hass.config_entries.async_reload(entry.entry_id)
26 """Unload dnsip config entry."""
28 return await hass.config_entries.async_unload_platforms(entry, PLATFORMS)
32 """Migrate old entry to a newer version."""
34 if config_entry.version > 1:
38 if config_entry.version < 2
and config_entry.minor_version < 2:
39 version = config_entry.version
40 minor_version = config_entry.minor_version
42 "Migrating configuration from version %s.%s",
47 new_options = {**config_entry.options}
48 new_options[CONF_PORT] = DEFAULT_PORT
49 new_options[CONF_PORT_IPV6] = DEFAULT_PORT
51 hass.config_entries.async_update_entry(
52 config_entry, options=new_options, minor_version=2
56 "Migration to configuration version %s.%s successful",
bool async_setup_entry(HomeAssistant hass, ConfigEntry entry)
bool async_migrate_entry(HomeAssistant hass, ConfigEntry config_entry)
bool async_unload_entry(HomeAssistant hass, ConfigEntry entry)
None update_listener(HomeAssistant hass, ConfigEntry entry)