2023-01-23 15:27:24 +00:00
|
|
|
"""Config flow for the Thread integration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
|
2023-02-21 16:22:00 +00:00
|
|
|
from homeassistant.components import zeroconf
|
2023-01-23 15:27:24 +00:00
|
|
|
from homeassistant.config_entries import ConfigFlow
|
|
|
|
from homeassistant.data_entry_flow import FlowResult
|
|
|
|
|
|
|
|
from .const import DOMAIN
|
|
|
|
|
|
|
|
|
|
|
|
class ThreadConfigFlow(ConfigFlow, domain=DOMAIN):
|
|
|
|
"""Handle a config flow for Thread."""
|
|
|
|
|
|
|
|
VERSION = 1
|
|
|
|
|
2023-02-27 14:30:04 +00:00
|
|
|
async def async_step_import(
|
|
|
|
self, import_data: dict[str, str] | None = None
|
2023-02-21 16:22:00 +00:00
|
|
|
) -> FlowResult:
|
2023-02-27 14:30:04 +00:00
|
|
|
"""Set up by import from async_setup."""
|
2023-02-21 16:22:00 +00:00
|
|
|
await self._async_handle_discovery_without_unique_id()
|
|
|
|
return self.async_create_entry(title="Thread", data={})
|
|
|
|
|
2023-02-27 14:30:04 +00:00
|
|
|
async def async_step_user(
|
|
|
|
self, user_input: dict[str, str] | None = None
|
2023-01-23 15:27:24 +00:00
|
|
|
) -> FlowResult:
|
|
|
|
"""Set up by import from async_setup."""
|
2023-02-21 16:22:00 +00:00
|
|
|
await self._async_handle_discovery_without_unique_id()
|
2023-01-23 15:27:24 +00:00
|
|
|
return self.async_create_entry(title="Thread", data={})
|
2023-02-27 14:30:04 +00:00
|
|
|
|
|
|
|
async def async_step_zeroconf(
|
|
|
|
self, discovery_info: zeroconf.ZeroconfServiceInfo
|
|
|
|
) -> FlowResult:
|
|
|
|
"""Set up because the user has border routers."""
|
|
|
|
await self._async_handle_discovery_without_unique_id()
|
|
|
|
return self.async_create_entry(title="Thread", data={})
|