Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "none" in favor of optional select in brottsplatskartan #101311

Merged
merged 1 commit into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions homeassistant/components/brottsplatskartan/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@
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",
)
),
}
Expand All @@ -43,9 +42,7 @@ async def async_step_user(
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}"
Expand Down
1 change: 0 additions & 1 deletion homeassistant/components/brottsplatskartan/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
DEFAULT_NAME = "Brottsplatskartan"

AREAS = [
"none",
"Blekinge län",
"Dalarnas län",
"Gotlands län",
Expand Down
7 changes: 0 additions & 7 deletions homeassistant/components/brottsplatskartan/strings.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,5 @@
}
}
}
},
"selector": {
"areas": {
"options": {
"none": "No area"
}
}
}
}
5 changes: 1 addition & 4 deletions tests/components/brottsplatskartan/test_config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -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,
Expand Down