Closed bewest closed 7 years ago
From scratch: install openaps (
sudo pip install -U openaps openaps-contrib
sudo pip install git+git://github.com/oskarpearson/mmeowlink.git
# and oref0
sudo npm install -g git://github.com/openaps/oref0.git'#dev'
openaps init tutorial; cd tutorial
openaps vendor add mmeowlink.vendors.mmeowlink
openaps vendor add openapscontrib.timezones
sudo pip install git+git://github.com/bewest/Adafruit_Python_BluefruitLE.git'#wip/bewest/custom-gatt-profile'
sudo pip install git+git://github.com/bewest/openxshareble.git
openaps vendor add openxshareble
For pebble:
sudo pip install git+git://github.com/mddub/pancreabble.git
openaps vendor add pancreabble
See https://github.com/mddub/pancreabble for more details.
Replace 123456
with your own pump's serial number.
openaps device add pump medtronic 123456
The path, /dev/serial/by-id/usb-Nightscout_subg_rfspy_000002-if00
will change, depending on your own system.
openaps device add pump mmeowlink subg_rfspy /dev/serial/by-id/usb-Nightscout_subg_rfspy_000002-if00 123456
ns shell get
to fetch from NSopenaps use cgm iter_glucose 288
seems to be needed for AMA. or maybe openaps use ns shell get entries.json count=288
?
This creates several devices to manage oref0:
oref0 template mint device oref0 | openaps import
Create medtronic and oref0 reports, this handles timezones, units conversion, as well as detecting freshness of files.
oref0 template mint reports medtronic-pump | openaps import
oref0 template mint reports oref0-inputs | openaps import
Create ns
device. Replace https://my.nightscout.host
with your own Nightscout address, and averylongplainsecret
with your own plain API_SECRET
.
nightscout autoconfigure-device-crud https://my.nightscout.host averylongplainsecret
Make reports:
openaps report add nightscout/recent-treatments.json JSON ns shell format-recent-history-treatments monitor/pump-history.json model.json
openaps report add nightscout/uploaded.json JSON ns shell upload-non-empty-treatments nightscout/recent-treatments.json
TODO: Aliases to weave it all together. To review, there should be several devices:
$ openaps device show
process://oref0/oref0/
process://get-profile/oref0/get-profile
process://calculate-iob/oref0/calculate-iob
process://determine-basal/oref0/determine-basal
process://ns/nightscout/ns https://my.nightscout.host e6fc892e8e88235a476d197de3dfbef3f2db53d0
mmeowlink://pump
With quite a few reports:
$ openaps report show
get-profile://text/shell/oref0-monitor/profile.json
calculate-iob://text/shell/oref0-monitor/iob.json
determine-basal://text/shell/oref0-predict/oref0.json
pump://JSON/read_bg_targets/raw-pump/bg-targets-raw.json
units://JSON/bg_targets/settings/bg-targets.json
pump://JSON/read_insulin_sensitivities/raw-pump/insulin-sensitivities-raw.json
units://JSON/insulin_sensitivities/settings/insulin-sensitivities.json
pump://JSON/read_clock/raw-pump/clock-raw.json
tz://JSON/clock/monitor/clock.json
pump://JSON/read_temp_basal/monitor/temp-basal-status.json
pump://JSON/iter_pump_hours/raw-pump/pump-history-raw.json
tz://JSON/rezone/monitor/pump-history.json
pump://JSON/model/model.json
pump://JSON/reservoir/monitor/reservoir.json
pump://JSON/read_status/monitor/status.json
pump://JSON/read_battery_status/monitor/battery.json
pump://JSON/set_temp_basal/oref0-enacted/enacted-temp-basal.json
oref0://JSON/shell/settings/settings.json
pump://JSON/read_settings/raw-pump/settings.json
oref0://JSON/shell/settings/selected-basal-profile.json
pump://JSON/read_selected_basal_profile/raw-pump/selected-basal-profile.json
pump://JSON/read_temp_basal/raw-pump/temp-basal-status.json
pump://JSON/reservoir/raw-pump/reservoir.json
pump://JSON/read_status/raw-pump/status.json
pump://JSON/read_battery_status/raw-pump/battery.json
ns://JSON/shell/nightscout/recent-treatments.json
ns://JSON/shell/nightscout/uploaded.json
Now we can simply invoke most of them in the right order.
Pro tip: Use openaps report show --cli
to view the corresponding use commands for each of these reports.
Let's make a few directories so the tools don't get stuck the first time:
mkdir monitor nightscout oref0-enacted oref0-monitor oref0-predict raw-cgm raw-pump settings
Here's some aliases @bewest is using successfully, these have been designed to be easy to mend and debug, as well as build upon.
$ openaps alias show
rm-warmup ! bash -c "rm -f model.json monitor/clock.json > /dev/null"
warmup report invoke model.json raw-pump/clock-raw.json monitor/clock.json
fail-warmup ! bash -c "echo PREFLIGHT FAIL; exit 1"
preflight ! bash -c "(openaps rm-warmup; echo PREFLIGHT ) && openaps warmup 2>&1 >/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || openaps fail-warmup"
monitor-cgm report invoke raw-cgm/glucose-raw.json monitor/glucose.json
monitor-pump-history report invoke raw-pump/pump-history-raw.json monitor/pump-history.json
get-basal-status report invoke monitor/temp-basal-status.json
get-pump-details report invoke monitor/reservoir.json monitor/status.json monitor/battery.json
get-settings report invoke raw-pump/bg-targets-raw.json settings/bg-targets.json raw-pump/insulin-sensitivities-raw.json settings/insulin-sensitivities.json raw-pump/selected-basal-profile.json raw-pump/settings.json settings/selected-basal-profile.json settings/settings.json
gather-pump-data ! bash -c "openaps get-basal-status; openaps get-pump-details; openaps monitor-pump-history; openaps get-settings"
gather-clean-data ! bash -c "openaps monitor-cgm && openaps gather-pump-data"
do-oref0 report invoke oref0-monitor/profile.json oref0-monitor/iob.json oref0-predict/oref0.json
enact-oref0 report invoke oref0-enacted/enacted-temp-basal.json
do-everything ! bash -c "(openaps preflight && openaps gather-clean-data && openaps do-oref0 && openaps enact-oref0); openaps report-nightscout"
ping ! echo PING
pong ! echo PONG
hello ! echo hello
okbar ! bash -c "echo $1" --
report-nightscout report invoke nightscout/recent-treatments.json nightscout/uploaded.json
Aliases are now included:
bewest@bewest-MacBookPro:~/Documents/loop-new-style$ oref0 template mint alias -h
/usr/local/bin/oref0-template alias <type>
Commands:
common generate common aliases
Options:
-h, --help Show help [boolean]
bewest@bewest-MacBookPro:~/Documents/loop-new-style$ oref0 template mint alias common | openaps import
rm-warmup ! bash -c "rm -f model.json monitor/clock.json > /dev/null"
warmup report invoke model.json raw-pump/clock-raw.json monitor/clock.json
fail-warmup ! bash -c "echo PREFLIGHT FAIL; exit 1"
preflight ! bash -c "(openaps rm-warmup; echo PREFLIGHT ) && openaps warmup 2>&1 >/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || openaps fail-warmup"
monitor-cgm report invoke monitor/glucose-raw.json monitor/glucose.json
monitor-pump-history report invoke monitor/pump-history-raw.json monitor/pump-history.json
get-basal-status report invoke monitor/temp-basal-status.json
get-pump-details report invoke monitor/reservoir.json monitor/status.json monitor/battery.json
get-settings report invoke settings/bg-targets-raw.json settings/bg-targets.json settings/insulin-sensitivities-raw.json settings/insulin-sensitivities.json settings/selected-basal-profile.json settings/settings.json
gather-pump-data ! bash -c "openaps get-basal-status; openaps get-pump-details; openaps monitor-pump-history; openaps get-settings"
gather-clean-data ! bash -c "openaps monitor-cgm && openaps gather-pump-data"
do-oref0 report invoke oref0-monitor/profile.json oref0-monitor/iob.json oref0-predict/oref0.json
enact-oref0 report invoke oref0-enacted/enacted-temp-basal.json
do-everything ! bash -c "openaps preflight && openaps gather-clean-data && openaps do-oref0 && openaps enact-oref0"
Here are some additional templates for consideration: https://gist.github.com/bewest/d3db9ca1c144b845382c885138a8f66e
Hi Ben, I've tried template mint reports and template mint aliases (you are making everything too easy!). I think there may be a few inconsistencies in the minted aliases wrt minted reports, basically around raw-pump related reports:
monitor-pump-history report invoke monitor/pump-history-raw.json monitor/pump-history.json
should be:
monitor-pump-history report invoke raw-pump/pump-history-raw.json monitor/pump-history.json
get-settings report invoke settings/bg-targets-raw.json settings/bg-targets.json settings/insulin-sensitivities-raw.json settings/insulin-sensitivities.json settings/selected-basal-profile.json settings/settings.json
should be
get-settings report invoke raw-pump/bg-targets-raw.json settings/bg-targets.json raw-pump/insulin-sensitivities-raw.json settings/insulin-sensitivities.json raw-pump/selected-basal-profile.json settings/selected-basal-profile.json raw-pump/settings.json settings/settings.json
@dm61 I added a patch to dev to tweak things, thanks to your feedback.
Hi Ben unless I'm mistaken you need to add in a line to add in "tz" and "units" devices unless I’m mistaken openaps device add tz timezones
and openaps device add units units
Regards
John
Please see:
oref0 template
This can add the needed oref0 devices:
To manage common reports:
Generates all the needed pump handling reports.
Setup needed oref0 reports