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

feat: Add support for different color OpenAPS/oref0 prediction lines #4792

Merged
merged 5 commits into from
Jul 24, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,12 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
* `OPENAPS_URGENT` (`60`) - The number of minutes since the last loop that needs to be exceed before an urgent alarm is triggered
* `OPENAPS_FIELDS` (`status-symbol status-label iob meal-assist rssi`) - The fields to display by default. Any of the following fields: `status-symbol`, `status-label`, `iob`, `meal-assist`, `freq`, and `rssi`
* `OPENAPS_RETRO_FIELDS` (`status-symbol status-label iob meal-assist rssi`) - The fields to display in retro mode. Any of the above fields.
* `OPENAPS_PRED_IOB_COLOR` (`#1e88e5`) - The color to use for IOB prediction lines. Colors can be in either `#RRGGBB` or `#RRGGBBAA` format.
* `OPENAPS_PRED_COB_COLOR` (`#FB8C00FF`) - The color to use for COB prediction lines. Same format as above.
* `OPENAPS_PRED_ACOB_COLOR` (`#FB8C0080`) - The color to use for ACOB prediction lines. Same format as above.
* `OPENAPS_PRED_ZT_COLOR` (`#00d2d2`) - The color to use for ZT prediction lines. Same format as above.
* `OPENAPS_PRED_UAM_COLOR` (`#c9bd60`) - The color to use for UAM prediction lines. Same format as above.


Also see [Pushover](#pushover) and [IFTTT Maker](#ifttt-maker).

Expand Down
16 changes: 15 additions & 1 deletion lib/plugins/openaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ function init (ctx) {
, warn: sbx.extendedSettings.warn ? sbx.extendedSettings.warn : 30
, urgent: sbx.extendedSettings.urgent ? sbx.extendedSettings.urgent : 60
, enableAlerts: sbx.extendedSettings.enableAlerts
, predIOBColor: sbx.extendedSettings.predIobColor ? sbx.extendedSettings.predIobColor : '#1e88e5'
, predCOBColor: sbx.extendedSettings.predCobColor ? sbx.extendedSettings.predCobColor : '#FB8C00FF'
, predACOBColor: sbx.extendedSettings.predAcobColor ? sbx.extendedSettings.predAcobColor : '#FB8C0080'
, predZTColor: sbx.extendedSettings.predZtColor ? sbx.extendedSettings.predZtColor : '#00d2d2'
, predUAMColor: sbx.extendedSettings.predUamColor ? sbx.extendedSettings.predUamColor : '#c9bd60'
};

if (firstPrefs) {
Expand Down Expand Up @@ -365,9 +370,18 @@ function init (ctx) {

function toPoints (offset, forecastType) {
return function toPoint (value, index) {
var colors = {
'Values': '#ff00ff'
, 'IOB': prefs.predIOBColor
, 'Zero-Temp': prefs.predZTColor
, 'COB': prefs.predCOBColor
, 'Accel-COB': prefs.predACOBColor
, 'UAM': prefs.predUAMColor
}

return {
mgdl: value
, color: '#ff00ff'
, color: colors[forecastType]
, mills: prop.lastPredBGs.moment.valueOf() + times.mins(5 * index).msecs + offset
, noFade: true
, forecastType: forecastType
Expand Down