Fix inverse naming of function in Reolink (#100113)
parent
6ccb74997c
commit
56678851af
|
@ -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'",
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue