1 """Config flow for Ping (ICMP) integration."""
3 from __future__
import annotations
8 import voluptuous
as vol
12 DEFAULT_CONSIDER_HOME,
25 from .const
import CONF_PING_COUNT, DEFAULT_PING_COUNT, DOMAIN
27 _LOGGER = logging.getLogger(__name__)
31 """Clean up the user input."""
32 user_input[CONF_HOST] = user_input[CONF_HOST].strip()
37 """Handle a config flow for Ping."""
42 self, user_input: dict[str, Any] |
None =
None
43 ) -> ConfigFlowResult:
44 """Handle the initial step."""
45 if user_input
is None:
48 data_schema=vol.Schema(
50 vol.Required(CONF_HOST): str,
61 title=user_input[CONF_HOST],
65 CONF_PING_COUNT: DEFAULT_PING_COUNT,
66 CONF_CONSIDER_HOME: DEFAULT_CONSIDER_HOME.seconds,
73 config_entry: ConfigEntry,
75 """Create the options flow."""
80 """Handle an options flow for Ping."""
83 self, user_input: dict[str, Any] |
None =
None
84 ) -> ConfigFlowResult:
85 """Manage the options."""
86 if user_input
is not None:
91 data_schema=vol.Schema(
99 ): selector.NumberSelector(
100 selector.NumberSelectorConfig(
101 min=1, max=100, mode=selector.NumberSelectorMode.BOX
107 CONF_CONSIDER_HOME, DEFAULT_CONSIDER_HOME.seconds
ConfigFlowResult async_step_init(self, dict[str, Any]|None user_input=None)
OptionsFlow async_get_options_flow(ConfigEntry config_entry)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigFlowResult async_create_entry(self, *str title, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None, Mapping[str, Any]|None options=None)
ConfigFlowResult async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
None _async_abort_entries_match(self, dict[str, Any]|None match_dict=None)
ConfigFlowResult async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
ConfigEntry config_entry(self)
None config_entry(self, ConfigEntry value)
_FlowResultT async_show_form(self, *str|None step_id=None, vol.Schema|None data_schema=None, dict[str, str]|None errors=None, Mapping[str, str]|None description_placeholders=None, bool|None last_step=None, str|None preview=None)
_FlowResultT async_create_entry(self, *str|None title=None, Mapping[str, Any] data, str|None description=None, Mapping[str, str]|None description_placeholders=None)
_FlowResultT async_abort(self, *str reason, Mapping[str, str]|None description_placeholders=None)
dict[str, Any] _clean_user_input(dict[str, Any] user_input)
bool is_ip_address(str address)