NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.39k stars 1.14k forks source link

Dexcom Share: Ability to Specify Seconds Until Polling Retry or Allow Double Poll Retry #1849

Open utechnet opened 2 years ago

utechnet commented 2 years ago

Is your feature request related to a problem? Please describe.

This feature request is a result of my experience monitoring my T1D son. He has a Google Pixel 3a as the collector device with him at all times and wears a Dexcom G6. His endocrinologist wants data shared via Dexcom Clarity, so his Dexcom app receives the readings from the sensor and then his, mine and my wife's phones receive those readings from Dexcom Share as followers. When he is in low cellular signal areas such as school there is a delay in his phone uploading the readings to the Dex Share servers. That, in turn, causes our xdrip apps to unsuccessfully poll for the BG reading after the 5 minute interval (since it's not on the Dex Share server yet), then it waits a hard-coded 20 seconds before retrying to poll for for the BG reading again. 30-40% of the time the reading is still not there on the Dex Share server yet. At that point the app gives up and sets the next polling interval back to 5 minutes. For 30-40% of the time, my xdrip is 5-10 minutes behind. I realize that I can go to the Classic Status Page and press the "Restart Collector" button to force a re-poll. I also work at his school which does not have a nurse, so I am his. It would be quite helpful to have the readings I'm looking at be timely without needed extra interaction to make it so.

Describe the solution you'd like

I would like a new option in the menu to either 1) allow me to specify the number of seconds to wait for a Dex Share polling retry or 2) allow me to have a double retry for Dex Share with the first occurring after 20 seconds and if that is unsuccessful then another after 40 seconds.

Describe alternatives you've considered

The alternative is to manually force it to poll after the polling retry fails by going to the Classic Status Page and pressing the "Restart Collector" button.

Additional context

tolot27 commented 2 years ago

Dexcom Share Follow is using the same anticipation algorithm Nightscout Follow uses. PR #1307 implements an additional setting for an adjustable grace interval but only for Nightscout Follow. As commented in https://github.com/NightscoutFoundation/xDrip/pull/1307#issuecomment-696408857 I assume a bug in Anticipate.java.

@utechnet Is the system time of master and follower identical?

utechnet commented 2 years ago

@tolot27 Yes, both the master and the follower are connected to the same cellular carrier and have their time sourced from the carrier.

Bwangster12 commented 2 years ago

So I think I'm experiencing the same issue... however I'm noticing it while we are all connected to my home wifi with a strong signal. Today is my first day using xDrip to follow my daughter's Dexcom G6 app and noticing this frequent 5-10+ minute delay... Even when the Dexcom Follow app is updated.

psit commented 2 years ago

@tolot27: I would love to help with this if you need a tester for a nightscout follower or any logs or other information. I have xDrip on my phone just to follow nightscout (which receives data from medtronic uploader, which puts the original measurements timestamp on the data, which is the reason why the data is not there 20 seconds after the readings timestamp) and I'm suffering from the same issue (as discussed in #1307) I'm also a professional Java (but not Android) developer myself, so maybe we could also discuss some ideas if you want.

michaeld427 commented 2 years ago

I don't think this has anything to do with your network connection. The xdrip app is just polling too soon and it doesn't grab the new data. I have this constantly. I can open the Follow app to get the right value.

BG receive delay generally says 5 minutes. If it misses a reading, it needs to check again in 20 seconds or some configurable value.

olorinmaia commented 2 years ago

Experiencing same issues follower using xDrip+ on follower phones in same network as master device using Dexcom G6 to upload BS-data to Dexcom share. Is there an option or solution to make sure the readings come in every 5 minute more often than not?

I'm also using a smart watch to view BS-data but there is no option there to restart collector, would be nice if the icon to restart collector could be added when xdrip on master phone for smart watch is using collector dexcom share. Now I need to open phone and restart collector or check dexcom's follow app to view BS-data when xDrip+ doesnt fetch the update from Dexcom share servers.

olorinmaia commented 1 year ago

@jamorham 😊 Any update on this issue? We need to set manual time on parent follower phone 10-15 seconds back in time in order to get consistant readings every 5 min.

Would love to have the abiltiy to set delay timer my self.

Navid200 commented 1 year ago

