Fix config flow issue
This commit is contained in:
@@ -108,11 +108,19 @@ class MedMateConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
|
||||
}
|
||||
return await self.async_step_prescription()
|
||||
|
||||
# Create day options dict
|
||||
day_options = {}
|
||||
for day in DAYS_OF_WEEK:
|
||||
day_options[day] = day.title()
|
||||
|
||||
# Create time options dict
|
||||
time_options = {}
|
||||
for key, value in TIME_SLOTS.items():
|
||||
time_options[key] = value
|
||||
|
||||
schema = vol.Schema({
|
||||
vol.Required(CONF_DAYS, default=DAYS_OF_WEEK): cv.multi_select(
|
||||
{day: day.title() for day in DAYS_OF_WEEK}
|
||||
),
|
||||
vol.Required(CONF_TIMES, default=["morning"]): cv.multi_select(TIME_SLOTS),
|
||||
vol.Required(CONF_DAYS, default=DAYS_OF_WEEK): cv.multi_select(day_options),
|
||||
vol.Required(CONF_TIMES, default=["morning"]): cv.multi_select(time_options),
|
||||
})
|
||||
|
||||
return self.async_show_form(
|
||||
@@ -259,15 +267,25 @@ class MedMateOptionsFlow(config_entries.OptionsFlow):
|
||||
}
|
||||
return await self.async_step_prescription()
|
||||
|
||||
# Create day options dict
|
||||
day_options = {}
|
||||
for day in DAYS_OF_WEEK:
|
||||
day_options[day] = day.title()
|
||||
|
||||
# Create time options dict
|
||||
time_options = {}
|
||||
for key, value in TIME_SLOTS.items():
|
||||
time_options[key] = value
|
||||
|
||||
schema = vol.Schema({
|
||||
vol.Required(
|
||||
CONF_DAYS,
|
||||
default=current_schedule.get(CONF_DAYS, DAYS_OF_WEEK)
|
||||
): cv.multi_select({day: day.title() for day in DAYS_OF_WEEK}),
|
||||
): cv.multi_select(day_options),
|
||||
vol.Required(
|
||||
CONF_TIMES,
|
||||
default=current_schedule.get(CONF_TIMES, ["morning"])
|
||||
): cv.multi_select(TIME_SLOTS),
|
||||
): cv.multi_select(time_options),
|
||||
})
|
||||
|
||||
return self.async_show_form(
|
||||
|
||||
Reference in New Issue
Block a user