1 """Config flow for Linn / OpenHome."""
7 ATTR_UPNP_FRIENDLY_NAME,
14 from .const
import DOMAIN
16 _LOGGER = logging.getLogger(__name__)
20 """Test if discovery is complete and usable."""
21 return bool(ATTR_UPNP_UDN
in discovery_info.upnp
and discovery_info.ssdp_location)
25 """Handle an Openhome config flow."""
31 self, discovery_info: SsdpServiceInfo
32 ) -> ConfigFlowResult:
33 """Handle a flow initialized by discovery."""
34 _LOGGER.debug(
"async_step_ssdp: started")
37 _LOGGER.debug(
"async_step_ssdp: Incomplete discovery, ignoring")
41 "async_step_ssdp: setting unique id %s", discovery_info.upnp[ATTR_UPNP_UDN]
48 "async_step_ssdp: create entry %s", discovery_info.upnp[ATTR_UPNP_UDN]
51 self.
_name_name = discovery_info.upnp[ATTR_UPNP_FRIENDLY_NAME]
52 self.
_host_host = discovery_info.ssdp_location
54 return await self.async_step_confirm()
57 self, user_input: dict[str, Any] |
None =
None
58 ) -> ConfigFlowResult:
59 """Handle user-confirmation of discovered node."""
61 if user_input
is not None:
63 title=self.
_name_name,
64 data={CONF_HOST: self.
_host_host},
69 description_placeholders={CONF_NAME: self.
_name_name},
ConfigFlowResult async_step_ssdp(self, SsdpServiceInfo discovery_info)
None _abort_if_unique_id_configured(self, dict[str, Any]|None updates=None, bool reload_on_update=True, *str error="already_configured")
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)
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)
_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)
bool _is_complete_discovery(SsdpServiceInfo discovery_info)
config_entries.ConfigFlowResult async_step_confirm(self, dict[str, Any]|None user_input=None)