These are chat archives for nightscout/intend-to-bolus

15th
Nov 2015
eyim
@eyim
Nov 15 2015 00:19
In case anyone is following along on my upload treatment saga, it turns out it looks like you can upload treatments to the current version of nightscout with the commands provided by Scott and Ben. What is strange is that it wasn't working for my azure implementation but on a whim I just tried it on my Heroku implementation and it worked (same version 0.8.2 on both). Strange ... I'll let you know more as I figure it out. And I was able to deploy the current dev version of Nightscout to heroku but I couldn't get it to work. Probably user error on my part.
Ben West
@bewest
Nov 15 2015 01:04
curious if my upload size fix made it in
hmmm
Tim Howard
@tghoward
Nov 15 2015 01:16
I can't get ns-dedupe-treatments to work. No matter whether I pass it envars or host and secret directly, it seems to always return {"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
I pass either this: ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net $API_SECRET
Ben West
@bewest
Nov 15 2015 01:17
that one should work
API_SECRET should be the hashed secret
Tim Howard
@tghoward
Nov 15 2015 01:17
or with the api-secret pasted it
Ben West
@bewest
Nov 15 2015 01:17
so
Tim Howard
@tghoward
Nov 15 2015 01:17
Yes, I even paste in the hashed secret and it doesn't work
Ben West
@bewest
Nov 15 2015 01:18
. <(crontab -l | grep API_SECRET)
should set it same in your shell as you have it in your crontab
Tim Howard
@tghoward
Nov 15 2015 01:18
I've got my api-secret in .bashrc
Ben West
@bewest
Nov 15 2015 01:19
does echo $API_SECRET match what's in crontab -l | grep API_SECRET?
oh, did you change your api secret at some point?
Tim Howard
@tghoward
Nov 15 2015 01:20
no, crontab doesn't seem to know it. Which answers some other problems I've been having.
I'm passing the hashed code for glucose uploads right now. It is working.
So I should be able to pass the hashed code with ns-dedupe, directly, right? Or not.
That makes sense that crontab is outside of my environment, but is the call to ns-dedupe-treatments? i.e.,it should be able to see the vars loaded by .bashrc?
Tim Howard
@tghoward
Nov 15 2015 01:39
Added the api_secret to crontab. (didn't help, of course). I did change it recently, but I have the correct one.
Ben West
@bewest
Nov 15 2015 01:39
right, should be same as what you're using to upload glucose
errr
what do you mean?
using openaps?
or android?
well, you said hashed version, so
Tim Howard
@tghoward
Nov 15 2015 01:42
this works: ns-upload https://bcbsarah.azurewebsites.net $API_SECRET treatments.json upload/latest-treatments.json
this doesn't: ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net $API_SECRET
Ben West
@bewest
Nov 15 2015 01:44
that's odd
works for me
Tim Howard
@tghoward
Nov 15 2015 01:44
this works: ns-upload https://bcbsarah.azurewebsites.net $API_SECRET entries.json monitor/cleanglucose.json
Ben West
@bewest
Nov 15 2015 01:45
bewest@hither:~/Documents/foo$ ns-dedupe-treatments delete bewest.labs.diabetes.watch $API_SECRET
10 + curl -X DELETE -H 'API-SECRET:  [redacted-hashed-secret]' bewest.labs.diabetes.watch/api/v1/treatments/5647e2b94b796f120064059f
{}
Tim Howard
@tghoward
Nov 15 2015 01:45
Nice. Never seen output like that. :smile:
I've seen a few cases like this. Things work for you and Scott and they don't work for me. :worried:
Ben West
@bewest
Nov 15 2015 01:47
well
this is your old secret
$ ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net $API_SECRET 
2 + curl -X DELETE -H 'API-SECRET: e7b644ad0732c4ed781eeede289aabe3b424da02' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
bewest@hither:~/src/rileylink/firmware/cc1110$ ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net $API_SECRET 
2 + curl -X DELETE -H 'API-SECRET: e7b644ad0732c4ed781eeede289aabe3b424da02' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
2 + curl -X DELETE -H 'API-SECRET: e7b644ad0732c4ed781eeede289aabe3b424da02' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d80
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
2 + curl -X DELETE -H 'API-SECRET: e7b644ad0732c4ed781eeede289aabe3b424da02' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d86
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
2 + curl -X DELETE -H 'API-SECRET: e7b644ad0732c4ed781eeede289aabe3b424da02' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d8a
^C
bewest@hither:~/src/rileylink/firmware/cc1110$
Tim Howard
@tghoward
Nov 15 2015 01:48
yep, that's not the one I'm using any more.
BUT!! your curl statements have the secret pasted in! Mine don't. Why not?
Ben West
@bewest
Nov 15 2015 01:49
right
echo $API_SECRET
does that output your hashed secret?
Tim Howard
@tghoward
Nov 15 2015 01:49
yes.
Ben West
@bewest
Nov 15 2015 01:49
oh
hmm
export API_SECRET
hmm
shouldn't matter
Tim Howard
@tghoward
Nov 15 2015 01:50
Again. i can even paste the actual hashed secret in the call to ns-dedupe and it still doesn't put it in the curl statement
So am I using a wrong release?
Ben West
@bewest
Nov 15 2015 01:50
makes me wonder what versoin you have somehow
Tim Howard
@tghoward
Nov 15 2015 01:51
exactly
can i quickly test that?
Ben West
@bewest
Nov 15 2015 01:51
sudo npm install -g oref0
Tim Howard
@tghoward
Nov 15 2015 01:52
done. Testing.
nope. :worried:
pi@betacb ~/bcb-s $ sudo npm install -g oref0
/usr/bin/oref0-calculate-iob -> /usr/lib/node_modules/oref0/bin/oref0-calculate-iob.js
/usr/bin/oref0-find-insulin-uses -> /usr/lib/node_modules/oref0/bin/oref0-find-insulin-uses.js
/usr/bin/oref0-determine-basal -> /usr/lib/node_modules/oref0/bin/oref0-determine-basal.js
/usr/bin/oref0-normalize-temps -> /usr/lib/node_modules/oref0/bin/oref0-normalize-temps.js
/usr/bin/send-tempbasal-Azure -> /usr/lib/node_modules/oref0/bin/send-tempbasal-Azure.js
/usr/bin/oref0-get-profile -> /usr/lib/node_modules/oref0/bin/oref0-get-profile.js
/usr/bin/oref0-mint-max-iob -> /usr/lib/node_modules/oref0/bin/oref0-mint-max-iob.sh
/usr/bin/oref0-ifttt-notify -> /usr/lib/node_modules/oref0/bin/oref0-ifttt-notify
/usr/bin/oref0-reset-usb -> /usr/lib/node_modules/oref0/bin/oref0-reset-usb.sh
/usr/bin/oref0-reset-git -> /usr/lib/node_modules/oref0/bin/oref0-reset-git.sh
/usr/bin/mm-format-ns-glucose -> /usr/lib/node_modules/oref0/bin/mm-format-ns-glucose.sh
/usr/bin/mm-format-ns-profile -> /usr/lib/node_modules/oref0/bin/mm-format-ns-profile.sh
/usr/bin/mm-format-ns-treatments -> /usr/lib/node_modules/oref0/bin/mm-format-ns-treatments.sh
/usr/bin/mm-format-ns-pump-history -> /usr/lib/node_modules/oref0/bin/mm-format-ns-pump-history.sh
/usr/bin/oref0 -> /usr/lib/node_modules/oref0/bin/oref0.sh
/usr/bin/mm-stick -> /usr/lib/node_modules/oref0/bin/mm-stick.sh
/usr/bin/ns-upload-entries -> /usr/lib/node_modules/oref0/bin/ns-upload-entries.sh
/usr/bin/ns-upload -> /usr/lib/node_modules/oref0/bin/ns-upload.sh
/usr/bin/ns-get -> /usr/lib/node_modules/oref0/bin/ns-get.sh
/usr/bin/nightscout -> /usr/lib/node_modules/oref0/bin/nightscout.sh
/usr/bin/ns-dedupe-treatments -> /usr/lib/node_modules/oref0/bin/ns-dedupe-treatments.sh
/usr/bin/oref0-pebble -> /usr/lib/node_modules/oref0/bin/oref0-pebble.js
oref0@0.1.0 /usr/lib/node_modules/oref0
├── share2nightscout-bridge@0.1.5 (request@2.53.0)
└── timezone@0.0.47
pi@betacb ~/bcb-s $ ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net $API_SECRET
2 + curl -X DELETE -H 'API-SECRET: ' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
2 + curl -X DELETE -H 'API-SECRET: ' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d80
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
^Cpi@betacb ~/bcb-s $
Ben West
@bewest
Nov 15 2015 01:59
ah
ok
do export API_SECRET
apparently
it's only in envrionment
the script doesn't use params at all
Tim Howard
@tghoward
Nov 15 2015 01:59
not following you
Ben West
@bewest
Nov 15 2015 02:00
bewest@hither:~/src/rfcat/firmware$ API_SECRET=ONE ns-dedupe-treatments --find https://bcbsarah.azurewebsites.net FOOBAR
2 curl -X DELETE -H API-SECRET: ONE https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
2 curl -X DELETE -H API-SECRET: ONE https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d80
2 curl -X DELETE -H API-SECRET: ONE https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d86
2 curl -X DELETE -H API-SECRET: ONE https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d8a
2 curl -X DELETE -H API-SECRET: ONE https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d9c
^C
bewest@hither:~/src/rfcat/firmware$
Tim Howard
@tghoward
Nov 15 2015 02:01
how did you define foobar?
Ben West
@bewest
Nov 15 2015 02:01
should be FOOBAR if the arguments mattered :$
it's just string
but the variable is set to ONE
the arguments don't matter
bewest@hither:~/src/rfcat/firmware$ API_SECRET=TWO ns-dedupe-treatments --find https://bcbsarah.azurewebsites.net 
2 curl -X DELETE -H API-SECRET: TWO https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
2 curl -X DELETE -H API-SECRET: TWO https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d80
^C
bewest@hither:~/src/rfcat/firmware$
Tim Howard
@tghoward
Nov 15 2015 02:04
stink. Battery just died on the RPi. Hopefully not corrupt. Standing by for power.
Ali Mazaheri
@amazaheri
Nov 15 2015 02:06
Ben getting the same error here as well
{"status":401,"message":"Unauthorized","description":"api-secret Request Header is incorrect or missing."}
Tim Howard
@tghoward
Nov 15 2015 02:12
@amazaheri we must be missing the magic touch. :smile:
Ali Mazaheri
@amazaheri
Nov 15 2015 02:12
:) These are not the Secret_Apis you are looking for my padawan
Tim Howard
@tghoward
Nov 15 2015 02:15
:smile: "yes, master"
Defining it up front as ben just showed works.
pi@betacb ~/bcb-s $ API_SECRET=[blahblahblah] ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net
2 + curl -X DELETE -H 'API-SECRET: [blahblahblah]' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647dbb01e9755680d632d78
{}
Ali Mazaheri
@amazaheri
Nov 15 2015 02:29
kewl
the other issue I have is the time is off even though I am passing -zoned.json
Capture.PNG
This message was deleted
Tim Howard
@tghoward
Nov 15 2015 02:31
This works. Whacky!
pi@betacb ~/bcb-s $ API_SECRET=$API_SECRET ns-dedupe-treatments delete https://bcbsarah.azurewebsites.net
2 + curl -X DELETE -H 'API-SECRET: [redacted-hashed-secret]' https://bcbsarah.azurewebsites.net/api/v1/treatments/5647ed711e9755680d632dac
{}
@amazaheri I had that problem too, but it seems to have fixed itself for the time being. I think the popups were showing UTC, but placed on local time?
Tim Howard
@tghoward
Nov 15 2015 03:01
Another issue I have is that I never get an arrow next to the BG number in nightscout. It appears just as a short dash. I'm guessing this is because we are using MM CGM and the formatting is funny. Here's a formatted record:
{
    "name": "GlucoseSensorData", 
    "date_type": "prevTimestamp", 
    "_tell": 9, 
    "dateString": "2015-11-14T21:52:00-0500", 
    "packet_size": 0, 
    "date": 1447555920000, 
    "op": 70, 
    "device": "openaps://medtronic/pump/cgm", 
    "sgv": 140, 
    "type": "sgv", 
    "glucose": 140
  },
