Fix D-Link config flow auth (#86824)
parent
072f228e4d
commit
adb0d85511
|
@ -23,7 +23,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
|
||||||
entry.data[CONF_USERNAME],
|
entry.data[CONF_USERNAME],
|
||||||
entry.data[CONF_USE_LEGACY_PROTOCOL],
|
entry.data[CONF_USE_LEGACY_PROTOCOL],
|
||||||
)
|
)
|
||||||
if not smartplug.authenticated and entry.data[CONF_USE_LEGACY_PROTOCOL]:
|
if not smartplug.authenticated and smartplug.use_legacy_protocol:
|
||||||
raise ConfigEntryNotReady("Cannot connect/authenticate")
|
raise ConfigEntryNotReady("Cannot connect/authenticate")
|
||||||
|
|
||||||
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = SmartPlugData(smartplug)
|
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = SmartPlugData(smartplug)
|
||||||
|
|
|
@ -131,6 +131,6 @@ class DLinkFlowHandler(config_entries.ConfigFlow, domain=DOMAIN):
|
||||||
except Exception as ex: # pylint: disable=broad-except
|
except Exception as ex: # pylint: disable=broad-except
|
||||||
_LOGGER.exception("Unexpected exception: %s", ex)
|
_LOGGER.exception("Unexpected exception: %s", ex)
|
||||||
return "unknown"
|
return "unknown"
|
||||||
if smartplug.authenticated:
|
if not smartplug.authenticated and smartplug.use_legacy_protocol:
|
||||||
return None
|
return "cannot_connect"
|
||||||
return "cannot_connect"
|
return None
|
||||||
|
|
Loading…
Reference in New Issue