Use reauth helpers in deluge config flow (#127445)

pull/127505/head
epenet 2024-10-03 19:45:09 +02:00 committed by GitHub
parent 07bc9f6477
commit 255cf6b305
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 11 deletions

View File

@ -10,13 +10,7 @@ from deluge_client.client import DelugeRPCClient
import voluptuous as vol
from homeassistant.config_entries import SOURCE_REAUTH, ConfigFlow, ConfigFlowResult
from homeassistant.const import (
CONF_HOST,
CONF_PASSWORD,
CONF_PORT,
CONF_SOURCE,
CONF_USERNAME,
)
from homeassistant.const import CONF_HOST, CONF_PASSWORD, CONF_PORT, CONF_USERNAME
import homeassistant.helpers.config_validation as cv
from .const import (
@ -44,12 +38,10 @@ class DelugeFlowHandler(ConfigFlow, domain=DOMAIN):
user_input[CONF_HOST] == entry.data[CONF_HOST]
and user_input[CONF_PORT] == entry.data[CONF_PORT]
):
if self.context.get(CONF_SOURCE) == SOURCE_REAUTH:
self.hass.config_entries.async_update_entry(
if self.source == SOURCE_REAUTH:
return self.async_update_reload_and_abort(
entry, data=user_input
)
await self.hass.config_entries.async_reload(entry.entry_id)
return self.async_abort(reason="reauth_successful")
return self.async_abort(reason="already_configured")
return self.async_create_entry(
title=DEFAULT_NAME,