Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
separate concerns a bit
The formatting things are unique, different concern from doing network I/O or
uploading.
  • Loading branch information
bewest committed Sep 27, 2015
commit dbf845852b74512ab3d70abc21f8c170f91975eb
5 changes: 2 additions & 3 deletions bin/ns-upload-glucose.sh → bin/mm-format-ns-glucose.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# Author: Ben West, Maintainer: Scott Leibrand
# Author: Ben West @bewest
# Maintainer: Chris Oattes @cjo20

# Written for decocare v0.0.17. Will need updating the the decocare json format changes.
HISTORY=${1-glucosehistory.json}
Expand All @@ -15,5 +16,3 @@ cat $HISTORY | \
json -e "this.device = 'openaps://medtronic/pump/cgm'" \
> $OUTPUT

# requires API_SECRET and NIGHTSCOUT_HOST to be set in calling environment (i.e. in crontab)
curl -s -X POST --data-binary @$OUTPUT -H "API-SECRET: $API_SECRET" -H "content-type: application/json" $NIGHTSCOUT_HOST/api/v1/entries.json >/dev/null && ( touch /tmp/openaps.online && echo "Uploaded $OUTPUT to $NIGHTSCOUT_HOST" ) || echo "Unable to upload to $NIGHTSCOUT_HOST"
5 changes: 2 additions & 3 deletions bin/ns-upload.sh → bin/mm-format-ns-pump-history.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

# Author: Ben West, Maintainer: Scott Leibrand
# Author: Ben West
# Maintainer: Scott Leibrand

HISTORY=${1-pumphistory.json}
OUTPUT=${2-pumphistory.ns.json}
Expand All @@ -15,5 +16,3 @@ cat $HISTORY | \
> $OUTPUT


# requires API_SECRET and NIGHTSCOUT_HOST to be set in calling environment (i.e. in crontab)
curl -s -X POST --data-binary @$OUTPUT -H "API-SECRET: $API_SECRET" -H "content-type: application/json" $NIGHTSCOUT_HOST/api/v1/entries.json >/dev/null && ( touch /tmp/openaps.online && echo "Uploaded $OUTPUT to $NIGHTSCOUT_HOST" ) || echo "Unable to upload to $NIGHTSCOUT_HOST"
17 changes: 17 additions & 0 deletions bin/ns-upload-entries.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

# Author: Ben West

ENTRIES=${1-entries.json}
NIGHTSCOUT_HOST=${NIGHTSCOUT_HOST-localhost:1337}
#TZ=${3-$(date +%z)}
OUTPUT=${2}

export ENTRIES API_SECRET NIGHTSCOUT_HOST
# requires API_SECRET and NIGHTSCOUT_HOST to be set in calling environment (i.e. in crontab)
(
curl -s -X POST --data-binary @$ENTRIES \
-H "API-SECRET: $API_SECRET" \
-H "content-type: application/json" \
$NIGHTSCOUT_HOST/api/v1/entries.json
) && ( test -n "$OUTPUT" && touch $OUTPUT ; logger "Uploaded $ENTRIES to $NIGHTSCOUT_HOST" ) || logger "Unable to upload to $NIGHTSCOUT_HOST"
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
"determine-basal" : "./bin/determine-basal.js",
"send-tempbasal-Azure" : "./bin/send-tempbasal-Azure.js",
"get-profile" : "./bin/get-profile.js",
"bin/reset-wifi-dongle": "bin/reset-wifi-dongle.sh",
"reset-wifi-dongle": "bin/reset-wifi-dongle.sh",
"mm-format-ns-glucose": "./bin/mm-format-ns-glucose.sh",
"mm-format-ns-pump-history": "./bin/mm-format-ns-pump-history.sh",
"ns-upload-entries": "./bin/ns-upload-entries.sh",
"diyps-pebble" : "./bin/diyps-pebble.js"
},
"homepage": "https://github.com/openaps/openaps-js"
Expand Down