Skip to content

Commit

Permalink
fix: use config_flow in OptionsFlow Handler(#2343)
Browse files Browse the repository at this point in the history
closes #2333
  • Loading branch information
danielbrunt57 authored Jul 21, 2024
1 parent 994cb33 commit c91ecd8
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions custom_components/alexa_media/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,9 @@ def _update_schema_defaults(self) -> Any:

@staticmethod
@callback
def async_get_options_flow(config_entry):
def async_get_options_flow(
config_entry: config_entries.ConfigEntry,
) -> config_entries.OptionsFlow:
"""Get the options flow for this handler."""
return OptionsFlowHandler(config_entry)

Expand All @@ -846,37 +848,37 @@ async def async_step_init(
(
vol.Optional(
CONF_INCLUDE_DEVICES,
default=self.config.get(CONF_INCLUDE_DEVICES, ""),
default=self.config_entry.data.get(CONF_INCLUDE_DEVICES, ""),
),
str,
),
(
vol.Optional(
CONF_EXCLUDE_DEVICES,
default=self.config.get(CONF_EXCLUDE_DEVICES, ""),
default=self.config_entry.data.get(CONF_EXCLUDE_DEVICES, ""),
),
str,
),
(
vol.Optional(
CONF_SCAN_INTERVAL,
default=self.config.get(
CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL
),
default=self.config_entry.data.get(CONF_SCAN_INTERVAL, 120),
),
int,
),
(
vol.Optional(
CONF_QUEUE_DELAY,
default=self.config.get(CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY),
default=self.config_entry.data.get(
CONF_QUEUE_DELAY, DEFAULT_QUEUE_DELAY
),
),
float,
),
(
vol.Optional(
CONF_EXTENDED_ENTITY_DISCOVERY,
default=self.config.get(
default=self.config_entry.data.get(
CONF_EXTENDED_ENTITY_DISCOVERY,
DEFAULT_EXTENDED_ENTITY_DISCOVERY,
),
Expand All @@ -885,7 +887,8 @@ async def async_step_init(
),
(
vol.Optional(
CONF_DEBUG, default=self.config.get(CONF_DEBUG, DEFAULT_DEBUG)
CONF_DEBUG,
default=self.config_entry.data.get(CONF_DEBUG, DEFAULT_DEBUG),
),
bool,
),
Expand All @@ -908,6 +911,7 @@ async def async_step_init(
user_input[CONF_OTPSECRET] = self.config_entry.data[CONF_OTPSECRET]
if CONF_OAUTH in self.config_entry.data:
user_input[CONF_OAUTH] = self.config_entry.data[CONF_OAUTH]

self.hass.config_entries.async_update_entry(
self.config_entry, data=user_input, options=self.config_entry.options
)
Expand Down

0 comments on commit c91ecd8

Please sign in to comment.