1 """Config flow for iBeacon Tracker integration."""
3 from __future__
import annotations
8 import voluptuous
as vol
21 from .const
import CONF_ALLOW_NAMELESS_UUIDS, DOMAIN
25 """Handle a config flow for iBeacon Tracker."""
30 self, user_input: dict[str, Any] |
None =
None
31 ) -> ConfigFlowResult:
32 """Handle the initial step."""
33 if not bluetooth.async_scanner_count(self.hass, connectable=
False):
36 if user_input
is not None:
44 config_entry: ConfigEntry,
46 """Get the options flow for this handler."""
53 async
def async_step_init(self, user_input: dict |
None =
None) -> ConfigFlowResult:
54 """Manage the options."""
60 if user_input
is not None:
61 if new_uuid := user_input.get(
"new_uuid",
"").lower():
66 errors[
"new_uuid"] =
"invalid_uuid_format"
71 updated_uuids = user_input.get(
"allow_nameless_uuids", [])
72 if new_uuid
and new_uuid
not in updated_uuids:
73 updated_uuids.append(new_uuid)
75 data = {CONF_ALLOW_NAMELESS_UUIDS:
list(updated_uuids)}
78 schema: VolDictType = {
81 description={
"suggested_value": new_uuid},
87 "allow_nameless_uuids",
88 default=current_uuids,
89 ): cv.multi_select(sorted(current_uuids))
92 step_id=
"init", errors=errors, data_schema=vol.Schema(schema)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
OptionsFlow async_get_options_flow(ConfigEntry config_entry)
ConfigFlowResult async_step_init(self, dict|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)
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)