From 255cf6b3056812264927e4fead5736fecf01232c Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 3 Oct 2024 19:45:09 +0200 Subject: [PATCH] Use reauth helpers in deluge config flow (#127445) --- homeassistant/components/deluge/config_flow.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/homeassistant/components/deluge/config_flow.py b/homeassistant/components/deluge/config_flow.py index 0a04a17a991..d58f23464d1 100644 --- a/homeassistant/components/deluge/config_flow.py +++ b/homeassistant/components/deluge/config_flow.py @@ -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,