Fix inverse naming of function in Reolink (#100113)

pull/99895/head^2
starkillerOG 2023-09-11 18:03:22 +02:00 committed by GitHub
parent 6ccb74997c
commit 56678851af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View File

@ -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'",

View File

@ -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