What do I need to go sleuthing for to get trend data into the record?
BG_no_arrow.png
Ali Mazaheri
@amazaheri
Nov 15 2015 03:11
oh u use Med CGM, dont have that issue with Dex,
@jasoncalabrese or @bewest should be able to help
Tim Howard
@tghoward
Nov 15 2015 03:16
I'm not even seeing trend data in the unformatted records. There's a "tick" or some such in Dex, if I recall correctly (one person here with dex, one person with Minimed). Maybe I'm just out of luck.
Tim Howard
@tghoward
Nov 15 2015 03:24
I'm done for the night. Thanks @amazaheri and @bewest for the help.
eyim
@eyim
Nov 15 2015 03:28

@amazaheri I am having the same issue. It uploads the treatments correctly but it is showing it at the wrong time. It is showing it 7 hours earlier in the day than it should. I am on pacific. I am wondering if I didn't set up the timezones correctly. Here is what I have for my timezone stuff in my openaps.ini
[device "tz"]
vendor = openapscontrib.timezones

[report "monitor/pump-history-zoned.json"]
use = rezone
reporter = JSON
date = timestamp dateString start_at end_at created_at
adjust = missing
input = monitor/pump-history.json
device = tz
timezone = None
astimezone = True

[vendor "openapscontrib.timezones"]
path = .
module = openapscontrib.timezones

