Required option_flow values for here_travel_time (#77651)

This commit is contained in:
Kevin Stillhammer 2022-09-01 10:19:21 +02:00 committed by GitHub
parent 6f8b032a6e
commit dec2661322
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,6 @@ from homeassistant.helpers.selector import (
EntitySelector,
LocationSelector,
TimeSelector,
selector,
)
from .const import (
@ -361,7 +360,8 @@ class HERETravelTimeOptionsFlow(config_entries.OptionsFlow):
menu_options=["departure_time", "no_time"],
)
options = {
schema = vol.Schema(
{
vol.Optional(
CONF_TRAFFIC_MODE,
default=self.config_entry.options.get(
@ -381,8 +381,9 @@ class HERETravelTimeOptionsFlow(config_entries.OptionsFlow):
),
): vol.In(UNITS),
}
)
return self.async_show_form(step_id="init", data_schema=vol.Schema(options))
return self.async_show_form(step_id="init", data_schema=schema)
async def async_step_no_time(
self, user_input: dict[str, Any] | None = None
@ -398,12 +399,12 @@ class HERETravelTimeOptionsFlow(config_entries.OptionsFlow):
self._config[CONF_ARRIVAL_TIME] = user_input[CONF_ARRIVAL_TIME]
return self.async_create_entry(title="", data=self._config)
options = {"arrival_time": selector({TimeSelector.selector_type: {}})}
return self.async_show_form(
step_id="arrival_time", data_schema=vol.Schema(options)
schema = vol.Schema(
{vol.Required(CONF_ARRIVAL_TIME, default="00:00:00"): TimeSelector()}
)
return self.async_show_form(step_id="arrival_time", data_schema=schema)
async def async_step_departure_time(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
@ -412,8 +413,8 @@ class HERETravelTimeOptionsFlow(config_entries.OptionsFlow):
self._config[CONF_DEPARTURE_TIME] = user_input[CONF_DEPARTURE_TIME]
return self.async_create_entry(title="", data=self._config)
options = {"departure_time": selector({TimeSelector.selector_type: {}})}
return self.async_show_form(
step_id="departure_time", data_schema=vol.Schema(options)
schema = vol.Schema(
{vol.Required(CONF_DEPARTURE_TIME, default="00:00:00"): TimeSelector()}
)
return self.async_show_form(step_id="departure_time", data_schema=schema)