diff --git a/homeassistant/components/reolink/config_flow.py b/homeassistant/components/reolink/config_flow.py index d924f395c50..e86da1f23a7 100644 --- a/homeassistant/components/reolink/config_flow.py +++ b/homeassistant/components/reolink/config_flow.py @@ -19,7 +19,7 @@ from homeassistant.helpers.device_registry import format_mac from .const import CONF_PROTOCOL, CONF_USE_HTTPS, DOMAIN from .exceptions import ReolinkException, ReolinkWebhookException, UserNotAdmin from .host import ReolinkHost -from .util import has_connection_problem +from .util import is_connected _LOGGER = logging.getLogger(__name__) @@ -103,7 +103,7 @@ class ReolinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN): and CONF_PASSWORD in existing_entry.data and existing_entry.data[CONF_HOST] != discovery_info.ip ): - if has_connection_problem(self.hass, existing_entry): + if is_connected(self.hass, existing_entry): _LOGGER.debug( "Reolink DHCP reported new IP '%s', " "but connection to camera seems to be okay, so sticking to IP '%s'", diff --git a/homeassistant/components/reolink/util.py b/homeassistant/components/reolink/util.py index 2ab625647a7..cc9ad192bc3 100644 --- a/homeassistant/components/reolink/util.py +++ b/homeassistant/components/reolink/util.py @@ -8,16 +8,13 @@ from . import ReolinkData from .const import DOMAIN -def has_connection_problem( - hass: HomeAssistant, config_entry: config_entries.ConfigEntry -) -> bool: - """Check if a existing entry has a connection problem.""" +def is_connected(hass: HomeAssistant, config_entry: config_entries.ConfigEntry) -> bool: + """Check if an existing entry has a proper connection.""" reolink_data: ReolinkData | None = hass.data.get(DOMAIN, {}).get( config_entry.entry_id ) - connection_problem = ( + return ( reolink_data is not None and config_entry.state == config_entries.ConfigEntryState.LOADED and reolink_data.device_coordinator.last_update_success ) - return connection_problem