Looking at this maybe I need to set timezone = None to something else like pacific?
Ali Mazaheri
@amazaheri
Nov 15 2015 04:13
that sound about right this setting is correct for calc iob
Jason Calabrese
@jasoncalabrese
Nov 15 2015 04:14
need to set the timezone on the pi to your local time
sudo raspi-config
Ali Mazaheri
@amazaheri
Nov 15 2015 04:16
mine is set to PST
otherwise
iob
calc be messed up 😊
Jason Calabrese
@jasoncalabrese
Nov 15 2015 04:45
iob calc isn't looking right to me
how far out is using dcalc in oref0
Ali Mazaheri
@amazaheri
Nov 15 2015 04:49
i think Scott was looking at it
Scott Leibrand
@scottleibrand
Nov 15 2015 05:16
I'm not actively working on anything along those lines right now...
Not sure what the next steps are.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 05:19
I was wondering if it's more like a display issue
right now openaps is saying: IOB: 0.12, Bolus IOB: 0.00, but NS with the same treatments is saying IOB 1.01U
so it's more than a little off

when you see messages like:

Nov 14 21:17:03 raspberrypi Stick transmit[TransmitPacket:ReadHistoryData:size[1024]:[page][1]:data[0]:] reader[ReadRadio:size:78] download_i[10] status[<LinkStatus:0x03:status:size=??LinkStatus:error:True:reason:[]:size(0)>] poll_size[0] poll_i[False] command[<LinkStatus:0x03:status:size=??LinkStatus:error:True:reason:[]:size(0)>]:download(attempts[10],expect[0],results[896]:data[0]):BAD AILING

