1 """Config flow for Mobile App."""
11 from .const
import ATTR_APP_ID, ATTR_DEVICE_NAME, CONF_USER_ID, DOMAIN
15 """Handle a Mobile App config flow."""
20 self, user_input: dict[str, Any] |
None =
None
21 ) -> ConfigFlowResult:
22 """Handle a flow initialized by the user."""
24 "apps_url":
"https://www.home-assistant.io/integrations/mobile_app/#apps"
28 reason=
"install_app", description_placeholders=placeholders
32 self, user_input: dict[str, Any]
33 ) -> ConfigFlowResult:
34 """Handle a flow initialized during registration."""
35 if ATTR_DEVICE_ID
in user_input:
38 f
"{user_input[ATTR_APP_ID]}-{user_input[ATTR_DEVICE_ID]}"
41 user_input[ATTR_DEVICE_ID] =
str(uuid.uuid4()).replace(
"-",
"")
44 entity_registry = er.async_get(self.hass)
45 devt_entry = entity_registry.async_get_or_create(
48 user_input[ATTR_DEVICE_ID],
49 suggested_object_id=user_input[ATTR_DEVICE_NAME],
51 await person.async_add_user_device_tracker(
52 self.hass, user_input[CONF_USER_ID], devt_entry.entity_id
56 title=user_input[ATTR_DEVICE_NAME], data=user_input
ConfigFlowResult async_step_registration(self, dict[str, Any] user_input)
ConfigFlowResult async_step_user(self, dict[str, Any]|None user_input=None)
ConfigEntry|None async_set_unique_id(self, str|None unique_id=None, *bool raise_on_progress=True)
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)
_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)