Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve API login in the init file #28

Open
danielgospodinow opened this issue Dec 8, 2024 · 0 comments
Open

Improve API login in the init file #28

danielgospodinow opened this issue Dec 8, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@danielgospodinow
Copy link
Member

danielgospodinow commented Dec 8, 2024

In the init file, the login flow should be improved.

    try:
        await api_client.login(email, password)
        await api_client.get_devices()  # NOTE: This is needed since currently the login API does not throw an error if the credentials are invalid: https://github.com/qbaware/homeassistant-eldom/issues/27
        _LOGGER.info("Successfully authenticated with Eldom API")
    except Exception as e:
        _LOGGER.error("Unexpected exception while authenticating with Eldom API: %s", e)
        raise ConfigEntryNotReady(
            f"Unexpected exception while authenticating with Eldom API: {e}"
        ) from e
  • Throw a ConfigEntryAuthFailed exception in case the creds are funny.
  • Throw a ConfigEntryNotReady exception in case something unexpected happens.

Also, remove the get_devices call.

This is related to qbaware/pyeldom#4.

@danielgospodinow danielgospodinow added the enhancement New feature or request label Dec 8, 2024
@danielgospodinow danielgospodinow self-assigned this Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant