Skip to content

Commit

Permalink
Fix option flow
Browse files Browse the repository at this point in the history
  • Loading branch information
cyr-ius committed Dec 13, 2024
1 parent 08b50a3 commit 53391ac
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions custom_components/bbox/config_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@

from __future__ import annotations

from collections.abc import Mapping
import logging
from collections.abc import Mapping
from typing import Any

from bboxpy import AuthorizationError, Bbox, BboxException, HttpRequestError
import voluptuous as vol

from bboxpy import AuthorizationError, Bbox, BboxException, HttpRequestError
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_VERIFY_SSL
from homeassistant.core import callback
Expand Down Expand Up @@ -37,10 +36,6 @@
}
)

OPTIONS_SCHEMA = vol.Schema(
{vol.Optional(CONF_REFRESH_RATE, default=DEFAULT_REFRESH_RATE): int}
)


class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow for Bouygues Bbox."""
Expand Down Expand Up @@ -145,12 +140,15 @@ async def async_step_init(
self, user_input: Mapping[str, Any] | None = None
) -> FlowResult:
"""Manage the options."""
if user_input is not None:
if user_input:
return self.async_create_entry(data=user_input)

return self.async_show_form(
step_id="init",
data_schema=self.add_suggested_values_to_schema(
OPTIONS_SCHEMA, self.config_entry.data
vol.Schema(
{vol.Optional(CONF_REFRESH_RATE, default=DEFAULT_REFRESH_RATE): int}
),
self.config_entry.options,
),
)

0 comments on commit 53391ac

Please sign in to comment.