diff --git a/custom_components/tplink_deco/config_flow.py b/custom_components/tplink_deco/config_flow.py index 6f15297..32eb52f 100644 --- a/custom_components/tplink_deco/config_flow.py +++ b/custom_components/tplink_deco/config_flow.py @@ -47,7 +47,7 @@ async def _async_test_credentials(hass: HomeAssistant, data: dict[str:Any]): """Return true if credentials is valid.""" try: api = create_api(hass, data) - await api.async_list_clients() + await api.async_login() return {} except asyncio.TimeoutError: return {"base": "timeout_connect"} @@ -80,23 +80,17 @@ async def async_step_user(self, user_input=None): title=user_input[CONF_HOST], data=user_input ) - return await self._show_config_form(user_input) - - @staticmethod - @callback - def async_get_options_flow(config_entry: ConfigEntry): - return TplinkDecoOptionsFlowHandler(config_entry) - - async def _show_config_form( - self, user_input: dict[str:Any] - ): # pylint: disable=unused-argument - """Show the configuration form to edit location data.""" return self.async_show_form( step_id="user", data_schema=_get_schema(user_input), errors=self._errors, ) + @staticmethod + @callback + def async_get_options_flow(config_entry: ConfigEntry): + return TplinkDecoOptionsFlowHandler(config_entry) + class TplinkDecoOptionsFlowHandler(config_entries.OptionsFlow): """Config flow options handler for tplink_deco.""" @@ -107,13 +101,7 @@ def __init__(self, config_entry: ConfigEntry): self.data = dict(config_entry.data) self._errors = {} - async def async_step_init( - self, user_input: dict[str:Any] = None - ): # pylint: disable=unused-argument - """Manage the options.""" - return await self.async_step_user() - - async def async_step_user(self, user_input: dict[str:Any] = None): + async def async_step_init(self, user_input: dict[str:Any] = None): """Handle a flow initialized by the user.""" self._errors = {} @@ -127,7 +115,7 @@ async def async_step_user(self, user_input: dict[str:Any] = None): ) return self.async_show_form( - step_id="user", + step_id="init", data_schema=_get_schema(self.data), errors=self._errors, ) diff --git a/custom_components/tplink_deco/strings.json b/custom_components/tplink_deco/strings.json index 3dee3b8..be64628 100644 --- a/custom_components/tplink_deco/strings.json +++ b/custom_components/tplink_deco/strings.json @@ -21,7 +21,7 @@ }, "options": { "step": { - "user": { + "init": { "title": "TP-Link Deco", "description": "Use the credentials for the admin web portal. See https://github.com/amosyuen/ha-tplink-deco", "data": { diff --git a/custom_components/tplink_deco/translations/en.json b/custom_components/tplink_deco/translations/en.json index f257b07..761c67e 100644 --- a/custom_components/tplink_deco/translations/en.json +++ b/custom_components/tplink_deco/translations/en.json @@ -21,7 +21,7 @@ }, "options": { "step": { - "user": { + "init": { "title": "TP-Link Deco", "description": "Use the credentials for the admin web portal. See https://github.com/amosyuen/ha-tplink-deco", "data": { diff --git a/custom_components/tplink_deco/translations/fr.json b/custom_components/tplink_deco/translations/fr.json index 15a3232..f657a71 100644 --- a/custom_components/tplink_deco/translations/fr.json +++ b/custom_components/tplink_deco/translations/fr.json @@ -13,7 +13,7 @@ }, "options": { "step": { - "user": { + "init": { "title": "TP-Link Deco", "data": { "username": "Identifiant", diff --git a/custom_components/tplink_deco/translations/nb.json b/custom_components/tplink_deco/translations/nb.json index 4731781..4d82e62 100644 --- a/custom_components/tplink_deco/translations/nb.json +++ b/custom_components/tplink_deco/translations/nb.json @@ -13,7 +13,7 @@ }, "options": { "step": { - "user": { + "init": { "title": "TP-Link Deco", "data": { "username": "Brukernavn", diff --git a/custom_components/tplink_deco/translations/pt_br.json b/custom_components/tplink_deco/translations/pt_br.json index 830b720..906d195 100644 --- a/custom_components/tplink_deco/translations/pt_br.json +++ b/custom_components/tplink_deco/translations/pt_br.json @@ -21,7 +21,7 @@ }, "options": { "step": { - "user": { + "init": { "title": "TP-Link Deco", "description": "Use as credenciais para o portal da Web do administrador. Veja https://github.com/amosyuen/ha-tplink-deco", "data": {