and then it recovers is that the stick losing packets? the attempts are the number of retries?

Jason Calabrese
@jasoncalabrese
Nov 15 2015 05:48
@scottleibrand could the IOB difference be related to the double speed decay that was added to be able to temp for carbs
Scott Leibrand
@scottleibrand
Nov 15 2015 06:27
That is bolus IOB. Shouldn't affect regular IOB. But I really don't know what the discrepancy is. Maybe something about sorting?
Jason Calabrese
@jasoncalabrese
Nov 15 2015 06:42
I'm going to try adding a little test
should be able to port what I have in NS
don't think I fully understand the bolus iob
it's the last bolus at double speed
ignores all other boluses?
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:03
ok, verified that bolus iob does include multiple treatments
has anyone started using profiles from NS instead of the pump? would be nice to set eating soon mode, big dinner mode, etc
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:25
found a bug in my openaps.ini, wasn't using the zoned monitor/pump-history-zoned.json
that could explain some wierdness
Scott Leibrand
@scottleibrand
Nov 15 2015 07:30
Ah, yep. That would account for most of it.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:30
now bolus iob is about half what's shown in NS, and overall is higher, not sure how to match it up with the temps
Scott Leibrand
@scottleibrand
Nov 15 2015 07:31
I sometimes eyeball the bolus display in NS.
At least can tell if basal IOB is + or -
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:35
think basals might not be right on the 522
the interface it edit them on these pump is so bad
impossible to maintain
Scott Leibrand
@scottleibrand
Nov 15 2015 07:37
Ya
can't remember if it's possible to set them with decocare.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:46
or just ignore what's set
Ben West
@bewest
Nov 15 2015 07:46
not yet, the payload is bigger than 64 bytes and wasn't sure how to do it
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:47
at the very least just a notice when they are way off would help
too many devices
Scott Leibrand
@scottleibrand
Nov 15 2015 07:48
Yeah, that we probably need to make a helper script (maybe in NS?), to analyze openaps temps and see if they are consistently high or low, indicating basals need adjusted.
Ben West
@bewest
Nov 15 2015 07:48
yeah, a basal tuner
Scott Leibrand
@scottleibrand
Nov 15 2015 07:48
i wrote an algorithm for doing so, just never got around to coding it.
Ben West
@bewest
Nov 15 2015 07:48
would be nice to flag times that are easy to analyze foe basals too
Jason Calabrese
@jasoncalabrese
Nov 15 2015 07:58
iobs looking much closer now
was thinking it would be nice to do long point with the NS api
add a wait=msecs param
then if you're pulling bg's from the NS api as soon as a new value is available you have it it
eyim
@eyim
Nov 15 2015 08:12
Hmm - my iob calc appears to be off as well. I thought it was only affecting the uploaded treatments to NS but based on what Jason and Ali have said it is also affecting my iob calc. I have doubled checked that the pi is set to 'US/Pacific-New'
and the date function shows the correct time. I also looked and checked that iob is getting the pump history zoned correctly. I also looked at the pump-history.json file and the boluses are in there. Should have about 9 or 10 units on board but it says there is 0.
The strange thing is that last night the pi wasn't set on the pacific time zone and it calculated the iob correctly
Jason Calabrese
@jasoncalabrese
Nov 15 2015 08:18
are you using monitor/pump-history-zoned.json in your iob report, that was one of the things I had wrong
still not matching NS, but some of that is expected
eyim
@eyim
Nov 15 2015 08:18
Yes - after I saw your post I doubled checked. I had it right
Jason Calabrese
@jasoncalabrese
Nov 15 2015 08:22
the times are right in your zoned history file
eyim
@eyim
Nov 15 2015 08:40
hmmm I definitely messed something up when I switched time zones. Now it is pulling the glucose data from 8 hour ago which makes me think it thinks it is UTF time. I even switched the time zone back to GMT and that didn't help.
eyim
@eyim
Nov 15 2015 08:52
Hmm - looks like my pump-history-zoned report isn't working the way it is suppose to. It isn't appending to the end of each time the -08:00 that it needs to. so pump-history and pump-history-zoned are the same.
eyim
@eyim
Nov 15 2015 09:07
ignore my comment about pulling the wrong glucose data - that is incorrect
Jason Calabrese
@jasoncalabrese
Nov 15 2015 09:14
Just saw something strange with mine, iob started going up, when it should have been very close to 0, went back to using the non-zoned history for iob calculation
Ben West
@bewest
Nov 15 2015 09:25
files where date field is the main field need --date date
eyim
@eyim
Nov 15 2015 09:27
I assume to get the timezone functionality that it comes along when you install the plugins with:
sudo easy_install -ZU openaps-contrib
Is there something else I need to install for timezones?
Tim Howard
@tghoward
Nov 15 2015 15:44
@jasoncalabrese any chance you can quickly explain what nightscout needs to show the trending arrow?
Ali Mazaheri
@amazaheri
Nov 15 2015 15:54
so if I am not mistaking Dexcom has the trend like Flat, FortyFiveUp, FortyFiveDown and thats how CRM does the arrows.
Tim Howard
@tghoward
Nov 15 2015 16:01
so, each record has something like "trend":"FortyFiveUp"
Jason Calabrese
@jasoncalabrese
Nov 15 2015 16:12
it's "direction":"Flat", the different directions are:
  var dir2Char = {
    NONE: '⇼'
    , DoubleUp: '⇈'
    , SingleUp: '↑'
    , FortyFiveUp: '↗'
    , Flat: '→'
    , FortyFiveDown: '↘'
    , SingleDown: '↓'
    , DoubleDown: '⇊'
    , 'NOT COMPUTABLE': '-'
    , 'RATE OUT OF RANGE': '⇕'
  };
