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

Tzachi OpenAPS data 3 #1303

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open

Tzachi OpenAPS data 3 #1303

wants to merge 20 commits into from

Conversation

tzachi-dar
Copy link
Contributor

This PR allows xdrip to display OAPS data (basal rate, iob, cob and last connected).

Works when xdrip is uploading to NS and also in ns client mode.

Also send the data when in follower mode.

I have tested this code for a few month and it works well for me.

tzachi-dar and others added 20 commits April 10, 2020 15:55
… of the DB.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Still need to download it when working in nightscout follower mode.

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
(It ended by sending too much data to followers.)

Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
# Conflicts:
#	app/src/main/java/com/eveningoutpost/dexdrip/UtilityModels/BgGraphBuilder.java
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
Signed-off-by: Tzachi Dar <tzachi.dar@gmail.com>
@tzachi-dar
Copy link
Contributor Author

Here is an example to the output.
image

@old-square-eyes
Copy link

Would love the OpenAPS data on My SWR50. Is this part of the PR?

@old-square-eyes
Copy link

Also... what is "ns client mode" in this context? I use NSClient currently and would love to only use one app. I'm hoping xDrip will have enough features to get rid of NSclient from my phone (it's a battery hog).

@tolot27
Copy link
Collaborator

tolot27 commented Nov 6, 2020

Also... what is "ns client mode" in this context? I use NSClient currently and would love to only use one app. I'm hoping xDrip will have enough features to get rid of NSclient from my phone (it's a battery hog).

What do you mean by NSClient? xDrip itself has a builtin NS client (Follower mode). Did you test it, already?

@old-square-eyes
Copy link

old-square-eyes commented Nov 6, 2020

@tolot27 that's the point... I don't know :) Was asking @tzachi-dar what they were talking about. NSClient is a build of AAPS I use as a client for Nightscout to visualise icicles, OpenAPS IOB + predictions, and enter Careportal treatments. Ideally I'd just like one app but xDrip doesn't have nearly the feature set.

@tolot27
Copy link
Collaborator

tolot27 commented Nov 6, 2020

@tolot27 that's the point... I don't know :) Was asking @tzachi-dar what they were talking about. NSClient is a build of AAPS I use as a client for Nightscout to visualise icicles, OpenAPS IOB + predictions, and enter Careportal treatments. Ideally I'd just like one app but xDrip doesn't have nearly the feature set.

Why don't you use the Nightscout Follower Hardware Data source or configure Nightscout in the Sync settings if you use a different data source? You don't need a separate client for it, just xDrip+.

@old-square-eyes
Copy link

old-square-eyes commented Nov 6, 2020

Nightscout Follower Hardware Data source

Because I use xDrip to collect from my G6, and all the other fore mentioned reasons (for having a separate NS client)... Icicles, OpenAPS IOB + predictions, and entering Careportal treatments. AAPS NSClient is superior for those. But if xDrip improved its OpenAPS visuals (such as I suspect is in this PR) I could probably drop AAPS NSClient.

I never said I use a different data source.

@tolot27 tolot27 changed the title Tzachi opeanps data 3 Tzachi OpenAPS data 3 Nov 15, 2020
@tolot27
Copy link
Collaborator

tolot27 commented Nov 15, 2020

@tzachi-dar Please can you rebase this PR on master to get the conflicts resolved?

Copy link
Collaborator

@tolot27 tolot27 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General comment: Please use a consistant code format.

@@ -375,7 +378,7 @@ private void extend_line(List<PointValue> points, float x, float y) {
line.setSquare(true);
line.setPointRadius(1);
line.setReverseYAxis(true);
line.setBackgroundUnclipped(true);
line.setBackgroundUnclipped(true); // acording to google, we are it's only users. It caused problems on zoom.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according
Please can you raise/link an issue if xDrip is somehow affected?

str1= {created_at: "2019-04-27T21:44:22.550Z",
openaps: {enacted : {timestamp: "2019-04-27T21:16:24.885Z", recieved: true}}}

function toMoments (status) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment part still needed?

}
}

// Looking for: lastLoopMoment
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this comment part still needed?

}
}
return new_data;
}
private static boolean HandleTempBassal(JSONObject tr) throws JSONException {
// Code here is trying to do what the nightscout code does for this kind of bassals.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bassals -> basals

Please turn this comment into a Java Docs function description.



// return value tells if new data was found
private boolean downloadTreatments(final NightscoutService nightscoutService, final String hashedSecret, String baseURI, URI uri) throws Exception{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downloadTreatments and downloadDeviceStatus share many identical code lines. Please refactor it to avoid these duplications.

//Log.e("xxxx", "basal ago " + basalAgo);
if(basalAgo < 0) {
// Basal stops if no basal was given.
// Todo upload NS default basal profile.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will you add something here?

}
}

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no reason to have two empty lines here.

return ret;
}

public static void test() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this function to a unit test?

@tolot27
Copy link
Collaborator

tolot27 commented Apr 28, 2021

@tzachi-dar What is the state of this PR? Will you continue to clean it up or replace it by another PR?

@tzachi-dar
Copy link
Contributor Author

tzachi-dar commented Apr 28, 2021 via email

@marciogranzotto
Copy link
Contributor

@tzachi-dar it's been a few months... I can take this PR and do the requested changes if you don't have the time right now.

@tolot27 tolot27 linked an issue Jan 6, 2022 that may be closed by this pull request
@tolot27
Copy link
Collaborator

tolot27 commented Jan 6, 2022

@tzachi-dar @marciogranzotto How can we proceed on this PR?

@rafaeldelrey
Copy link

I would love to see such features on xDrip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Not getting Temp Basals as a Nightscout Follower
5 participants