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

Desert Sync Feature #558

Closed
jamorham opened this issue Aug 21, 2018 · 35 comments
Closed

Desert Sync Feature #558

jamorham opened this issue Aug 21, 2018 · 35 comments
Assignees

Comments

@jamorham
Copy link
Collaborator

Requests and a bounty offer have been received to implement xDrip follower sync without an internet connection.

If you are interested in this feature, please add a comment with your usage case and how you would want this to work. By adding a comment you should get notified of updates to this issue when there is anything to test.

@jamorham jamorham self-assigned this Aug 21, 2018
@Kustomwireless
Copy link

This would be very help full to us We spend a lot of time on a motor bike my wife's phone is the master and most times in her bag my phone is the follower and is set up on the handle bars and we both can see Xdrip as we are going down the road works great as long as we have phone service but many times no service so the follower will not get updates this is why I am asking.

@jamorham
Copy link
Collaborator Author

Okay the 27th Aug nightly has the new Desert Sync feature for when you are in an internet desert.

To enable it you need to establish a connection between the phones. In testing I did this by using the wifi hotspot feature of the master phone and then connecting the follower phone to it via wifi.

Once you have the link established, go in to xDrip+ Sync Settings and in to the Desert Sync section. Here you can enable the service. Once enabled then you can use the option to display the QR code on the master and then on the follower phone camera scan this with the xDrip+ Settings -> Auto Configure feature.

What you should then find is that if you turn off mobile data on both handsets then they continue to be able to sync without internet access. Indeed you can use a hybrid of mobile data and wifi and it will use both, so you get the advantages of data transfer whether you are out of range of the other handset or cellular data.

This is an early release and there may still be some rough edges and bugs or small delays with the syncing. I should be able to improve these but I have included it in the nightly so anyone who is interested can test it out.

@er0780
Copy link

er0780 commented Aug 28, 2018

Hello Jamorham,
sorry for being offline for many days. We had bad times according to strange blood sugars.
But know I am back.

We have been in holiday some weeks ago and ... there I found some good reasons:
In the appartment near to the seaside there was no WLAN and the mobile internet connect was very slow with a lot of interruptions. So a "Desert sync" feature (nice name ;)) would have been helpful. On the beach there was no connectivity at all. So another possibility to get data to the follower.

@keencave
Copy link
Contributor

The feature works! Using a master/follower is no possible for me in my company wifi network. Seems the Google firebase service is blocked on the gateway router. After enabling the desert sync option I got data on my follower phone via local wifi. Perfect!

@jweismann
Copy link

Hello Jamorham - I'm very interested in testing this. I have two followers today. If I upgrade xdrip on master and the two followers to the latest version, is all it takes that I turn the dessert sync on on all three phones or would I need to do more ?

@tzachi-dar
Copy link
Contributor

A very nice feature. Very impressive.