Tim Howard
@tghoward
Nov 15 2015 16:13
excellent. Thank you.
and NS never attempts to calculate this itself, right?
Jason Calabrese
@jasoncalabrese
Nov 15 2015 16:34
Yeah, NS doesn't calculate it now, I setup the direction plugin so it could be overridden
Would be nice to do it on our own as an option since the Dexcom trend arrows aren't great
Matt Pressnall
@logichammer
Nov 15 2015 20:10

So I have my rpi setup and am doing my initial install of openaps using this script from the documentation:

curl -s https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-packages.sh | bash -

And it get's pretty far into the installation and then dies here:

Installing openaps script to /usr/local/bin
Installing openaps-get script to /usr/local/bin
Installing openaps-use script to /usr/local/bin
Installing openaps-install-udev-rules script to /usr/local/bin

Installed /usr/local/lib/python2.7/dist-packages/openaps-0.0.7-py2.7.egg
Processing dependencies for openaps
Finished processing dependencies for openaps
installed /etc/udev/rules.d/80-medtronic-carelink.rules
installed /etc/udev/rules.d/80-dexcom.rules
Installing bash completion script /etc/bash_completion.d/python-argcomplete.sh
npm http GET https://registry.npmjs.org/json
npm http GET https://registry.npmjs.org/oref0