Is it possible to use either xDrip sync or Nightscout instead of Dex share?

olorinmaia commented 1 year ago

Is it possible to use either xDrip sync or Nightscout instead of Dex share?

Hi Navid200 :) The best workaround to this for me was to install xdrip on the phone recieving BG from Dexcom G6 via BYODA and setup xDrip Sync. That way we also can snooze eachothers alarms (genious feature :))

Setting up Nightscout follower doesn't help, as the same problem occur with no BG-data being recieved when polled occasionally and we have to wait another 5 min or restart collector to recieve updated BG.

utechnet commented 1 year ago

Hi @Navid200 - The code for polling from Dex share and from Nightscout seems to share identical timing. What has alleviated having to manually restart the collector 50+ times each day was to use @olorinmaia suggestion to set the parent follower phone's system time 10-15 seconds behind real time.

Navid200 commented 1 year ago

Understood.

Is there a reason xDrip sync cannot be used instead of Dex share?

michaeld427 commented 1 year ago

Simple quick solution I think would be to have it check an extra two times if necessary.

If a previous comment is correct, it checks once and then 20 seconds later it checks 1 extra time. Then it waits the regular 5 minutes.

Have it check once check at least one more time (40 seconds after initial) and the maybe one more time (at 60 seconds later).

utechnet commented 1 year ago

In my case, my child's phone is his Dexcom receiver and his Endocrinologist insists that she has access to Dexcom share data with Clarity. So, my child's phone has the Dexcom app perform the polling of the transmitter and then the readings get shared to Dexcom share's servers. That solves the Endo requirement. My child's phone also has xDrip but it is subject to the same problem of often not being up to date with the latest reading. My child greatly prefers the data from xDrip but often needs to restart the collector to get it up to date when needing to make low BG correction decisions. Wouldn't xDrip sync also suffer from the same delays that we are currently stuck with? My wife and myself use xDrip primarily to follow our child through Dex Share follow as the data source and we both have the system time adjusted 10-15 seconds behind real time. I'm afraid of adjusting my child's phone's system time in case that could screw up the Dexcom app's sharing as well.

Please correct me if I'm wrong, but hasn't a fix been waiting to be merged for a few years now here: https://github.com/NightscoutFoundation/xDrip/pull/1307

I think that fix is only for Nightscout, but Dex Share seems to share the same timing code so it could apply to both. I've been also trying for years to get the free time available to learn enough to be able to build the app from source myself, then integrate that fix and see if it is the solution we've been waiting for. I do work with computers and all kinds of technology, but I'm not a programmer and last formally worked with code in some college C/C++ classes decades ago - so I have much to learn.

@michaeld427 That's exactly what I advocated for if not an adjustable grace interval here: https://github.com/Navid200/xDrip/discussions/75 and https://github.com/NightscoutFoundation/xDrip/issues/1849

Navid200 commented 1 year ago

There are many people who use Nightscout. We don't hear this problem reported by all.
Yes, there is an open PR. But, merging a PR brings with it lots of consequences. If we have a clear problem, we have to solve it. But, we don't. Many are using Nightscout to follow their children with no issues.

You can install BYODA on your child's phone as a collector. Then, it will be able to upload to Clarity. It will also be able to transfer readings to xDrip on the same phone (your child's) to xDrip with no need to internet for that. Then, xDrip can upload to either Nightscout or xDrip sync.

I cannot promise anything here. But, again, there are many who use xDrip sync with no problem. You can give it a try and if it doesn't work, go back to what you are doing now.

This provides the steps required to set up BYODA: https://navid200.github.io/xDrip/docs/DexcomAppxDrip.html

I cannot answer why a PR is not merged. The following is my personal opinion. We currently provide 3 options for following someone over the internet. One of them is xDrip sync. That is very simple.
Nightscout is free, open source and popular.
Dex share has changed recently and we have had to invest resources to resolve issues. New problems are coming up. I (personally) don't believe we should invest any more time in supporting it.
Considering we have 2 alternatives to it, I see no reason why we should keep supporting it. I cannot emphasize enough that is only my personal opinion.

michaeld427 commented 1 year ago

Is there a solution for those who have iOS as their main phone?