A few notes:

  1. This feature could be used even inside the house where there is internet all the time. This is to avoid issues when there is no internet connection when there is an isp failure.

  2. This can be used (with some modifications) for remote snoozes. Current gms messaging might take a minute or two for messages to pass which is too slow for remote snoozing. This mechanism (if extended should work faster).

  3. If I understand correctly, the server IP is received through scanning for it. This will work at the beginning but after some time ip addresses change (many times a router reset will cause ip changes).
    I believe that adding a mechanism like mdns (see https://developer.android.com/training/connect-devices-wirelessly/wifi-direct for example) should work well in this cases. Needs some more thinking, but as a general rule.

Great initiative.

@jamorham
Copy link
Collaborator Author

@jweismann yes upgrade to the latest nightly and then follow the instructions I provided a few comments up to enable it.

@jweismann
Copy link

@jamorham - Thanks! I want to share my first experiences with you. It seemed to work fine during the night and when she moved to a new location in the morning it started to fail regularly. I have a detailed logfile that I will send to you from one of the follower phone that lost data regularly (both followers did).
It seems that the IP of the master changed but I wasn't there to re-autoconfigure. I should be mentioned that all phones were on 4G data and no wifi involved at the problematic location. I was wondering if the master would be able to share a new IP address with its followers using its 4G data connectivity assuming that is working well so desert sync will be able recover its state automatically. Thanks again. Please let me know if more logs would be useful to you.

@tzachi-dar
Copy link
Contributor

@jweismann if you have 4g connectivity to both phones, why do they need the desert mode? they can talk in the normal way can't they?

@jweismann
Copy link

@tzachi-dar I have seen periods where one or both followers are loosing signals for 30 mins or more with classical xdrip sync mode (no nsclient involved) and if this issue is indeed 4G related then I was hoping to see something different with desert mode and learn from that. Moreover, I wanted to help test this new feature by trying it out and share experiences. Apparently my original problem seems to persist with desert mode but desert mode was explicit in saying that the master IP appears unreachable.

@jamorham
Copy link
Collaborator Author

Automatic re-tracking of changed master/follower IP addresses is coming soon.

@jweismann
Copy link

@jamorham - sounds great. I will be happy to help you test this. Thanks

@bordeb
Copy link
Contributor

bordeb commented Sep 2, 2018

couldn't resist to say, an excellent feature, thumbs up, great job, many tnx!!

@dideldum
Copy link

dideldum commented Sep 3, 2018

Thanks, thanks, thanks!

This is a great feature, which I was not hoping to see so soon!

Our constellation with our daughter is: xDrip+ as a master on a full Android smartwatch (worn by her in her pump belt). A phone with xDrip+ as a follower and AndroidAPS to control her pump (AAPS would run on the watch, but it is very uncomfortable to use it and for a 5years old girl the watch is to big to wear it on her arm, so it is without the straps inside a pocket in the pump belt). Now even in zones without cellular network we can have the connection between watch and phone using a hotspot and have the full system working.
You made me very happy!!!

@jamorham
Copy link
Collaborator Author

jamorham commented Sep 3, 2018

The Sept 3rd nightly includes improvements to the Desert Sync feature.

Master IP address changes are now fed back locally and over the google cloud, so if the IP changes and both devices are still on the same wifi network or have internet access, then the new address can be learned by the followers.

Followers also track two ip addresses, so if you have a situation where you are alternating between personal hotspot and hotel wifi, for example, and the connection on the follower is lost, eg when the personal hotspot is switched off/on, the follower will attempt to revert to the previous known alternate address of the master.

@er0780
Copy link

er0780 commented Sep 3, 2018

@dideldum
Sorry, I did not get it.
What are you doing with your daugther?! The Android smartwatch is the master?!

@jweismann
Copy link

@jamorham - GREAT! That was fast. I installed the latest on the three phones and not sure if I need to auto reconfigure them but I tried to do this on both followers and found that I persistently got "Got exception installing preferences" when trying to scan the code. This was consistent across the two followers. Not sure if I actually need to auto-reconfigure or not. Maybe the exception is due to the fact that they are already set up as master/follower or?

@jweismann
Copy link

@jamorham - I forgot that all phones had to be on the wifi before doing the sync. When I did that, they got configured alright. If time permits, maybe this could be hinted in the log. Thanks again. Looking forward to test it now. Will get back.

@jweismann
Copy link

@jamorham I tried to disable wifi and data connectivity on one follower and it has not seen signals on this phone since. Would the logfile from the follower be useful to you? Would you need logfiles from the other follower and master too?

@jamorham
Copy link
Collaborator Author

jamorham commented Sep 3, 2018

@jweismann Feel free to upload the logs but they may not show much as only certain errors are logged. Does the phone get data again if you re-enable connectivity on it?

@jweismann
Copy link

@jamorham Yes, when I set it back on wifi (to upload the log), it got all the lost signals. I will upload logs from the master data too. Are there any underlying assumptions regarding android versions that I should be aware of?

@jweismann
Copy link

@jamorham - the relevant period of time is around 22:00 and ~1 hours test before tuning wifi and mobiledata on again.

@jweismann
Copy link

@jamorham - silly question: I had the master and the other follower on wifi still. Is that a problem? Will they all have to change "state" or can I have some (say master and one follower) on wifi/mobildata and others (the last follower) on neither wifi nor mobiledata ?

@yosepito
Copy link

yosepito commented Sep 6, 2018

working fine between two smartphones (two Xiaomis Redmi 3s) because I used the feature of scanning the bar code. But, I have a smartwatch (4g, wifi...) and it cannot scan the bar code. Please, which are the 7 changes it introduces in prefs? I need to do this manually in the smartwatch. The Master IP is 192.168.43.1 but this is the only change I've been able to introduce in the smartwatch, and it is not working.
thanks for the feature!

@jamorham
Copy link
Collaborator Author

jamorham commented Sep 6, 2018

@yosepito you need to set the Inter-app settings -> web service secret the same on all devices. This is generated randomly when Desert Sync is first set up. You may want to simplify this password to type in on your watch.

@jamorham
Copy link
Collaborator Author

jamorham commented Sep 6, 2018

@jweismann it wont work if there is no connectivity between the devices. There needs to be either mobile data or wifi, the wifi can be one phone (ideally the master) running a personal hotspot.

@jweismann
Copy link

@jamorham - thanks! I have looked more into the particular issue I have and found that it's a smart-board that disturb one of the phones, say p2. It disturb it to an extend where the only work-around to regain 4G cellular data services on p2 is to toggle flight-mode on/off (very annoying!). I have a 4 phones setup in xdrip sync mode (+desert), i.e. no nsclient involved in the sync setup. Two of the other phones are not close (p3,p4) but the main phone p1 (the one connected to the G5) is indeed often close to the phone that has a problem with the smart-board. I'm wondering if the best strategy for this challenge would be to setup p1 as a wifi hotspot for p2 so that p2 has two access routes - wifi when p1 is close and 4G cellular data when it's not broken. Will p3 and p4 get data via the sync mode when p1 and p2 syncs over wifi whereas p3 and p4 would need to sync with p1/p2 over the Internet. Can p1 sync with p2 over wifi and with p3,p4 over cellular data and will p1 forward data from p2 to p3,p4 in this case? Thanks in advance.

@jamorham
Copy link
Collaborator Author

jamorham commented Sep 9, 2018

@jweismann I think the answer is that yes any combination of desert and normal sync will work but I haven't tested all those configurations to be sure.

@jweismann
Copy link

@jamorham - thanks and no worries. I will be happy to help testing it. I will get back when I have experimented with this.

@jamorham
Copy link
Collaborator Author

How are people getting on with Desert Sync? Is it working reliably? Has anyone had a chance to use it "in the wild" yet?

@jweismann
Copy link

@jamorham I can say that it works perfectly for us. We have one master and 4 followers with 1-2 followers often close to master. The master (+1-2 followers) will commute between two LANs on a daily basis and the switch is picked up automatically with no noticeable data delay. Great! THANKS!!!!

I have been wondering if one of the followers should be removed eventually (some of them were added for testing purposes). I can reinstall on the follower to be removed but how will the remaining 4 phones get this info and remove it from their internal list of followers?

@er0780
Copy link

er0780 commented Sep 25, 2018

@jamorham Hello, I tested the Desert Sync function and ... it is great!
We use it in the night, in the car and in the city center where we do not always have mobile connectivty. It will be used during our holiday trips.

I found something that it not working well for us. I am not sure, whether this is a problem that only counts for us, because nobody else metioned it:
The AndroidUploader is getting the data from the Minimed 640g Insulinpump and then the Uploader is sending this data to xDrip (or xDrip is reading the data from the AndroidUploader). However, since we updated to the xDrip-version containing the DesertSync function we lost the data backfill in xDrip.
When our little one is coming home from child care we take the master phone, connect the Contour Next Link and start the Android Uploader. As befor the xDrip software update the AndroidUploader shows the actual CGM value and is doing a data backfill. Befor the xDrip software update these data were transferred to xDrip and were shown there. Since the xDrip software update all data are still shown in the AndroidUploader (incl. data backfill) but xDrip itself shows only the data that have been collect from starting from the time point when the Contour Next Link was connected to the master mobile phone.
When our little one is turning around at night and one data point is missed the AndroidUploader is doing a backfill when reading out the next data point. But the data point that is backfilled is not transferred to xDrip.
One the follower mobile phone the appeareance is the same (as expected): Data that are not show in master's xDrip are also not shown on followers xDrip.

Two other independent questions:
When using the urchin watchface on a Pebble watch you can see little strips for every given bolus. That means that the AndroidUploader is not only collecting CGM values but also timepoints (and values?) of given bolus'. Is it possible to transfer this data to xDrip and to show them in the CGM curve?

It is possible to change / edit the xDrip watchface or to combine it with the urchin watchface? The CGM value is of high relevance for us while the time is less important ... and the CGM value is in the night without glasses to small for me ... D':

@jamorham
Copy link
Collaborator Author

@er0780 can you explain to me, where does Nightscout sit in your setup. Does your AndroidUploader send to xDrip or Nightscout or both? xDrip can download treatment entries from Nightscout and it supports this from AAPS but I don't think AndroidUploader (via its local broadcast feature)

@er0780
Copy link

er0780 commented Sep 29, 2018

@jamorham We are not using Nightscout.

The AndroidUploader on the Master sends its data directly to xDrip on the same phone.

The AndroidUploader itself shows no treatments. But when connecting a Pebble Watch with Urching watchface with the AndroidUploader you can see the treatments as little " , " in the time scale under the CGM curve. So the AndroidUploade must load this data from the insulin pump.

Yesterday I set the xDrip version back to that one without Desert Sync ... on both phones, master and follower ... and now data backfill is working fine.
Then I updated again to that vesion with Desert Sync and there is again no data backfill. xDrip only takes those data from the (completely backfilled) AndroidUploader that are collected starting from that timepoint when the Contour Next Link is connected to the Master.

@Navid200
Copy link
Collaborator

Navid200 commented Aug 7, 2021

@jamorham I hope you don't mind me closing this issue.
It can still be found by search and provide information to users.

@Navid200 Navid200 closed this as completed Aug 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants