Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop usage of OptionsFlowWithConfigEntry #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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