I'm up for an alternative solution, but in my opinion Dexcom Share is Dexcom's official API. It is a direct solution. Having to use other apps or set up a Nightscout site just makes it more convoluted.

Navid200 commented 1 year ago

For those who are limited to iOS, there is an app called xDrip4iOS. I could be wrong; but, a search shows that it can upload to Nightscout. It is not an app that we have created or support.

olorinmaia commented 1 year ago

I will share what I believe is the best way to recieve BG data in xDrip+ if u want to use the Dexcom app and then share with followers using xDrip+. This is the "xDrip Sync Follower" setup. You can also use a function called "Remote snooze" that snoozes handsets within the same Sync group with a push of a button.

1) On phone recieving BG: Install BYODA and enable local broadcast to xDrip+ 2) On Phone recieving BG: To recieve BG from BYODA in xDrip+ set "640G / Eversense" as collector. 3) On Phone recieving BG: Configure as "Master" in xDrip+ Sync settings 4) Copy Synchronization key and share with followers, 5) Followers setup "xDrip sync follower" as collector and paste in the synchronization key from master device in sync settings.

For iPhone turning back time 10-15 seconds on follower xdrip+ phone is the workaround if "Dexcom follower" or "Nightscout follower" are to be used until this issue gets fixed. For me it seems like a simple fix (do another poll if first and second fails?) but things could be more complex than I understand :)

Navid200 commented 7 months ago

xDrip now has a Nightscout follow delay setting as explained here: https://navid200.github.io/xDrip/docs/Follow/FollowNightscout.html

Considering that, can Nightscout be used instead of Dex share to address this issue?

utechnet commented 7 months ago

Terrific job with the feature addition and the write-up! My use of xDrip has been improved in January 2023 when I followed @olorinmaia 's directions to setup xDrip sync. I never experience this delayed reading issue anymore after beginning to use xDrip sync. The only issue is needing to use the BYOD Dexcom app in order to get the local broadcast of the readings into the xDrip master. That breaks automatic Play Store updates to the app, but that is quite minor. However, for some users Nightscout is not a project they are able to technologically accomplish. Since the identical code is in use for the timing of polling from a Dexcom share source as a Nightscout source, it would make most sense to me to duplicate this feature in the code for the Dexcom share source in addition to Nightscout.

michaeld427 commented 7 months ago

I personally think that since Dexcom Share/Follow is the official way that Dexcom supports data sharing and is by far the easiest to setup, it should be supported properly.

Setting up Nightscout isn't so straight forward and using this method is basically making you have to sync from something else that is syncing.

Navid200 commented 7 months ago

It is very easy to set up Nightscout: https://navid200.github.io/xDrip/docs/Nightscout/GoogleCloud.html There are even video clips included in the guide.

michaeld427 commented 7 months ago

I'm a developer and techy person, and I already have Nightscout setup. I didn't encounter any difficulties doing it. But I think saying it is very easy to setup is disingenuous to non-tech people. The guide is has 6 different installation sections. With a dozen How to sections, a dozen FAQs, a dozen Troubleshooting tips and more.

We can agree to disagree on that.

I will just say again that Dexcom Share is the official Dexcom data sharing mechanism. I think it should work directly and you shouldn't need an unnecessary thing in the middle.

Navid200 commented 7 months ago

Without someone who can add and test it, it is not going to happen. I am not not adding a single line to xDrip if I cannot test it myself. One can open a PR to submit their proposal. Or, they can use the existing options, which I have presented. I am sorry if it is difficult. Not much more I can do about it other than providing a guide and supporting those who run into difficulty.

olorinmaia commented 7 months ago

@Navid200 is it possible to re-use the fix you did for Nightscout follower for Dexcom Share? If you can point me in the right direction, or maybe make a new branch on your repo with this possible fix for Dexcom Share, me and probably many more here can assist you with verifying it works! :)

I'm using AAPS now and still using xDrip+ sync follower to get BG, only difference I broadcast from AAPS/AAPSClient to xDrip+, it work flawlessly. I can however understand the need for people without Nightscout / AAPS to use Dexcom Share to get BG into xDrip+ since this is without a doubt the best app for alerting and much more.

Navid200 commented 1 week ago

I will be opening a PR to add the ability to add an optional delay to Dex share follower.