Remove "none" in favor of optional select in brottsplatskartan (#101311)
parent
dfea1c2b7c
commit
6c4ac71218
|
@ -18,11 +18,10 @@ DATA_SCHEMA = vol.Schema(
|
|||
vol.Optional(CONF_LOCATION): selector.LocationSelector(
|
||||
selector.LocationSelectorConfig(radius=False, icon="")
|
||||
),
|
||||
vol.Optional(CONF_AREA, default="none"): selector.SelectSelector(
|
||||
vol.Optional(CONF_AREA): selector.SelectSelector(
|
||||
selector.SelectSelectorConfig(
|
||||
options=AREAS,
|
||||
mode=selector.SelectSelectorMode.DROPDOWN,
|
||||
translation_key="areas",
|
||||
)
|
||||
),
|
||||
}
|
||||
|
@ -43,9 +42,7 @@ class BPKConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
|||
if user_input is not None:
|
||||
latitude: float | None = None
|
||||
longitude: float | None = None
|
||||
area: str | None = (
|
||||
user_input[CONF_AREA] if user_input[CONF_AREA] != "none" else None
|
||||
)
|
||||
area: str | None = user_input.get(CONF_AREA)
|
||||
|
||||
if area:
|
||||
name = f"{DEFAULT_NAME} {area}"
|
||||
|
|
|
@ -14,7 +14,6 @@ CONF_APP_ID = "app_id"
|
|||
DEFAULT_NAME = "Brottsplatskartan"
|
||||
|
||||
AREAS = [
|
||||
"none",
|
||||
"Blekinge län",
|
||||
"Dalarnas län",
|
||||
"Gotlands län",
|
||||
|
|
|
@ -15,12 +15,5 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"selector": {
|
||||
"areas": {
|
||||
"options": {
|
||||
"none": "No area"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,9 +23,7 @@ async def test_form(hass: HomeAssistant) -> None:
|
|||
|
||||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{
|
||||
CONF_AREA: "none",
|
||||
},
|
||||
{},
|
||||
)
|
||||
await hass.async_block_till_done()
|
||||
|
||||
|
@ -51,7 +49,6 @@ async def test_form_location(hass: HomeAssistant) -> None:
|
|||
result2 = await hass.config_entries.flow.async_configure(
|
||||
result["flow_id"],
|
||||
{
|
||||
CONF_AREA: "none",
|
||||
CONF_LOCATION: {
|
||||
CONF_LATITUDE: 59.32,
|
||||
CONF_LONGITUDE: 18.06,
|
||||
|
|
Loading…
Reference in New Issue