gillesvs / librelink

Librelink integration for Home Assistant
MIT License
29 stars 8 forks source link

Issue identified : Error 430 during login with LibreLink API - Home Assistant #31

Open hdmvide opened 5 days ago

hdmvide commented 5 days ago

Which country are you from
I am located in Italy. This might help in understanding the API endpoints I am using. I have tried both the global endpoint (https://api.libreview.io/llu/auth/login) and the European endpoint (https://api-eu.libreview.io/llu/auth/login).

Describe the bug
When attempting to set up the LibreLink integration in Home Assistant, I receive an HTTP 430 error during the login process. This error occurs when the integration tries to authenticate with the LibreView API. The credentials I am using are valid and work on the official LibreView website, but the API call within Home Assistant fails.

Log file
Here’s the relevant portion of the log file (email address redacted):

2024-09-29 12:41:45.582 ERROR (MainThread) [homeassistant.config_entries] Error setting up entry [redacted] for librelink
Traceback (most recent call last):
  File "/config/custom_components/librelink/api.py", line 200, in api_wrapper
    response.raise_for_status()
  File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1070, in raise_for_status
    raise ClientResponseError(
aiohttp.client_exceptions.ClientResponseError: 430, message='', url=URL('https://api-eu.libreview.io/llu/auth/login')

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config_entries.py", line 594, in async_setup
    result = await component.async_setup_entry(hass, self)
  File "/config/custom_components/librelink/__init__.py", line 48, in async_setup_entry
    sessionToken = await myLibrelinkLogin.async_get_token()
  File "/config/custom_components/librelink/api.py", line 148, in async_get_token
    reponseLogin = await api_wrapper(
  File "/config/custom_components/librelink/api.py", line 209, in api_wrapper
    raise LibreLinkApiCommunicationError(
custom_components.librelink.api.LibreLinkApiCommunicationError: Error fetching information

I have activated debug mode, and I am happy to provide further logs if needed. Let me know if you require the complete log file, and I’ll ensure that sensitive information is redacted.

Screenshots
N/A (Please let me know if screenshots of specific configurations or errors would be helpful).

Additional context
I am running Home Assistant Core version 2024.6.0 and Frontend version 20240605.0. The system has internet access, and I can successfully reach the API endpoints via network tools (e.g., ping). The issue may be related to a change in the LibreView API or how the integration handles API responses.

Thank you

gillesvs commented 5 days ago

Are you using librelinkUp account? Not librelink

hdmvide commented 5 days ago

Thank you for your reply. I can confirm that I am using a LibreLink account, and it was working correctly in the past. However, it has recently stopped working. I have tried deleting the integration and reinstalling it from scratch, authenticating with the same account, but the issue persists. Despite this, the same account works fine in the LibreLink app.

gillesvs commented 4 days ago

You need to use librelinkUp This integration does not work with librelink account Maybe you had the same credentials for both accounts in the past

hdmvide commented 4 days ago

Sorry for the confusion. I actually have two different accounts—one for LibreLink and one for LibreLinkUp.

I've been using the same credentials for a long time and haven't changed them. In the Home Assistant integration, I use my LibreLinkUp account. If I use the same credentials to log into the official LibreLinkUp app, everything works fine. However, when I try to use these credentials in the Home Assistant integration, it fails and returns the error I mentioned earlier.

As I mentioned, I've been using this integration for several months without issues, but recently it stopped working, giving me this error. Again, I haven't changed my credentials; it simply stopped functioning.

I also tried deleting the integration from both Home Assistant and HACS, reinstalling it from scratch, and authenticating with the same (working) credentials I use in the LibreLinkUp app, but I still encounter the same issue.

ziolopl commented 4 days ago

Hi, i have similar issue:

Traceback (most recent call last): File "/config/custom_components/librelink/api.py", line 200, in api_wrapper response.raise_for_status() File "/usr/local/lib/python3.12/site-packages/aiohttp/client_reqrep.py", line 1093, in raise_for_status raise ClientResponseError( aiohttp.client_exceptions.ClientResponseError: 430, message='', url='https://api.libreview.io/llu/auth/login'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/usr/src/homeassistant/homeassistant/config_entries.py", line 604, in async_setup result = await component.async_setup_entry(hass, self) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/librelink/init.py", line 48, in async_setup_entry sessionToken = await myLibrelinkLogin.async_get_token() ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/config/custom_components/librelink/api.py", line 148, in async_get_token reponseLogin = await api_wrapper( ^^^^^^^^^^^^^^^^^^ File "/config/custom_components/librelink/api.py", line 209, in api_wrapper raise LibreLinkApiCommunicationError( custom_components.librelink.api.LibreLinkApiCommunicationError: Error fetching information

ziolopl commented 4 days ago

Yesterday evening the librelinkup app logged me out automatically. After logging in I accepted the new terms of service and now everything works in the HA.

WaeedHussain commented 2 days ago

I'm not sure if it is related but I had the same issue.HA suddenly stopped picking up the entities even when I removed the integration and started again. Used the correct credentials for LibreLinkUp but still nothing. Ended up removing the connection from LibreLinkUp and resending the invite from LibreLink to the LibreLinkUp account and HA started working again

jhthorsen commented 1 day ago

i had to log out of the LibreLinkUp app and log in again. After logging in, I was prompted to accept the user agreement. When I accepted it, it went back to HA and re-enabled the integration, and it started working again.

I think this issue can be closed by adding a «FAQ» or something to the README?

hdmvide commented 1 day ago

Yesterday evening the librelinkup app logged me out automatically. After logging in I accepted the new terms of service and now everything works in the HA.

it worked for me too. Thanks

dashernln commented 1 day ago

I'm not sure if it is related but I had the same issue.HA suddenly stopped picking up the entities even when I removed the integration and started again. Used the correct credentials for LibreLinkUp but still nothing. Ended up removing the connection from LibreLinkUp and resending the invite from LibreLink to the LibreLinkUp account and HA started working again

yep, i also experienced this issue several month ago. reinviting follower can be a solution. also, along this issue, i`ve experienced problems in master application with accessing menu "connected apps". but i forgot how i managed to access this function.

dashernln commented 1 day ago

@gillesvs maybe it worth to add this to troubleshooting section in readme?