mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 08:47:57 +00:00
Store openhome flow data in flow handler attributes (#127176)
This commit is contained in:
parent
0616bc7fec
commit
d7da3de096
@ -24,6 +24,9 @@ def _is_complete_discovery(discovery_info: SsdpServiceInfo) -> bool:
|
||||
class OpenhomeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"""Handle an Openhome config flow."""
|
||||
|
||||
_host: str | None
|
||||
_name: str
|
||||
|
||||
async def async_step_ssdp(
|
||||
self, discovery_info: SsdpServiceInfo
|
||||
) -> ConfigFlowResult:
|
||||
@ -45,8 +48,8 @@ class OpenhomeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
"async_step_ssdp: create entry %s", discovery_info.upnp[ATTR_UPNP_UDN]
|
||||
)
|
||||
|
||||
self.context[CONF_NAME] = discovery_info.upnp[ATTR_UPNP_FRIENDLY_NAME]
|
||||
self.context[CONF_HOST] = discovery_info.ssdp_location
|
||||
self._name = discovery_info.upnp[ATTR_UPNP_FRIENDLY_NAME]
|
||||
self._host = discovery_info.ssdp_location
|
||||
|
||||
return await self.async_step_confirm()
|
||||
|
||||
@ -57,11 +60,11 @@ class OpenhomeConfigFlow(ConfigFlow, domain=DOMAIN):
|
||||
|
||||
if user_input is not None:
|
||||
return self.async_create_entry(
|
||||
title=self.context[CONF_NAME],
|
||||
data={CONF_HOST: self.context[CONF_HOST]},
|
||||
title=self._name,
|
||||
data={CONF_HOST: self._host},
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
step_id="confirm",
|
||||
description_placeholders={CONF_NAME: self.context[CONF_NAME]},
|
||||
description_placeholders={CONF_NAME: self._name},
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user