Improve detected Huawei LTE device name (#36772)

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
Ville Skyttä 2020-06-23 07:49:05 +03:00 committed by GitHub
parent 149a3165e6
commit 7c5e852303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -206,7 +206,10 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
user_input=user_input, errors=errors
)
title = await self.hass.async_add_executor_job(get_router_title, conn)
# pylint: disable=no-member
title = self.context.get("title_placeholders", {}).get(
CONF_NAME
) or await self.hass.async_add_executor_job(get_router_title, conn)
await self.hass.async_add_executor_job(logout)
return self.async_create_entry(title=title, data=user_input)
@ -238,6 +241,10 @@ class ConfigFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
if self._already_configured(user_input):
return self.async_abort(reason="already_configured")
# pylint: disable=no-member
self.context["title_placeholders"] = {
CONF_NAME: discovery_info.get(ssdp.ATTR_UPNP_FRIENDLY_NAME)
}
return await self._async_show_user_form(user_input)

View File

@ -16,6 +16,7 @@
"response_error": "Unknown error from device",
"unknown_connection_error": "Unknown error connecting to device"
},
"flow_title": "Huawei LTE: {name}",
"step": {
"user": {
"data": {

View File

@ -16,6 +16,7 @@
"response_error": "Unknown error from device",
"unknown_connection_error": "Unknown error connecting to device"
},
"flow_title": "Huawei LTE: {name}",
"step": {
"user": {
"data": {