Use automatic title during config flow setup in Aurora (#99199)
This commit is contained in:
parent
bc665a1368
commit
9be5005a70
6 changed files with 9 additions and 23 deletions
|
@ -1,4 +1,4 @@
|
|||
"""Config flow for SpaceX Launches and Starman."""
|
||||
"""Config flow for Aurora."""
|
||||
from __future__ import annotations
|
||||
|
||||
import logging
|
||||
|
@ -8,7 +8,7 @@ from auroranoaa import AuroraForecast
|
|||
import voluptuous as vol
|
||||
|
||||
from homeassistant import config_entries
|
||||
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE
|
||||
from homeassistant.core import callback
|
||||
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||
from homeassistant.helpers.schema_config_entry_flow import (
|
||||
|
@ -16,7 +16,7 @@ from homeassistant.helpers.schema_config_entry_flow import (
|
|||
SchemaOptionsFlowHandler,
|
||||
)
|
||||
|
||||
from .const import CONF_THRESHOLD, DEFAULT_NAME, DEFAULT_THRESHOLD, DOMAIN
|
||||
from .const import CONF_THRESHOLD, DEFAULT_THRESHOLD, DOMAIN
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
|
@ -50,7 +50,6 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
errors = {}
|
||||
|
||||
if user_input is not None:
|
||||
name = user_input[CONF_NAME]
|
||||
longitude = user_input[CONF_LONGITUDE]
|
||||
latitude = user_input[CONF_LATITUDE]
|
||||
|
||||
|
@ -70,7 +69,7 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
)
|
||||
self._abort_if_unique_id_configured()
|
||||
return self.async_create_entry(
|
||||
title=f"Aurora - {name}", data=user_input
|
||||
title="Aurora visibility", data=user_input
|
||||
)
|
||||
|
||||
return self.async_show_form(
|
||||
|
@ -78,13 +77,11 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
data_schema=self.add_suggested_values_to_schema(
|
||||
vol.Schema(
|
||||
{
|
||||
vol.Required(CONF_NAME): str,
|
||||
vol.Required(CONF_LONGITUDE): cv.longitude,
|
||||
vol.Required(CONF_LATITUDE): cv.latitude,
|
||||
}
|
||||
),
|
||||
{
|
||||
CONF_NAME: DEFAULT_NAME,
|
||||
CONF_LONGITUDE: self.hass.config.longitude,
|
||||
CONF_LATITUDE: self.hass.config.latitude,
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue