from .const import CONF_ALLOW_SERVICE_CALLS as CONF_ALLOW_SERVICE_CALLS, CONF_DEVICE_NAME as CONF_DEVICE_NAME, CONF_NOISE_PSK as CONF_NOISE_PSK, CONF_SUBSCRIBE_LOGS as CONF_SUBSCRIBE_LOGS, DEFAULT_ALLOW_SERVICE_CALLS as DEFAULT_ALLOW_SERVICE_CALLS, DEFAULT_NEW_CONFIG_ALLOW_ALLOW_SERVICE_CALLS as DEFAULT_NEW_CONFIG_ALLOW_ALLOW_SERVICE_CALLS, DEFAULT_PORT as DEFAULT_PORT, DOMAIN as DOMAIN
from .dashboard import async_get_or_create_dashboard_manager as async_get_or_create_dashboard_manager, async_set_dashboard_info as async_set_dashboard_info
from .encryption_key_storage import async_get_encryption_key_storage as async_get_encryption_key_storage
from .entry_data import ESPHomeConfigEntry as ESPHomeConfigEntry
from .manager import async_replace_device as async_replace_device
from _typeshed import Incomplete
from aioesphomeapi import DeviceInfo as DeviceInfo
from collections.abc import Mapping
from homeassistant.components import zeroconf as zeroconf
from homeassistant.config_entries import ConfigEntry as ConfigEntry, ConfigFlow as ConfigFlow, ConfigFlowResult as ConfigFlowResult, FlowType as FlowType, OptionsFlowWithReload as OptionsFlowWithReload, SOURCE_ESPHOME as SOURCE_ESPHOME, SOURCE_IGNORE as SOURCE_IGNORE, SOURCE_REAUTH as SOURCE_REAUTH, SOURCE_RECONFIGURE as SOURCE_RECONFIGURE
from homeassistant.const import CONF_HOST as CONF_HOST, CONF_PASSWORD as CONF_PASSWORD, CONF_PORT as CONF_PORT
from homeassistant.core import callback as callback
from homeassistant.data_entry_flow import AbortFlow as AbortFlow, FlowResultType as FlowResultType
from homeassistant.helpers import discovery_flow as discovery_flow
from homeassistant.helpers.device_registry import format_mac as format_mac
from homeassistant.helpers.importlib import async_import_module as async_import_module
from homeassistant.helpers.service_info.dhcp import DhcpServiceInfo as DhcpServiceInfo
from homeassistant.helpers.service_info.esphome import ESPHomeServiceInfo as ESPHomeServiceInfo
from homeassistant.helpers.service_info.hassio import HassioServiceInfo as HassioServiceInfo
from homeassistant.helpers.service_info.mqtt import MqttServiceInfo as MqttServiceInfo
from homeassistant.helpers.service_info.zeroconf import ZeroconfServiceInfo as ZeroconfServiceInfo
from homeassistant.util.json import json_loads_object as json_loads_object
from typing import Any

ERROR_REQUIRES_ENCRYPTION_KEY: str
ERROR_INVALID_ENCRYPTION_KEY: str
ERROR_INVALID_PASSWORD_AUTH: str
_LOGGER: Incomplete
ZERO_NOISE_PSK: str
DEFAULT_NAME: str

class EsphomeFlowHandler(ConfigFlow, domain=DOMAIN):
    VERSION: int
    _reauth_entry: ConfigEntry
    _reconfig_entry: ConfigEntry
    _host: str | None
    _connected_address: str | None
    __name: str | None
    _port: int | None
    _password: str | None
    _noise_required: bool | None
    _noise_psk: str | None
    _device_info: DeviceInfo | None
    _device_name: str | None
    _device_mac: str | None
    _entry_with_name_conflict: ConfigEntry | None
    def __init__(self) -> None: ...
    async def _async_step_user_base(self, user_input: dict[str, Any] | None = None, error: str | None = None) -> ConfigFlowResult: ...
    async def async_step_user(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_reauth(self, entry_data: Mapping[str, Any]) -> ConfigFlowResult: ...
    async def async_step_reauth_encryption_removed_confirm(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_reauth_confirm(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_reconfigure(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    @property
    def _name(self) -> str: ...
    @_name.setter
    def _name(self, value: str) -> None: ...
    async def _async_try_fetch_device_info(self) -> ConfigFlowResult: ...
    async def _async_authenticate_or_add(self) -> ConfigFlowResult: ...
    async def async_step_discovery_confirm(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_zeroconf(self, discovery_info: ZeroconfServiceInfo) -> ConfigFlowResult: ...
    async def _async_validate_mac_abort_configured(self, formatted_mac: str, host: str, port: int | None) -> None: ...
    @callback
    def _abort_unique_id_configured_with_details(self, updates: dict[str, Any]) -> None: ...
    async def async_step_mqtt(self, discovery_info: MqttServiceInfo) -> ConfigFlowResult: ...
    async def async_step_dhcp(self, discovery_info: DhcpServiceInfo) -> ConfigFlowResult: ...
    async def async_step_hassio(self, discovery_info: HassioServiceInfo) -> ConfigFlowResult: ...
    async def async_step_name_conflict(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_name_conflict_migrate(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def async_step_name_conflict_overwrite(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    async def _async_create_entry(self) -> ConfigFlowResult: ...
    @callback
    def _async_make_config_data(self) -> dict[str, Any]: ...
    @callback
    def _async_abort_wrong_device(self, entry: ConfigEntry, expected_mac: str, actual_mac: str) -> ConfigFlowResult: ...
    async def _async_validated_connection(self) -> ConfigFlowResult: ...
    async def _async_reauth_validated_connection(self) -> ConfigFlowResult: ...
    async def _async_reconfig_validated_connection(self) -> ConfigFlowResult: ...
    async def async_step_encryption_key(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
    @callback
    def _async_get_human_readable_name(self) -> str: ...
    async def async_step_authenticate(self, user_input: dict[str, Any] | None = None, error: str | None = None) -> ConfigFlowResult: ...
    async def _fetch_device_info(self, host: str, port: int | None, noise_psk: str | None) -> str | None: ...
    async def fetch_device_info(self) -> str | None: ...
    async def try_login(self) -> str | None: ...
    async def _retrieve_encryption_key_from_dashboard(self) -> bool: ...
    async def _retrieve_encryption_key_from_storage(self) -> bool: ...
    @staticmethod
    @callback
    def async_get_options_flow(config_entry: ESPHomeConfigEntry) -> OptionsFlowHandler: ...

class OptionsFlowHandler(OptionsFlowWithReload):
    async def async_step_init(self, user_input: dict[str, Any] | None = None) -> ConfigFlowResult: ...
