From efde5bc7633fe754f93005003c289fc9f1b18436 Mon Sep 17 00:00:00 2001 From: Foxy7 <37312469+Foxy7@users.noreply.github.com> Date: Sat, 20 Feb 2021 22:59:51 +0000 Subject: [PATCH] optional note instead of announcement --- README.md | 1 + xdrip-get-entries.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8be48c8..9c1ac9f 100644 --- a/README.md +++ b/README.md @@ -108,6 +108,7 @@ You can edit the following options values in the configuration file (~/myopenaps {"watchdog":true or false}, Optional - Default is true. If set to true then Logger will automatically reboot the rig to resolve bluetooth issues if no glucose is seen from the transmitter in more than 14 minutes. {"utc":true or false}, Optional - Default is true. If set to true then Logger will assume UTC date/time strings coming from the curls to NightScout. {"fakemeter_only_offline":true or false}, Optional - Default is false. If set to false then Logger will not attempt to call fakemeter unless the rig is offline. + {"note_not_announcement":true or false}, Optional - Default is false. If set to true then Logger will post an Announcement as a Note. ## Getting Started First, make sure you've checked the Prerequisites above and completed the Installation steps. Afterwords, perform the following steps: diff --git a/xdrip-get-entries.sh b/xdrip-get-entries.sh index 6244d9c..6658e56 100755 --- a/xdrip-get-entries.sh +++ b/xdrip-get-entries.sh @@ -1267,7 +1267,14 @@ function postAnnouncementToNS() { local announcement=$1 - echo "[{\"enteredBy\":\"Logger\",\"eventType\":\"Announcement\",\"notes\":\"$announcement\"}]" > ${LDIR}/status-change.json + note_not_announcement=$(cat ${CONF_DIR}/xdripjs.json | jq -M -r '.note_not_announcement') + if [ "$note_not_announcement" == true ]; then + eventtype="Note" + else + eventtype="Announcement" + fi + + echo "[{\"enteredBy\":\"Logger\",\"eventType\":\"$eventtype\",\"notes\":\"$announcement\"}]" > ${LDIR}/status-change.json /usr/local/bin/cgm-post-ns ${LDIR}/status-change.json treatments && (echo; log "Upload to NightScout of Announcment worked - $announcement") || (echo; log "Upload of Announcement to NS did not work - $announcement") }