Use SelectSelector in BMW config flow (#120831)

This commit is contained in:
Richard Kroegel 2024-06-30 15:04:55 +02:00 committed by GitHub
parent 5deb69d492
commit 57aced50aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View File

@ -20,6 +20,7 @@ from homeassistant.config_entries import (
from homeassistant.const import CONF_PASSWORD, CONF_REGION, CONF_SOURCE, CONF_USERNAME
from homeassistant.core import HomeAssistant, callback
from homeassistant.exceptions import HomeAssistantError
from homeassistant.helpers.selector import SelectSelector, SelectSelectorConfig
from . import DOMAIN
from .const import CONF_ALLOWED_REGIONS, CONF_GCID, CONF_READ_ONLY, CONF_REFRESH_TOKEN
@ -28,7 +29,12 @@ DATA_SCHEMA = vol.Schema(
{
vol.Required(CONF_USERNAME): str,
vol.Required(CONF_PASSWORD): str,
vol.Required(CONF_REGION): vol.In(CONF_ALLOWED_REGIONS),
vol.Required(CONF_REGION): SelectSelector(
SelectSelectorConfig(
options=CONF_ALLOWED_REGIONS,
translation_key="regions",
)
),
}
)

View File

@ -159,5 +159,14 @@
"name": "Charging"
}
}
},
"selector": {
"regions": {
"options": {
"china": "China",
"north_america": "North America",
"rest_of_world": "Rest of world"
}
}
}
}