gillesvs / librelink

Librelink integration for Home Assistant
MIT License
21 stars 6 forks source link

Getting values from 2 patients #2

Closed MarkusKetola closed 6 months ago

MarkusKetola commented 7 months ago

If you follow two patients in Libreview, the values received are combined to same sensor. Can this be separated?

inakiarredondo commented 6 months ago

Agree. When you are monitoring several users under your account, it would be great if we could select the one we are going to integrate. Even better, if we could add the integration several times, for the different users. PS: than you @gillesvs for creating this integration. it is really useful.

gillesvs commented 6 months ago

Hello,

@MarkusKetola : Yes, I think this is possible. I can try based on the API documentation, but I use a single account and therefore I do not have data to validate multiple accounts. I will add this in the request list for the next release.

@inakiarredondo , Normaly you should be able to add the integration several times for different users. It is not working? Having only one account for one patient is very limitating for testing multiple patients/accounts requests

gillesvs commented 6 months ago

If you follow two patients in Libreview, the values received are combined to same sensor. Can this be separated?

Can you send me a screen shot to be sure i understand the result?

KetolaSami commented 6 months ago

image Sample image from Home Assistant history, where it plots two patients in the same graph

KetolaSami commented 6 months ago

image The same period zoomed in

KetolaSami commented 6 months ago

In LibreLinkUp app you can get up to 20 patients data visible in the app. I have two patients here. There must be some ID in the received data, that identifies which sensor value has been received?

gillesvs commented 6 months ago

In LibreLinkUp app you can get up to 20 patients data visible in the app. I have two patients here. There must be some ID in the received data, that identifies which sensor value has been received?

Yes absolutely. My problem is I cannot see the result from the API with my single account.... I can try to guess but this is not great for testing and this might link to regressions for other users. I will look into it.

MarkusKetola commented 6 months ago

If you need, I can add you to recipient to my sons libre3 data. It needs just your e-mail address, if I remember correctly?

gillesvs commented 6 months ago

If you need, I can add you to recipient to my sons libre3 data. It needs just your e-mail address, if I remember correctly?

Yes thanks, that would greatly help to implement the feature: gilles.vanschendel@gmail.com

MarkusKetola commented 6 months ago

Sorry, I tried that, but we shoud be using the same localization settings. So, it did not allow to add you...

inakiarredondo commented 6 months ago

Same here. I also tried to add you @gillesvs but got the same message. You could probably create a new librelink/libreview account with Spain (in my case) as region, but then you will not be able to invite yourself, so we are back to square one...

gillesvs commented 6 months ago

Same here. I also tried to add you @gillesvs but got the same message. You could probably create a new librelink/libreview account with Spain (in my case) as region, but then you will not be able to invite yourself, so we are back to square one...

I think I can guess the output for multiple patients. I will propose a test version in the days to come.

greghesp commented 6 months ago

Same here. I also tried to add you @gillesvs but got the same message. You could probably create a new librelink/libreview account with Spain (in my case) as region, but then you will not be able to invite yourself, so we are back to square one...

If you enable debug logging, it looks like the response will be logged. You could always try this and then sending the data from the log file

gillesvs commented 6 months ago

Version 1.1.5 has been released to manage multiple patients per account. I did try to guess the API result. I also catch the API response in the DEBUG. So please send me the logs (enable logging) if it does not work

read the warning in the release note ;-)

mkotek commented 6 months ago

I have managed to get it running. The problem is, value is not updated, even though in debug, I can see new readouts with changed values. But time since last measurement now reads 35 minutes.

gillesvs commented 6 months ago

I have managed to get it running. The problem is, value is not updated, even though in debug, I can see new readouts with changed values. But time since last measurement now reads 35 minutes.

Yes i fixed it in 1.1.5 Just download last beta version in hacs directly

alexanderznamensky commented 6 months ago

Dear @gillesvs! Thanks for great work! It is really useful for diabet control! In my case I cannot add second patient. Once the second patient appeared, but the first one disappeared. Now when adding I get an error:

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:610 First occurred: 10:37:45 (56 occurrences) Last logged: 12:05:49

Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-c1a9c786a4021b4afdddd9de55bcbe2b-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-value already exists - ignoring sensor.veronika_znamenskaia_glucose_measurement_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-trend already exists - ignoring sensor.veronika_znamenskaia_glucose_trend_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-sensor already exists - ignoring sensor.veronika_znamenskaia_active_sensor_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2

