mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Improve aurora data schema (#99200)
This commit is contained in:
parent
42597f80a3
commit
377f7cba60
@ -10,7 +10,7 @@ import voluptuous as vol
|
|||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
from homeassistant.const import CONF_LATITUDE, CONF_LONGITUDE, CONF_NAME
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client, config_validation as cv
|
||||||
from homeassistant.helpers.schema_config_entry_flow import (
|
from homeassistant.helpers.schema_config_entry_flow import (
|
||||||
SchemaFlowFormStep,
|
SchemaFlowFormStep,
|
||||||
SchemaOptionsFlowHandler,
|
SchemaOptionsFlowHandler,
|
||||||
@ -75,24 +75,19 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||||||
|
|
||||||
return self.async_show_form(
|
return self.async_show_form(
|
||||||
step_id="user",
|
step_id="user",
|
||||||
data_schema=vol.Schema(
|
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,
|
||||||
|
}
|
||||||
|
),
|
||||||
{
|
{
|
||||||
vol.Required(CONF_NAME, default=DEFAULT_NAME): str,
|
CONF_NAME: DEFAULT_NAME,
|
||||||
vol.Required(
|
CONF_LONGITUDE: self.hass.config.longitude,
|
||||||
CONF_LONGITUDE,
|
CONF_LATITUDE: self.hass.config.latitude,
|
||||||
default=self.hass.config.longitude,
|
},
|
||||||
): vol.All(
|
|
||||||
vol.Coerce(float),
|
|
||||||
vol.Range(min=-180, max=180),
|
|
||||||
),
|
|
||||||
vol.Required(
|
|
||||||
CONF_LATITUDE,
|
|
||||||
default=self.hass.config.latitude,
|
|
||||||
): vol.All(
|
|
||||||
vol.Coerce(float),
|
|
||||||
vol.Range(min=-90, max=90),
|
|
||||||
),
|
|
||||||
}
|
|
||||||
),
|
),
|
||||||
errors=errors,
|
errors=errors,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user