npm ERR! Error: failed to fetch from registry: json
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request.<anonymous> (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.g (events.js:156:14)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1256:7)
npm ERR! You may report this log at:
npm ERR!     <http://bugs.debian.org/npm>
npm ERR! or use
npm ERR!     reportbug --attach /home/pi/openaps/npm-debug.log npm
npm ERR! 
npm ERR! System Linux 3.18.11-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "json" "oref0"
npm ERR! cwd /home/pi/openaps
npm ERR! node -v v0.6.19
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: json
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/openaps/npm-debug.log
npm not ok
openaps 0.0.7

Looking in the debug log, I see the same error / line numbers: ERR! Error: failed to fetch from registry: json

Ideas and many thanks! BTW, incredible documentation / install scripts! Very easy to get going so far...

John Males
@johnmales
Nov 15 2015 20:10
@logichammer which version of raspbian are you using?
Scott Leibrand
@scottleibrand
Nov 15 2015 20:13
If you're using wheezy, I strongly recommend starting over with Jessie.
Matt Pressnall
@logichammer
Nov 15 2015 20:13
Wheezy...7.8
John Males
@johnmales
Nov 15 2015 20:13

Unless I am mistaken the line

npm ERR! System Linux 3.18.11-v7+

means you are running wheezy instead of jessie

