Skip to content

Commit

Permalink
fix: deprecation - new options flow properties
Browse files Browse the repository at this point in the history
  • Loading branch information
geertmeersman committed Jan 10, 2025
1 parent 88a0dd3 commit dbfd78c
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions custom_components/yoin/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,25 +200,24 @@ async def async_step_username_password(
class YoinOptionsFlow(YoinCommonFlow, OptionsFlow):
"""Handle Yoin options."""

general_settings: dict

def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize Yoin options flow."""
self.config_entry = config_entry
super().__init__(initial_data=config_entry.data) # type: ignore[arg-type]
super().__init__(initial_data=config_entry.data)

@callback
def finish_flow(self) -> FlowResult:
"""Update the ConfigEntry and finish the flow."""
new_data = DEFAULT_ENTRY_DATA | self.initial_data | self.new_entry_data
self.hass.config_entries.async_update_entry(
self.config_entry,
data=new_data,
title=self.new_title or UNDEFINED,
)
self.hass.async_create_task(
self.hass.config_entries.async_reload(self.config_entry.entry_id)
)

if self.config_entry:
self.hass.config_entries.async_update_entry(
self.config_entry,
data=new_data,
title=self.new_title or UNDEFINED,
)
self.hass.async_create_task(
self.hass.config_entries.async_reload(self._config_entry_id)
)
return self.async_create_entry(title="", data={})

async def async_step_init(
Expand Down

0 comments on commit dbfd78c

Please sign in to comment.