librelink icon indicating copy to clipboard operation
librelink copied to clipboard

Issue identified : Something really wrong happened!

Open realogic opened this issue 1 year ago • 36 comments

** Which country are you from ** ITALY

Describe the bug Since this morning, the add-on fails with error "Something really wrong happened!"

Log file Logger: homeassistant.config_entries Source: config_entries.py:640 First occurred: 11:55:48 (2 occurrences) Last logged: 11:55:57

Error setting up entry MAIL 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.13/site-packages/aiohttp/client_reqrep.py", line 1157, in raise_for_status raise ClientResponseError( ...<5 lines>... ) aiohttp.client_exceptions.ClientResponseError: 430, message='', 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 640, in __async_setup_with_context 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( ^^^^^^^^^^^^^^^^^^ ...<9 lines>... ) ^ File "/config/custom_components/librelink/api.py", line 209, in api_wrapper raise LibreLinkApiCommunicationError( "Error fetching information", ) from exception custom_components.librelink.api.LibreLinkApiCommunicationError: Error fetching information

Screenshots If applicable, add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

realogic avatar Dec 10 '24 11:12 realogic

I started having the same issue an hour ago, something seems to have changed on the libreview side of things as their API is returning an HTTP/430 status, which is not officially defined.

For me, this started happening at 11:04 today (CET).

D0ublek1ll avatar Dec 10 '24 11:12 D0ublek1ll

Yes, very same time

realogic avatar Dec 10 '24 11:12 realogic

I can confirm this happened to me as well at 11:04 CET today. Their server could simply be down.

TekFan avatar Dec 10 '24 11:12 TekFan

I found another issue regarding the same status code from a couple of months ago: https://github.com/gillesvs/librelink/issues/31

In that it was suggested that it could be related to having to accept the terms of service on the libreview site/librelinkup app. I am trying that right now, will update with results.

Edit: Did not fix the issue.

D0ublek1ll avatar Dec 10 '24 11:12 D0ublek1ll

I tried already, signing in and out the LibreLinkUp on my mobile. Accepted the terms, reloaded the add-on, no changes On app data is retrieved, so I don't think the service is down

realogic avatar Dec 10 '24 11:12 realogic

Same problem. In these days the app LibrelinkUp warned to update compulsorily, otherwise it would stop working. They probably changed something in the API or simply the server for italy area

lucamargoni avatar Dec 10 '24 11:12 lucamargoni

Libreview, librelinkup and freestyle libre all seem to work as intended, so it seems to be the Libreview API that is causing these issues.

I tried using different regions/api servers but all give the same result. Maybe @gillesvs can give us more insight into what could cause this issue?

D0ublek1ll avatar Dec 10 '24 11:12 D0ublek1ll

Same here, same timestamp:

This error originated from a custom integration.

Logger: custom_components.librelink Source: helpers/update_coordinator.py:414 integration: LibreLink integration (documentation, issues) First occurred: 11:03:56 AM (1 occurrences) Last logged: 11:03:56 AM

Error fetching librelink data: Something really wrong happened!

Pleister023 avatar Dec 10 '24 12:12 Pleister023

They are now requiring a minimal version 4.12.0 to be specified in https://github.com/gillesvs/librelink/blob/0b12fa9c415c7c49d0c235f6fa881501eb6409b3/custom_components/librelink/const.py#L41 and a new "Account-Id" HTTP header carrying the SHA256 digest of a user's id as a 64-char hexadecimal string along the JWT token.

Look at my Swift one-liners I PRed with https://github.com/JohanDegraeve/xdripswift/commit/13e4a1e7418364fbdb68e5bd54cac888fd2eb9b8 ;-)

gui-dos avatar Dec 10 '24 12:12 gui-dos

_> They are now requiring a minimal version 4.12.0 to be specified in

https://github.com/gillesvs/librelink/blob/0b12fa9c415c7c49d0c235f6fa881501eb6409b3/custom_components/librelink/const.py#L41

and a new "Account-Id" HTTP header carrying the SHA256 digest of user-id as a 64-char hexadecimal string along the JWT token. Look at my Swift one-liners I PRed with JohanDegraeve/xdripswift@13e4a1e ;-)_

Thanks for the update. I managed to change 4.7 into 4.12.0 in that config file. I have no clue what to do with the rest of your solution: "and a new "Account-Id" HTTP header carrying the SHA256 digest of user-id as a 64-char hexadecimal string along the JWT token." The link below that brings me to a lot of code. No idea what to do with this. Any help is much appreciated.

Thanks.

Pleister023 avatar Dec 10 '24 14:12 Pleister023

Have the issue as well… latest reported glucose measurement sensor value at at 11:03 CET

Zpuit avatar Dec 10 '24 15:12 Zpuit

Same issue here @gillesvs are you planing to fix issue ?

