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

3rd
Jul 2016
Bill Stackpole
@billstackpole
Jul 03 2016 00:15
@jasoncalabrese Is there a known fix for the mondo dbase quota? I'm thinking the options are to a) wipe mongo and restart fresh or b) transition to the $15/month plan. Any other ideas? (I did get an email response back from Mlab indicating that my "repair database" exercise was the right short term solution but that a transition to a paid plan might be in order. They also noted that the mongo connection string would change and there would likely be some downtime during the changeover). Tnx for any info/ideas.
As a sidenote, been looping since Late March so free plan for me in Mlab has worked just over 3 months. (My data point for others to note)
Hristina Dimova
@xpucuto
Jul 03 2016 00:25
In this relation I am wondering how much is everyone paying to Azure/Heroku monthly to be able to run their loop . I started looping since May 1st and after I got few website shutdowns due to exceeded cpu quota in June I switched my Azure pay-as-you-go subscription to shared. And today I am not happy to see that my bill for last month is 38 Euro . Of course It's much better to pay those money instead of living without OpenAPS but I need to minimize the costs as I pay out of pocket for my pump, its supplies and Dexcom CGM .
Chris Oattes
@cjo20
Jul 03 2016 00:40
You should be able to get away with free azure
Hristina Dimova
@xpucuto
Jul 03 2016 00:43
Unfortunately not :( actually I have 3 websites running I will try to one of them to another account and leave only OpenAPS and xdrip there . Hopefully it will work . :(
*to move
Scott Leibrand
@scottleibrand
Jul 03 2016 00:59
If you're willing to take on the sys admin duties, you should be able to run mongodb and node on your own $5/month VM from someone like DigitalOcean.
Bill Stackpole
@billstackpole
Jul 03 2016 01:12
K - so quick update: Have deployed a new sandbox in Mlab, with new database name, database user, database password, and then updated my Azure site to reflect the new mongo string. Mlab didn't whine at me for doing this in any way, nor does it appear that it is impacting my usage in the other database. (Have uploaded data from my OpenAPS and have a running Nightscout instance again.)
No other changes other than creating another sandbox database, and updating Azure to reflect the new strings.
From this page: http://www.nightscout.info/wiki/welcome/configuring-the-data-backend since I already had a mongo account, I simply started at "create a new MongoDB database"
Bill Stackpole
@billstackpole
Jul 03 2016 01:17
Then on the next page: http://www.nightscout.info/wiki/welcome/monitor-cgm-web I started at "Step 4: Configure Your Website to Use Mlab and Set an API SECRET" and changed the "mongo connection string" and "mongo collection" to match what I had just created in Mlab.
Saved all changes in Azure, restarted web deployment, Voila! Success!
Hope this helps someone else.
going to bed now. Whew. :grin:
Whoops - one other thing
Needed to update my PROFILE in Nightscout to reflect carb ratios and such. (so if you're going to do this, capture your profile from your Nightscout site BEFORE you make the changes so you will have the data and be able to update your site more quickly than I did.)
Thats all for now.
And thanks @scottleibrand @jasoncalabrese for your help and to all others who have been posting their woes, successes, and other communications about this.
Matthias
@ceben80
Jul 03 2016 05:06
@bewest morning Ben :wink:
Q to export, just was running oref0 export-loop but no json file was created :question:
pi@pi3-ti:~/myopenaps $ oref0 export-loop backup-ti.json
pi@pi3-ti:~/myopenaps $ ls -l
total 88
-rw-r--r-- 1 pi pi   94 Apr 15 10:31 calculate-iob.ini
-rw-r--r-- 1 pi pi   16 May 17 20:55 cgm.ini
-rw-r--r-- 1 pi pi  153 Apr 15 12:53 curl.ini
-rw-r--r-- 1 pi pi  116 Apr 15 10:37 determine-basal.ini
drwxr-xr-x 2 pi pi 4096 Jul  3 07:03 enact
-rw-r--r-- 1 pi pi  128 May 17 20:56 get-profile.ini
-rw-r--r-- 1 pi pi   17 May 18 16:51 max_iob.json
-rw-r--r-- 1 pi pi   76 Apr 15 10:33 meal.ini
drwxr-xr-x 2 pi pi 4096 Jul  3 07:03 monitor
-rw-r--r-- 1 pi pi  708 Apr 15 09:54 npm-debug.log
-rw-r--r-- 1 pi pi  159 Apr 15 12:34 ns-glucose.ini
-rw-r--r-- 1 pi pi  149 Apr 20 08:51 ns.ini
-rw-r--r-- 1 pi pi  115 May 17 20:57 ns-status.ini
-rw-r--r-- 1 pi pi  395 Jun  5 19:58 openaps_crontab
-rw-r--r-- 1 pi pi 6984 Jul  3 07:03 openaps.ini
-rw-r--r-- 1 pi pi  261 Apr 16 13:38 openaps_test
-rw-r--r-- 1 pi pi   48 Apr 15 09:05 oref0.ini
-rw-r--r-- 1 pi pi  126 Jul  3 07:03 pump.ini
drwxr-xr-x 2 pi pi 4096 Jul  3 07:03 settings
-rw-r--r-- 1 pi pi   15 Apr 15 10:46 tz.ini
drwxr-xr-x 2 pi pi 4096 Apr 15 14:25 upload
pi@pi3-ti:~/myopenaps $
Martin Haeberli
@mhaeberli
Jul 03 2016 05:15
has anyone else seen this - we got a 722 2.4A pump for looping but the carb ratios now go in 1-unit increments, not 0.5 unit increments ...
Matthias
@ceben80
Jul 03 2016 05:20
My openaps version is openaps 0.1.1-dev - export should work with this version :question:
Matthias
@ceben80
Jul 03 2016 05:31
@bewest .....and running a openaps update doesn't work too :worried:
pi@pi3-ti:~/myopenaps $ sudo easy_install -ZU setuptools && sudo easy_install -ZU openaps

Traceback (most recent call last):
  File "/usr/local/bin/easy_install", line 9, in <module>
    load_entry_point('setuptools==21.0.0', 'console_scripts', 'easy_install')()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 356, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2476, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2190, in load
    ['__name__'])
  File "build/bdist.linux-armv7l/egg/setuptools/__init__.py", line 11, in <module>
  File "build/bdist.linux-armv7l/egg/setuptools/extern/__init__.py", line 1, in <module>
ImportError: No module named extern
Matthias
@ceben80
Jul 03 2016 06:13
I just installed per curl -s https://raw.githubusercontent.com/openaps/docs/master/scripts/quick-packages.sh | bash -
works fine, now my version is openaps 0.1.5 and export also works as expected :star2:
Matthias
@ceben80
Jul 03 2016 06:19
....but I'am not able to find the export output json file....hmm strange
Jeremy M Lucas (GetRileyLink.org)
@jlucasvt
Jul 03 2016 12:40
I was doing some Historical Reading on the topic of Pump Commuincations and went back to those good old days when Jay Radcliffe , and Barnaby Jack starting posting and presenting information on Medtronic Pumps and Exploits. I guess my question is not really one of security but more for understanding. Did they stand on the shoulders of Mr @bewest and others or did they build their own exploit. I guess it was my understanding that Ben had been sniffing and packet scratching for over 6 years to give us the ability to have a conversation with our pumps. I just want to make sure I have the history straight (It’s July 3rd im feeling the need for some history lessons before I light off a truck load of fireworks)
Dana Lewis
@danamlewis
Jul 03 2016 12:57
It's the same exploit, but it's not about "building", just noticing/documenting (and in our case, that's what Ben took advantage of.)
japrobo
@japrobo
Jul 03 2016 13:52
What is everyone using to SSH from and iPhone?
Dana Lewis
@danamlewis
Jul 03 2016 14:01
Server auditor app
Also recommend setting up shortcuts so you can tap a single key and bring up your logs
Scott Leibrand
@scottleibrand
Jul 03 2016 14:16
Add alias l="tail -F /var/log/openaps/loop.log" or similar to your .bashrc
jaylagorio
@jaylagorio
Jul 03 2016 15:07

What are some ways that people are getting reliable execution when the device boots without having to log into it? I've tried a ton of methods, but none seem as reliable as logging in and doing nohup ./loop.sh (where this script does the openaps alias commands, a sleep cycle, etc). I've tried cron (totally unreliable for some reason), putting things in .bashrc (with & to fork and without), same with .profile, in rc.local using su to run it as the pi user, and even using this so it only runs when the device auto logs in as pi on the main terminal:

mytty=$(tty)                                                                                                                  
if [[ "${mytty:5}" == "tty1" ]]; then cd /home/pi/openaps; ./loop.sh &; fi

While all of this gets me at least one good full loop on boot, it seems like the loop only runs once every 10 - 15 minutes after that if at all and not at any constant interval. I'm running out of ideas.

Jeremy M Lucas (GetRileyLink.org)
@jlucasvt
Jul 03 2016 16:01
@japrobo serverauditor app would be really nice to have it auto run alias as @danamlewis stated.
I think you just need to edit etc/profile.d to call the alias
Jeremy M Lucas (GetRileyLink.org)
@jlucasvt
Jul 03 2016 16:07
@jaylagorio I've had great success with cron it is absolutely the way to go. See my note above on my crontab and remember to have an extra empty [return] line at the end of your crontab entries.
jaylagorio
@jaylagorio
Jul 03 2016 16:11
Found your note above, thanks for the advice. Maybe I'll have to go back to trying that one, it's been a while since I looked at it. One question about it I haven't found the answer to - if I have an entry that runs every 5 minutes, but that entry takes 6 minutes to run, does it then overlap by 1 minute by starting the entry on time but before the first instance ends?
Also, do you have that in your pi user crontab or your root user crontab?
jaylagorio
@jaylagorio
Jul 03 2016 16:40
@jlucasvt Follow up question - it looks like when cron tries to run openaps main-loop (where main-loop is my alias) I get the error LOOP: /bin/sh: 1: openaps: not found . I made sure to have the cd command to get to the current directory so I don't think it's related to it not being an OpenAPS-init'd directory. Any suggestions as to where to look?
When taking the whole cron command and executing it on the command prompt it all fires just fine, even piping output to syslog
David Cintron
@loudestnoise
Jul 03 2016 17:13
@japrobo I use Prompt 2 by Panic. It works quite well and I like that it lets me sync my servers between my iPhone and iPad using their sync service
so I woke up much higher this morning than I normally have been since using OpenAPS and thought, “Oh no, what happened to my rig while I slept?!”
Turns out I just ran out of insulin. My pushover notifications from Nightscout were going off all night telling me I was high, but umm yeah, slept through those
I still want to figure out how to do an alert from Nightscout for my battery and pump reservoir status if anyone has tips on how to do that
Dana Lewis
@danamlewis
Jul 03 2016 17:18
Ugh :/
There's a note somewhere in the docs about battery level alerts.
David Cintron
@loudestnoise
Jul 03 2016 17:21
Yeah, I’ve read that section, but I’ve apparently not got Nightscout sending alerts for that
I’m using a Maker IFTTT to do ns-event, which as I understand is pretty much anything Nightscout alerts about, but doesn’t send ones for battery or reservoir
Followed the instructions on doing that here
ns-event – This event is sent to the maker service for all alarms and notifications. 
This is good catch all event for general logging.
Jeremy M Lucas (GetRileyLink.org)
@jlucasvt
Jul 03 2016 17:36
@jaylagorio I made a bash script I called "do-loop" to call "openaps main-loop" and put it in my ~/bin directory. Then chmod 755 do-loop which makes the file executable. Now I can call do-loop from anywhere and it will run openaps from any directory.
@jaylagorio you will have problems if your loop takes longer than 5 mins to run and you have the crontab running every 5. I use the default /home/pi crontab.
jaylagorio
@jaylagorio
Jul 03 2016 17:58
@jlucasvt Great, thanks for the tip. I have to run but I'll give this a shot and report back. It's really weird considering the openaps command can and does run from anywhere (even just to tell you you're not in an init'd directory) but I'm not a Linux expert. Thanks again!
Dana Lewis
@danamlewis
Jul 03 2016 18:04
@jaylagorio you also might want to investigate what is taking so long to run
ryanchen26
@ryanchen26
Jul 03 2016 18:07
Just had two RPi rigs fail to loop for some reason. We're looping on a third backup RPI rig. With the two that failed it happened in preflight, can't get the monitor/clock.jsonedecker@blackfootstudios.com report invoked so it's just resets usb and repeats. I'm able to communicate with the pump by openaps use pump model and I get "723"....it's just odd, the three RPI rigs are identical setups. Something must have corrupted so I'm going to start over on those 2 units. Running 0.1.6 - dev.
Crazy iPhone autocorrect. Blackfoot studios? Ignore that.
Scott Leibrand
@scottleibrand
Jul 03 2016 18:10
@jaylagorio you're missing the PATH line in your cron
Ben West
@bewest
Jul 03 2016 19:54
@jlucasvt jay radcliffe and jack barnaby worked independenty, I traded email with them, but they did not want to collaborate
jaylagorio
@jaylagorio
Jul 03 2016 21:29
@danamlewis I don't think it's taking longer than 5 minutes, but when I use it on a hot spot I was curious as to what behavior I should expect if the transmission speeds are low.
Paul Martin
@Spazholio
Jul 03 2016 21:30
Transmission speeds being low shouldn’t impact it too much. It’s not pulling/pushing a lot of data either way.
jaylagorio
@jaylagorio
Jul 03 2016 21:34
@scottleibrand When you say PATH, do you mean on the script line? Because from `*/3 * * * * (cd /home/pi/openaps && bash /home/pi/openaps/loop.sh) I get:
Jul  3 21:33:01 openaps CRON[26908]: (pi) CMD ((cd /home/pi/openaps && bash /home/pi/openaps/loop.sh))
Jul  3 21:33:01 openaps LOOP: /home/pi/openaps/loop.sh: line 2: openaps: command not found
Marianne Smith, PMP
@mariannesmith77_twitter
Jul 03 2016 21:34
@jaylagorio that is the error we got when we were missing the PATH and SHELL=/bin/bash variables
jaylagorio
@jaylagorio
Jul 03 2016 21:34
But again, putting ((cd /home/pi/openaps && bash /home/pi/openaps/loop.sh)) on the command line and hitting enter works just fine.
@mariannesmith77_twitter Could you show me what those look like for you? I'm not sure I get it.
Marianne Smith, PMP
@mariannesmith77_twitter
Jul 03 2016 21:36
jaylagorio
@jaylagorio
Jul 03 2016 21:38
Ah - I muse have missed that part of the documentation. I didn't realize that the crontab file needed variables. I'll give that a shot.
Marianne Smith, PMP
@mariannesmith77_twitter
Jul 03 2016 21:38
@jaylagorio mine looks like this. I missed it too. good luck!

```PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
Marianne Smith, PMP
@mariannesmith77_twitter
Jul 03 2016 21:44
At one point the documentation had a great solution to what happens if your loop gets stuck, that killed it if it was over 10 minutes old. I had this in my crontab before we learned the lesson that crontab is not backed up via github with everything else. Now in trying to rebuild this part I can't find it in the documentation. Can anyone point me in the right direction?
Jason Calabrese
@jasoncalabrese
Jul 03 2016 21:49
@billstackpole I'm running mongo on a server at digiatlocean, I wish mlab had a different paid plan that would make more sense for us. $5/month would be fair, but $15 is too much. At work we use sandboxes for some dev and testing, and have seen them get slower and more unreliable, but hard to complain when it's free. Our paid clusters with them have been very reliable
jim-andrews
@jim-andrews
Jul 03 2016 21:50
Has anyone seen this clock issue? I'm generating enact/suggested.json and it keeps returning BG data is too old, or clock set incorrectly. When I run monitor/clock.json, sure enough it's about 20 minutes off. But checking the clock on the 722 pump and it's spot on. Same with the pi, and the Dexcom CGM. Where is the incorrect data coming from?
Jason Calabrese
@jasoncalabrese
Jul 03 2016 21:51
maybe it's not getting updated, you can try running the use manually
jim-andrews
@jim-andrews
Jul 03 2016 21:52
ok, will give that a shot, thanks!
Jason Calabrese
@jasoncalabrese
Jul 03 2016 21:52
openaps use pump read_clock
probably want to stop any crons before that
jim-andrews
@jim-andrews
Jul 03 2016 21:55
yeah, did that. they were wiping out my data. however the use came back with the bogus time.
no wait... lol the use came back with the correct time. so i wonder where the disconnect is?
so how to force an update? i'm running openaps report invoke monitor/clock.json and deleting the clock.json to make sure it's fresh data.
Ben West
@bewest
Jul 03 2016 22:08
fwiw, oref0 cron-5-minute-helper will help create a valid cron job
jim-andrews
@jim-andrews
Jul 03 2016 22:08
Figured it out. It was a sequencing issue. Call set clock first before running all other dependent reports and all is good. Yay! Finally good suggested.json.
David Cintron
@loudestnoise
Jul 03 2016 22:11
@jasoncalabrese or @bewest Do you have the n00bs guide to setting up mongo on a box to work with Nightscout? I have mongo installed, just not sure what to do next.
Ben West
@bewest
Jul 03 2016 22:11
get cgm-remote-monitor
npm install
MONGO=mongodb://localhost/my_cgm node server.js it should be running on PORT=1337 by default
jaylagorio
@jaylagorio
Jul 03 2016 22:13

@jlucasvt @mariannesmith77_twitter @scottleibrand @Spazholio THANK YOU! I also added variables to my crontab that I originally added to my .profile, which was a guess I made when it didn't work at first, doing that wasn't spelled out in the docs.

SHELL=/bin/bash
PATH=/home/pi/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/pi/.cabal/bin:/home/pi/.cabal/bin
TZ='America/New_York'
NIGHTSCOUT_HOST=http://192.168.2.100
API_SECRET=xxxxxx

*/3 * * * * (cd /home/pi/openaps && bash /home/pi/openaps/loop.sh)

Automatic looping when the device starts up without having to log in was the final piece I had to get working before being able to do my first overnight test. Get ready to add another name to the list, @danamlewis!

David Cintron
@loudestnoise
Jul 03 2016 22:16
@bewest wait, that’s it? No create database or anything like that?
Ben West
@bewest
Jul 03 2016 22:16
nope, it's very simple
David Cintron
@loudestnoise
Jul 03 2016 22:16
well would you look at that
Ben West
@bewest
Jul 03 2016 22:16
there are additional environment variables to turn on or tweak variety of features
but that's the minimum setup required :-) it's a lot easier than it's made out to be
Paul Martin
@Spazholio
Jul 03 2016 22:17
@jaylagorio Score! Congrats!
jaylagorio
@jaylagorio
Jul 03 2016 22:18
@bewest Totally agree
Marianne Smith, PMP
@mariannesmith77_twitter
Jul 03 2016 23:02
@jaylagorio :clap:
Dana Lewis
@danamlewis
Jul 03 2016 23:07
Woohoo @jaylagorio! :)
Martin Haeberli
@mhaeberli
Jul 03 2016 23:07
@bewest about to try setting up OpenAPS. What are the trade offs between production and dev?
Ben West
@bewest
Jul 03 2016 23:08
I recommend production for everything except oref0
Martin Haeberli
@mhaeberli
Jul 03 2016 23:12
@bewest ok so just for oref0 checkout dev els master...
Ben West
@bewest
Jul 03 2016 23:12
for most things you can use the package mangers
even for oref0
so: sudo pip install -U openaps openaps-contrib
that install production
pip can take an url-ish type thing like pip install git+git://github.com/oskarpearson/mmeowlink.git as well
oref0 is a node package, so if node and npm are installed sudo npm install -g git://github.com/oref0/oref0.git'#dev' should work great
npm also takes git url-ish things
Martin Haeberli
@mhaeberli
Jul 03 2016 23:18
K thx
Paul Martin
@Spazholio
Jul 03 2016 23:19
What’s with the git+git URI scheme?
Ben West
@bewest
Jul 03 2016 23:34
that's what pip needs
pip takes bunch of different urls and needs a helper helper+ meta prefix
(eg to support git over http: git+http://github.com/....)
Paul Martin
@Spazholio
Jul 03 2016 23:37
Ah, ok.