gillesvs commented 6 months ago

Dear @gillesvs! Thanks for great work! It is really useful for diabet control! In my case I cannot add second patient. Once the second patient appeared, but the first one disappeared. Now when adding I get an error:

Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:610 First occurred: 10:37:45 (56 occurrences) Last logged: 12:05:49

Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-c1a9c786a4021b4afdddd9de55bcbe2b-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-value already exists - ignoring sensor.veronika_znamenskaia_glucose_measurement_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-trend already exists - ignoring sensor.veronika_znamenskaia_glucose_trend_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-sensor already exists - ignoring sensor.veronika_znamenskaia_active_sensor_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2

Thanks for feedback. Can you pass the integration in debug mode and send me the log? So I will finally have a look at the API response for multiple patients (as for now, I am simply guessing as Abbott does not provide official documentation of their API) Indeed, as Veronika should be a patient and not the account owner, it should not create duplicate Ids.... but there is something I do not see, that is why i need logs.

The expected behavior is, for a single account, to have as many devices created as there are patients, with sensors prefixed by the patient name.

Thanks to be part of this "blind" debugging session ;-) gilles

KetolaSami commented 6 months ago

I was looking at the log file, it seems to be quite clear, how it separates those two patients? image

gillesvs commented 6 months ago

Dear @gillesvs! Thanks for great work! It is really useful for diabet control! In my case I cannot add second patient. Once the second patient appeared, but the first one disappeared. Now when adding I get an error: Logger: homeassistant.components.sensor Source: helpers/entity_platform.py:610 First occurred: 10:37:45 (56 occurrences) Last logged: 12:05:49 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-c1a9c786a4021b4afdddd9de55bcbe2b-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-value already exists - ignoring sensor.veronika_znamenskaia_glucose_measurement_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-trend already exists - ignoring sensor.veronika_znamenskaia_glucose_trend_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-sensor already exists - ignoring sensor.veronika_znamenskaia_active_sensor_2 Platform librelink does not generate unique IDs. ID e4a78e05-0780-11ec-ad7d-0242ac110005-f1324e683c846e1ecc2ac12e4ceb092e-delay already exists - ignoring sensor.veronika_znamenskaia_minutes_since_update_2

Thanks for feedback. Can you pass the integration in debug mode and send me the log? So I will finally have a look at the API response for multiple patients (as for now, I am simply guessing as Abbott does not provide official documentation of their API) Indeed, as Veronika should be a patient and not the account owner, it should not create duplicate Ids.... but there is something I do not see, that is why i need logs. The expected behavior is, for a single account, to have as many devices created as there are patients, with sensors prefixed by the patient name. Thanks to be part of this "blind" debugging session ;-) gilles

I can provide access to my HA account (if you need). Note: i'm using slightly different URL (due to my location). In the mean time in API Response there are both patients (Sofya and Veronica).

Thanks for the log! And this is precisely what I guessed (an array of patients). So the bad news is that it confirmed what I implement in terms of logic, but does not help so much to debug.... :-)

Ideally, to do debug, I would need to test an account with two patients like yours in my test environment . I would perfectly understand that you do not want to share your librelink account, but that would be the easiest for me to find a correction. If ok, my email address is gilles.vanschendel@gmail.com to send me your librelink account credentials. the duration of the test phase.

gillesvs commented 6 months ago

I was looking at the log file, it seems to be quite clear, how it separates those two patients? image

Yes, thanks. That is what I thought and what should be working in version 1.1.5. But for some reason it does not...

gillesvs commented 6 months ago

Hi all,

WARNING: @alexanderznamensky and other sharing logs, to help me: you might want to hide the token (I ask for the api response and the token is included). I do not need token, my objective was to understant the global API structure with multiple patients. Because this is a long lasting token and any one with it can retreive your data.

I catch the log I needed, so @alexanderznamensky I deleted your very helpful comment to avoid any unwanted data sharing

alexanderznamensky commented 6 months ago

thanks! But my log is still existing in your reply )

gillesvs commented 6 months ago

thanks! But my log is still existing in your reply )

yes, was just deleting it. It's done

gillesvs commented 6 months ago

Beta Release 1.1.7 tested with two patients accounts works is tested successfully.