Matt Pressnall
@logichammer
Nov 15 2015 20:14
Yes...I did a:
sudo apt-get update && sudo apt-get -y upgrade
At the end that must have upgrade me?
John Males
@johnmales
Nov 15 2015 20:14
you can't upgrade easily from wheezy to jessie - best to start over I'm afraid
Matt Pressnall
@logichammer
Nov 15 2015 20:16
No worries, easily done. Thanks for the help gents! @scottleibrand, if doing that upgrade at the end pushed me into Wheezy, may want to comment that out of documentation. Otherwise, I was shipped wheezy?
Scott Leibrand
@scottleibrand
Nov 15 2015 20:16
You were undoubtedly shipped wheezy
Matt Pressnall
@logichammer
Nov 15 2015 20:17
Gotcha and thanks!
Scott Leibrand
@scottleibrand
Nov 15 2015 20:17
i tried to upgrade from wheezy to Jessie. Requires manually editing apt sources, and takes longer than just starting over.
Matt Pressnall
@logichammer
Nov 15 2015 20:17
No, I am going for the easy method! :)
Scott Leibrand
@scottleibrand
Nov 15 2015 20:17
And is really needy about "well, should I upgrade this?" ;-)
we probably need to update the docs to have people check for Jessie and switch to re-imaging their Pi if they don't.
PRs welcome. :-)
Matt Pressnall
@logichammer
Nov 15 2015 20:21
Happy to have you guys point me in the right direction for this! Otherwise, I'd be banging my head against the wall for awhile. Thanks for the link, @johnmales ! PRs? I'm assuming documentation? I can totally do that. I see "Personal Record" with PR.
John Males
@johnmales
Nov 15 2015 20:23
Pull request - github term for suggesting changes to a repository
Matt Pressnall
@logichammer
Nov 15 2015 20:25
Gotcha and I'm assuming then that this is the documentation that I could then edit:
https://github.com/openaps/docs
I'm on it.
Ben West
@bewest
Nov 15 2015 20:26
you can fork it and target changes for the dev branch
Matt Pressnall
@logichammer
Nov 15 2015 20:27
Will do!
Ben West
@bewest
Nov 15 2015 20:36
the book has had trouble building, should I set it up to build itself using a different method?
was originally quite impressed by gitbooks, but apparently it's a one-person shop, looks like they are having trouble keeping up with demand
readthedocs is pretty good, or we can use travis/wercker to build it and publish changes to location of our choosing
I have a similar build here: http://nightscout.github.io/tr-templates/
Matt Pressnall
@logichammer
Nov 15 2015 22:14

For documentation purposes, is there anyway to tell looking at the RPI hardware to tell which version you are on (Jessie vs Wheezy) or do you need to get everything set up and then run:

lsb_release -a

to find out: hey, I need to format and start over?

I'm looking at my CanaKit and not seeing anything obvious. Thanks!

Scott Leibrand
@scottleibrand
Nov 15 2015 22:18
If you're going the "mount the SD card on a Windows or Linux box" method you can look at /etc/apt/sources.lst
otherwise as soon as you connect you can run lsb_release or similar.
Dont think there will be anything identifying the distribution off the SD card.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:19
going to start adding tags/pictures to my instance repo as I get things setup https://github.com/jasoncalabrese/indy/releases
Dana Lewis
@danamlewis
Nov 15 2015 22:21
Awesome @jasoncalabrese ! Cool way to document
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:22
would be cool if everyone could do something like that
Dana Lewis
@danamlewis
Nov 15 2015 22:22
Yea
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:22
was thinking of a way to make it semi-anonymous
Scott Leibrand
@scottleibrand
Nov 15 2015 22:22
Sweet! You should Tweet those too. :-)
Matt Pressnall
@logichammer
Nov 15 2015 22:24
@scottleibrand, that's what I was looking for...thanks!
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:25
Andrew's minecraft addiction is now useful since it keeps the carelink in range
Scott Leibrand
@scottleibrand
Nov 15 2015 22:31
:+1:
Tim Howard
@tghoward
Nov 15 2015 22:33
Yep, we've got that benefit also.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:40
need that 2nd pi pretty bad now, lots of stuff I want to change, but don't want to have it stop as I hack
eyim
@eyim
Nov 15 2015 22:44

@jasoncalabrese Awesome Jason. Very nice and helpful to those of us following along. I am still trying to figure out the timezone issue. It looks like I have everything installed correctly and configured. I just doubled check it with yours and it syncs up. It doesn't add the -8:00 to the timestamps in the zoned file. It adds +00:00 so it thinks I am GMT time zone I guess

However when I run it direct with the command:

openaps use pump iter_pump_hours 8 | openaps use tz rezone --date date - >>timezonenew.txt

It works correctly. So for some reason this doesn't work for me:

[report "monitor/pump-history-zoned.json"]
use = rezone
reporter = JSON
date = timestamp dateString start_at end_at created_at
adjust = missing
input = monitor/pump-history.json
device = tz
timezone = None
astimezone = True

Stumped for now ...

