def _blink_startup_wrapper(hass, entry): """Startup wrapper for blink.""" blink = Blink() auth_data = deepcopy(dict(entry.data)) blink.auth = Auth(auth_data, no_prompt=True) blink.refresh_rate = entry.options.get(CONF_SCAN_INTERVAL, DEFAULT_SCAN_INTERVAL) if blink.start(): blink.setup_post_verify() elif blink.auth.check_key_required(): _LOGGER.debug("Attempting a reauth flow") _reauth_flow_wrapper(hass, auth_data) return blink
def _blink_startup_wrapper(entry): """Startup wrapper for blink.""" blink = Blink( username=entry.data[CONF_USERNAME], password=entry.data[CONF_PASSWORD], motion_interval=DEFAULT_OFFSET, legacy_subdomain=False, no_prompt=True, device_id=DEVICE_ID, ) blink.refresh_rate = entry.data[CONF_SCAN_INTERVAL] try: blink.login_response = entry.data["login_response"] blink.setup_params(entry.data["login_response"]) except KeyError: blink.get_auth_token() blink.setup_params(entry.data["login_response"]) blink.setup_post_verify() return blink