Skip to content

Commit

Permalink
Drop usage of OptionsFlowWithConfigEntry
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet authored Nov 7, 2024
1 parent 99efe32 commit 974467c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions custom_components/poolmath/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
from homeassistant.config_entries import (
ConfigEntry,
ConfigFlow,
OptionsFlowWithConfigEntry,
OptionsFlow,
)
from homeassistant.const import CONF_NAME
from homeassistant.const import CONF_NAME, __version__ as HAVERSION
from homeassistant.core import callback
from homeassistant.data_entry_flow import FlowResult
from homeassistant.helpers import config_validation as cv
Expand All @@ -29,7 +29,7 @@
LOG = logging.getLogger(__name__)


def _initial_form(flow: Union[ConfigFlow, OptionsFlowWithConfigEntry]):
def _initial_form(flow: Union[ConfigFlow, OptionsFlow]):
"""Return flow form for init/user step id."""

if isinstance(flow, ConfigFlow):
Expand All @@ -38,7 +38,7 @@ def _initial_form(flow: Union[ConfigFlow, OptionsFlowWithConfigEntry]):
name = DEFAULT_NAME
timeout = DEFAULT_TIMEOUT
target = DEFAULT_TARGET
elif isinstance(flow, OptionsFlowWithConfigEntry):
elif isinstance(flow, OptionsFlow):
step_id = "init"
share_id = flow.config_entry.options.get(CONF_SHARE_ID)
name = flow.config_entry.options.get(CONF_NAME, DEFAULT_NAME)
Expand All @@ -65,9 +65,14 @@ def _initial_form(flow: Union[ConfigFlow, OptionsFlowWithConfigEntry]):
)


class PoolMathOptionsFlow(OptionsFlowWithConfigEntry):
class PoolMathOptionsFlow(OptionsFlow):
"""Handle Pool Math options."""

def __init__(self, config_entry: ConfigEntry) -> None:
"""Initialize options flow."""
if AwesomeVersion(HAVERSION) < "2024.11.99":
self.config_entry = config_entry

async def async_step_init(
self, user_input: dict[str, Any] | None = None
) -> FlowResult:
Expand Down

0 comments on commit 974467c

Please sign in to comment.