xamrex avatar Dec 10 '24 15:12 xamrex

Also the same issue, Czech region. However the region seems to be not important in this case. Please, prepare uodate to fix it.

padoubek avatar Dec 10 '24 17:12 padoubek

Same issue here in Denmark.

Flemming789 avatar Dec 10 '24 17:12 Flemming789

Spain is not different

santypav avatar Dec 10 '24 18:12 santypav

Belgium has the same problem since 11:04 CET

WillemBastiaens avatar Dec 10 '24 18:12 WillemBastiaens

based on https://github.com/gillesvs/librelink/issues/39#issuecomment-2531500325 i noticed that in const.py VERSION_APP = "4.7" should be changed to VERSION_APP = "4.11.0"

but unfortunately i have no idea what to do with this sha256 function ;(

xamrex avatar Dec 10 '24 20:12 xamrex

@gui-dos can you please take a look at "Application": APPLICATION, as i understand I need to add bellow: this line

"Account-Id": SOMETHING // and that SOMETHING has to be in sha256() but what should be set as Account-id? is it just sha256("4.11.0") ?

xamrex avatar Dec 10 '24 20:12 xamrex

@xamrex:

The Account-Id header has to be appended to the headers defined in https://github.com/gillesvs/librelink/blob/0b12fa9c415c7c49d0c235f6fa881501eb6409b3/custom_components/librelink/api.py#L99-L110

If you follow yourself you can reuse the patient_id, otherwise you have to extract the logging user's id from reponseLogin["data"]["user"]["id"] (https://github.com/gillesvs/librelink/blob/0b12fa9c415c7c49d0c235f6fa881501eb6409b3/custom_components/librelink/api.py#L168).

I just noticed tonight's Python implementation by https://github.com/robberwick/pylibrelinkup/commit/06bce4537a84557e2a05c10e2409c963bdf17291 which makes use of hashlib.sha256(account_id.encode()).hexdigest() ;-)

4.12.0 version must be used instead of 4.11.0 now, of course.

gui-dos avatar Dec 10 '24 21:12 gui-dos

To ALL Here is working fork:

https://github.com/kubasaw/librelink

xamrex avatar Dec 10 '24 23:12 xamrex

Also got the sam issue.

Happy to see there might be a solution soon to this issues.

@xamrex

First i was like ... there is alot of changes. Then I looked closer ...

You changed alot, but I just read the comment from the author on you commit.

Is is possible you can make a PR to just fix this issue so the packages can be updated via HACS?

syska avatar Dec 11 '24 01:12 syska

@syska its not my fork ;-)

Is is possible you can make a PR to just fix this issue so the packages can be updated via HACS?

Im afriad no, It looks like author of this repo has some issue with PR: Here is one opened https://github.com/gillesvs/librelink/pull/34 and not merged.

So the easiest way to fix issue is to remove this repo form HACS and add this one: https://github.com/kubasaw/librelink

xamrex avatar Dec 11 '24 07:12 xamrex

It appears this new repo (https://github.com/kubasaw/librelink) was added to HACS a couple of hours ago, its using the same name and icon. There are some changes as to which entities it presents and the naming has changed compared to the old integration (_glucose_measurement -> _measurement)

Also the newly added integration will install in the same location as the old one. so you should first delete and uninstall the old integration before installing the new one.

Given the author of this repo's lack of response and the past issues with the PR on this repo it should probably be removed from hacs.

D0ublek1ll avatar Dec 11 '24 08:12 D0ublek1ll

Moved to that repo too, just finished reconfiguring sensors. Thank you! Still, thanks to the original author @gillesvs to his precious work

realogic avatar Dec 11 '24 10:12 realogic

A HUGE thanks to @gillesvs ...

It's not until things breaks you know how much you really need it.

Now we just need to figure out where it should be hosted going forward.

syska avatar Dec 11 '24 12:12 syska

Also have "Something really wrong happened!", using from France, the librelinkup on mobile works

r-jean-pierre avatar Dec 11 '24 20:12 r-jean-pierre

@r-jean-pierre use this custom repo instead: https://github.com/kubasaw/librelink

xamrex avatar Dec 11 '24 20:12 xamrex

Hello. After the change of repo and restart ha I am now able to log in but then I get this errore Screenshot_20241212-003150_Home Assistant

zaffraz avatar Dec 11 '24 23:12 zaffraz

@zaffraz

I Can't read that language ... I have abosolutely no idea what is says.

But I would open a terminal or editor and delete all the old "libre" files and try to install again. You should be able to select a "Patinet Id" with a radio button. ( Probably the email you want to follow )

syska avatar Dec 12 '24 01:12 syska

I Can't read that language ... I have abosolutely no idea what is says.

Luckily, Google Translate can ;-) "Not all mandatory fields are filled in."

TekFan avatar Dec 12 '24 13:12 TekFan