Matt Pressnall
@logichammer
Nov 15 2015 22:49
Jessie and openaps 0.0.7 installed now! Should have a pull request for the documentation later tonight...
Scott Leibrand
@scottleibrand
Nov 15 2015 22:53
Sweet!
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:54
the zoned history file was causing iob problems, I think I still have something wrong there, but not as wrong as it was when I was using the zoned history files for calculating iob
started adding a iob test last night, need to finish that
Scott Leibrand
@scottleibrand
Nov 15 2015 22:56
You could create a second openaps instance in a new directory, and then set up your cron to alternate running them.
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:56
feels like something isn't turning the date strings into js dates or something
I'm not current with dev either
Ben West
@bewest
Nov 15 2015 22:57
clock also needs to be zoned
everything needs to be either unzoned or zoned
NS treatments api assumes everything is zoned, so
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:58
that is probably it
Ben West
@bewest
Nov 15 2015 22:59
can probably start working on fancier uses for medtronic
reduce number of intermittent boilerplate
Jason Calabrese
@jasoncalabrese
Nov 15 2015 22:59
yeah
that would make staying current easier too
start to build out the blocks some
Ben West
@bewest
Nov 15 2015 23:00
oref0 python version for that... need to inherit from the classes/extend them
can add them to medtronic
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:03
I want to get the BG wait in place
was thinking about 2 crons, with scripts that have timeouts or something
mark the point when a new point is expected
Ben West
@bewest
Nov 15 2015 23:04
for now I'd like to stick to realy really simple sequential things
continue to build them out
and then consider daemons that interact...
eg a local mqtt/websocket daemon
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:04
I'm doing a 2nd history read, after enact, to update NS right away
Ben West
@bewest
Nov 15 2015 23:04
nate had a neat way to avoid a second history read
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:04
but it slows things down
Ben West
@bewest
Nov 15 2015 23:05
but maybe the send recomendation use should return the newest bit of history as a result
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:05
think Scott had a wait for that
Ben West
@bewest
Nov 15 2015 23:05
no need to requery then
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:05
how are the retries working
Ben West
@bewest
Nov 15 2015 23:06
on mine there are no retries
it tries to fail fast and quits
we'll move to mqtt daemon fairly soon... just been distracted by all the new MM transports :-)
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:08
yeah, opened an issue related to that
Scott Leibrand
@scottleibrand
Nov 15 2015 23:10
what I do is: every minute, check if openaps is running, and if not, start a loop. preflight, and wait 2 minutes if it fails. if preflight succeeds, read pump history and glucose. upload pump history to nightscout. wait until next BG reading comes in, then immediately enact any suggested temp. then exit and start over <1m later.
that way, I am always enacting temps within seconds of each new BG reading, and always uploading the results of my action within 1m or so
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:11
that seems pretty good to me
would be nice to have the upload be instant
Scott Leibrand
@scottleibrand
Nov 15 2015 23:11
right not that's not possible: you have to re-query pumphistory at least
and requerying everything is the slowest operation in the loop, so not much sense doing it twice back to back
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:12
if you only requery when there is a recommendation it wouldn't be too bad
only need to requery the history, but it is slow
Scott Leibrand
@scottleibrand
Nov 15 2015 23:13
yeah. I've done that in previous loops, but didn't see the point with my oref0 one, when I'm about to query it immediately on start of next run.
better to get that out of the way and make sure i don't miss the next BG reading (if I'm at edge of range and pump queries are being slow)
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:13
makes sense
Scott Leibrand
@scottleibrand
Nov 15 2015 23:15
on my older 1st-gen Pi's I have the cron set to run every 30s instead of every minute, to make sure it always finishes everything within 5m and doesn't end up waiting another 5m for next BG
just spawning openaps lots of times is slow on those
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:16
I think I can pull some stuff out of my loop too
don't think every report I collected is getting used
Scott Leibrand
@scottleibrand
Nov 15 2015 23:17
and my retry-loop skips the wait-for-bg thing if anything fails and it has to retry. in that case it just runs through the whole loop, and then can go back to wait-for-bg if preflight succeeds on the next loop
Jason Calabrese
@jasoncalabrese
Nov 15 2015 23:22
getting all the bash magic for that just right is a pain, maybe we could have some primitives
I know I saw some of that posted before, but not sure where now
Ben West
@bewest
Nov 15 2015 23:51
yeah, need some better uses, etc
we basically just discovered what it needs to do
so now we can organize that better