Skip to content

Commit

Permalink
update readme for openaps plugin; fix a few codacy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jasoncalabrese committed Dec 7, 2015
1 parent b024c6a commit 7e55b25
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
7 changes: 6 additions & 1 deletion README.md
Expand Up @@ -284,7 +284,12 @@ To learn more about the Nightscout API, visit https://YOUR-SITE.com/api-docs.htm
* `MMCONNECT_SGV_LIMIT` (`24`) - Maximum number of recent sensor glucose values to send to Nightscout on each request.
* `MMCONNECT_VERBOSE` - Set this to "true" to log CareLink request information to the console.
* `MMCONNECT_STORE_RAW_DATA` - Set this to "true" to store raw data returned from CareLink as `type: "carelink_raw"` database entries (useful for development).
* `openaps` (OpenAPS) - Integrated OpenAPS loop monitoring, requires `DEVICESTATUS_ADVANCED="true"` to be set
* `openaps` (OpenAPS) - Integrated OpenAPS loop monitoring, uses these extended settings:
* Requires `DEVICESTATUS_ADVANCED="true"` to be set
* `OPENAPS_ENABLE_ALERTS` (`false`) - Set to `true` to enable notifications when OpenAPS isn't looping. If OpenAPS is going to offline for a period of time, you can add an `OpenAPS Offline` event for the expected duration from Careportal to avoid getting alerts.
* `OPENAPS_WARN` (`30`) - The number of minutes since the last loop that needs to be exceed before an alert is triggered
* `OPENAPS_URGENT` (`60`) - The number of minutes since the last loop that needs to be exceed before an urgent alarm is triggered


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

Expand Down
4 changes: 2 additions & 2 deletions lib/client/ticks.js
Expand Up @@ -4,7 +4,7 @@ function prepare (client, opts) {
opts = checkOptions(client, opts);

if (opts.scaleY === 'linear') {
return prepareLinear(client, opts);
return prepareLinear(client);
} else {
return prepareLog(client, opts);
}
Expand Down Expand Up @@ -47,7 +47,7 @@ function prepareLog (client, opts) {
}
}

function prepareLinear (client, opts) {
function prepareLinear (client) {
if (client.settings.units === 'mmol') {
return [
2.0
Expand Down
1 change: 0 additions & 1 deletion lib/plugins/cannulaage.js
Expand Up @@ -2,7 +2,6 @@

var _ = require('lodash');
var moment = require('moment');
var times = require('../times');

var cage = {
name: 'cage'
Expand Down
28 changes: 12 additions & 16 deletions lib/plugins/openaps.js
Expand Up @@ -54,7 +54,7 @@ function init() {
var offlineMarker = _.findLast(sbx.data.treatments, function match (treatment) {
var eventTime = sbx.entryMills(treatment);
var eventEnd = treatment.duration ? eventTime + times.mins(treatment.duration).msecs : eventTime;
return eventTime <= sbx.time && treatment.eventType === 'OpenAPS Offline' && eventEnd >= sbx.time
return eventTime <= sbx.time && treatment.eventType === 'OpenAPS Offline' && eventEnd >= sbx.time;
});

if (offlineMarker) {
Expand Down Expand Up @@ -128,23 +128,19 @@ function init() {
});
}

if (ops.iob) {
if (ops.iobTime.isAfter(ops.recent)) {
info.push({
label: 'IOB'
, value: [
sbx.roundInsulinForDisplayFormat(ops.iob.iob) + 'U'
, ', Bolus Snooze ' + sbx.roundInsulinForDisplayFormat(ops.iob.bolusiob) + 'U'
, timeAt(true, sbx) + timeFormat(ops.iobTime, sbx)
].join('')
});
}
if (ops.iob && ops.iobTime.isAfter(ops.recent)) {
info.push({
label: 'IOB'
, value: [
sbx.roundInsulinForDisplayFormat(ops.iob.iob) + 'U'
, ', Bolus Snooze ' + sbx.roundInsulinForDisplayFormat(ops.iob.bolusiob) + 'U'
, timeAt(true, sbx) + timeFormat(ops.iobTime, sbx)
].join('')
});
}

if (ops.pumpTime) {
if (ops.pumpTime.isAfter(ops.recent)) {
info.push({label: 'Last Pump Clock', value: ops.pumpTime.format('LT')});
}
if (ops.pumpTime && ops.pumpTime.isAfter(ops.recent)) {
info.push({label: 'Last Pump Clock', value: ops.pumpTime.format('LT')});
}

sbx.pluginBase.updatePillText(openaps, {
Expand Down
2 changes: 0 additions & 2 deletions tests/cannulaage.test.js
Expand Up @@ -46,8 +46,6 @@ describe('cage', function ( ) {

it('set a pill to the current cannula age', function (done) {

var clientSettings = {};

var data = {
sitechangeTreatments: [
{eventType: 'Site Change', notes: 'Foo', mills: Date.now() - 48 * 60 * 60000}
Expand Down

0 comments on commit 7e55b25

Please sign in to comment.