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

23rd
Aug 2016
Eric Jensen
@elnjensen
Aug 23 2016 01:21
I've been starting to see errors in syslog from the Carelink stick, like bad zero CRC? and bad ailing. Sometimes the loop will run, sometimes not - hard to see a pattern.
Scott Leibrand
@scottleibrand
Aug 23 2016 01:32
yeah, that is pretty typical of the crappy range of the Carelink.
Eric Jensen
@elnjensen
Aug 23 2016 01:32
But this is with Carelink about 8 inches from pump.
And the weird thing is, when I run from cron, it mostly fails. And if I run from command line, it almost always succeeds.
Maybe it's because I run from command line right after it has just run from cron (sitting here watching it), and pump is "awake" then?
Not sure why that would matter, though.
A related question: when it gives these errors, I don't get a PREFLIGHT FAIL message like I would expect. preflight looks like this:
pi@raspberrypi:~/myopenaps $ openaps alias show preflight
preflight ! bash -c "rm -f monitor/clock.json enact/suggested.json enact/enacted.json && openaps report invoke monitor/clock.json 2>/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || (echo PREFLIGHT FAIL; logger -t openaps 'PREFLIGHT FAIL'; exit 1)"
Ben West
@bewest
Aug 23 2016 02:24
bad zero CRC and bad ailing are warning messages
there are various retries in place to navigate around them
the preflight is meant to detect situations where it just won't work
in the scenarios where those warnings are produced, often trying harder makes it work, which is why it's not failing
ailing is warning, failed is failed
Eric Jensen
@elnjensen
Aug 23 2016 02:27
Cool, thanks for the explanation. I should have been clearer - I get neither a PREFLIGHT FAIL nor a PREFLIGHT OK message. It doesn't go on with the rest of the commands, either, which is good, but I don't understand why I don't get either of those messages from the above command.
Ben West
@bewest
Aug 23 2016 02:28
I'd avoid doing rm stuff
Eric Jensen
@elnjensen
Aug 23 2016 02:29
OK - any suggested alternative? If we're testing existence of the monitor/clock.json file as evidence of command success, don't we want to be sure it's not an old file?
Ben West
@bewest
Aug 23 2016 02:31
my preflight is set to run clock and clock-rezone
if clock fails, the rezone fails, and then the whole preflight fails
preflight ! bash -c "(echo PREFLIGHT ) && openaps warmup 2>&1 >/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || openaps fail-warmup"
the invoke always overwrites the file, so I'd be shocked in the event you parse an old file
Eric Jensen
@elnjensen
Aug 23 2016 02:32
OK, interesting. I was following the example preflight in the docs.
Ben West
@bewest
Aug 23 2016 02:32
warmup report invoke model.json raw-pump/clock-raw.json monitor/clock.json
fail-warmup ! bash -c "echo PREFLIGHT FAIL; exit 1"
invoke implicitly rms the file before doing it, I recommend against using rm in aliases
consider going with the buitin templates
oref0 template mint -h
openaps/docs#132
Peter Miller
@ochenmiller
Aug 23 2016 02:37
Having a little trouble with openxshareble on edison. I'm using debian, and ended up having to install dbus by hand. I feel like I'm soooo close. At this point it pairs with the share, but throws an AttributeError: 'NoneType' object has no attribute 'ReadRecords'. Also, needing to run it via sudo, no matter how I monkey around with groups.
Eric Jensen
@elnjensen
Aug 23 2016 02:38
OK, I'll take a look at it. It seems like there's a real tension in the docs right now between mentions here and there of the idea of "templates", but no actual explanation of what they are or how to use them. I think that's good in many ways, since it forces the reader to go through and set up individual reports and understand how that works, but then things never really come back together to say, 'ok, now that you have the basic idea, you can use these templates so you'll have a standardized set of tools'.
Eric Jensen
@elnjensen
Aug 23 2016 02:43
I realize it's up to users to work on the docs, too, so I'm not trying to blame anyone. Now that I know that oref0 template exists as a command, I'll take a look and see if I can figure out where it might make sense to bring it into the docs. Suggestions are welcome. (And a related issue is when/why to use oref0 vs. openaps in general - that's something that's still pretty unclear to me.)
Andy Sharrow
@dramageek
Aug 23 2016 02:47
@ochenmiller I'm stuck at the same step, along with a few others (I believe).
I was able to get around the sudo problems by adding the user to the 'lp' group.
Gina
@gclyon
Aug 23 2016 02:51
@elnjensen , I so agree. I'm a newbie at this project, and I'd say the part that threw me off was Phase2 Using Oref0 Tools
where you install templates, which then don't correspond to the reports you've been making. The templates are a great addition, but I definitely needed to run thru it manually so I could understand it first.
Andy Sharrow
@dramageek
Aug 23 2016 02:52
I was able to install dbus the regular way, but according to https://github.com/adafruit/Adafruit_Python_BluefruitLE you do need to install bluez from source to get the experimental dbus hooks for ble.
Peter Miller
@ochenmiller
Aug 23 2016 02:57
@dramageek, well bust my buttons. adding edison user to lp group did take care of sudo issue. So weird, as dbus runs as messagebus
thinking I didn't install Adafruit_Python_BluefruitLE correctly. Gonna mess with that, and I'll keep you posted.
Andy Sharrow
@dramageek
Aug 23 2016 03:06
Yeah, I'm still messing with it too. So frustrating, as it seems like many people have it working!
Martin Haeberli
@mhaeberli
Aug 23 2016 03:28
for reference, 2013-08 manufacture date sealed 523 is 2.5A … I’d appreciate it if anyone else has a pump manufacture date / firmware version matchup, even though it’s unreliable ...
Eric Jensen
@elnjensen
Aug 23 2016 03:31
Sorry it's 2.5A! :-1:
John Benjamin
@Bender1061
Aug 23 2016 03:31
So I live right down the street from a Microcenter. They have the Edison and breakout boards right on the self. Yeah I had to buy another to make another test rig. Too bad they dont sell the ti stick. But i have two right now. (I already have a spare rig incase I ever have problems) but yeah being able to just go two miles down the road to buy an Edison is kind of convenent!
Eric Luhrs
@eluhrs
Aug 23 2016 03:32
@Bender1061 Keep an eye on the Microcenter Edison stock. They often discount the compute module and breakout board kit to $45.
garykidd
@garykidd
Aug 23 2016 03:37
@eluhrs how much data do I need for monthly mobile data plan to accommodate openaps instance?
Eric Luhrs
@eluhrs
Aug 23 2016 03:57
@garykidd Sorry, but I don't know. I tether with bluetooth but only when I don't have a network connection. I don't think you'll need much though. I've not even noticed an increase since I started tethering. But like I said, I don't use it all that much.
garykidd
@garykidd
Aug 23 2016 04:01
@eluhrs thanks much. I would really like it/appreciate it if we could meet in person. I'm making a little progress but admittedly I get stuck too easily. If you would be willing to lend a little direction in person, i'd somehow make it worth your while and I'll make meeting place as convenient as possible for you. Thanks for the help thus far too.
warren-scott
@warren-scott
Aug 23 2016 04:07
Hello all. I've just installed OpenAPS locally today for the first time and am toying with the idea of getting a setup for my T1D son who starts high school next week after homeschooling till now. Looks pretty daunting but we'll see if I can make it happen. Really appreciate all your work here.
Dana Lewis
@danamlewis
Aug 23 2016 04:50
Welcome @warren-scott! You can do it :)
Brandon Faloona
@bfaloona
Aug 23 2016 06:18
@bewest hmm. my loop script is not exiting on failure. Any ideas why?
#!/bin/bash -eu
# Main loop
( openaps gather-clean-data; ) 2>&1 | logger -t do-loop-gather
( openaps do-oref0; ) 2>&1 | logger -t do-loop-predict
( openaps enact-oref0; ) 2>&1 | logger -t do-loop-enact
Welcome @warren-scott !
Christer Jensen
@christerjensen
Aug 23 2016 06:24
Got hold of the right CareLink stick yesterday and my OpenAPS RPi2 can pull data from my two 715 pumps (EU v2.3). The setup also pulls data from Nightscout. Exiting - now for the tough job.
Brandon Faloona
@bfaloona
Aug 23 2016 06:44
@elnjensen Could subshells in your loop be creating simultaneous calls to the carelink? I think I had this problem, but never quite proved it.
Brandon Faloona
@bfaloona
Aug 23 2016 06:49
@jasoncalabrese FYI. I deleted the incomplete 'Carb Correction' entry from the UI in NS, but subsequent updates did not replace it with the correct 'Meal' bolus wizard entry. Moving forward I'll test status before pulling history as you mentioned.
@jasoncalabrese ... I think there were treatments after the one I deleted. That's probably why it did not get updated.
Dave Ewall
@daveewall
Aug 23 2016 07:21
@sjolundjohn I have my battery JST'd to the Powerboost, and I used the solder points to connect another short JST connector to the 5V and Gnd, then plugged the JST into the power input in J2 on the breakout board. Beware of polarity! I triple checked here: http://download.intel.com/support/edison/sb/edisonbreakout_hg_331190006.pdf
Dave Ewall
@daveewall
Aug 23 2016 07:30
@scottleibrand Just FYI, I finally got BT tethering on the Edison, but had to go to Yocto for it, and connman stinks, so I have a cron job that manually makes or breaks connections if necessary (so BT isn't on if wifi is available, saving phone battery). I tried going with latest yocto, but it crashes/reboots after upgrading packages, so went back to 20160315 yocto. Used instructions on the mmeowlink page.
Dave Ewall
@daveewall
Aug 23 2016 07:50

Perhaps someone can help with a "cascade failure" I'm having. Apparently I'm not de-duping my entries before uploading, causing NS reporting issues. That led me to the "ns shell format-recent-type" report, which is throwing date parsing errors when running, which leads me to "undefined-0400" dates in my glucose-ns.json, which leads me to "Could Not Decode" packets in my glucose.json, like this:

  {
    "op": 4, 
    "_tell": 185, 
    "name": "Could Not Decode", 
    "packet_size": 0
  }

Any ideas what would cause that? If those show up, I can't de-dupe, so glucose values won't get uploaded at all until those packets age out of the report. Is this just missing capability from mmeowlink? Using Serial TI stick on Edison Yocto. If I don't de-dupe, it's working fine otherwise.

Colin Lennon
@colinlennon
Aug 23 2016 08:59
@bfaloona Hi Brandon. The issue is that you have three separate lines there, which will execute one after the other. What you want to do is gather-clean-data then, only if that succeeds, do-oref0 then, only if that succeeds, enact-oref0
Something roughly like this -
openaps gather-clean-data && openaps do-oref0 && openaps enact-oref0
...but with your extra stuff for logging added in.
You'll also want to ensure that each of those three aliases returns 0 if successful and return 1 otherwise.
John Sjolund
@sjolundjohn
Aug 23 2016 10:45
@daveewall thanks for this clarification. Question, why not solder the JST connector where the USB port, on the Powerboost was, rather than on 5V and Gnd? Are you able to send a picture of what it looks like any chance?
Eric Luhrs
@eluhrs
Aug 23 2016 11:44
@garykidd sure, we can meet up. I guess where depends on what kind of help you need. If you need tools, soldering, then my house would be best. Otherwise where is more flexible. When did you have in mind?
Brandon Faloona
@bfaloona
Aug 23 2016 11:44
Nightscout is returning application errors to openaps. I can make api requests but the latest glucose data is 2 hours old.
I've restarted nightscout website via Heroku's website, but that did not seem to help.
I'm worried this was caused by the dev version of oref0, or more likely an incomplete installation of oref0.
Does this mean that the share2nightscout bridge is failing to get updates?
@colinlennon Thanks for the input. I was expecting the -eu switch (parameter?) in my bash shebang would fail the script on the first error.
Colin Lennon
@colinlennon
Aug 23 2016 11:59
@bfaloona Ah, apologies, I missed that. Maybe it should actually.
Most people create a single alias which does everything (often called do-everything) and then, in your cron entry, all you have to do is call that alias
In the do-everything alias, I use && to chain commands and ensure that each command only executes if the previous one executed successfully
Might be worth having a look at the example from @bewest here - https://github.com/bewest/openaps-example/blob/master/openaps.ini
Dave Ewall
@daveewall
Aug 23 2016 12:39
@sjolundjohn I made the one that @eluhrs put on Thingiverse. Looks like I'm the only other one who made one and uploaded the photos... you can't really see the joint on the powerboost, but if you have the parts, you can envision how it has to work from the photos. The 3d print doesn't have room for the wires where you want them. You can see pictures of my white one here: https://www.thingiverse.com/make:233362
John Sjolund
@sjolundjohn
Aug 23 2016 12:49

@daveewall many thanks.

I think my rig will be a bit bigger to start as I will use more USB connections, especially to TI to start

But based on what I have I think I can piece it together. I just ordered more parts now so need to wait a few days to get it going. Flashing Edison boards now
Dave Ewall
@daveewall
Aug 23 2016 12:52
Yeah, I was going to go that way too, until I saw his print and decided that I really wanted something that small, and it was worth the effort. Battery lasts all day, nice and small, no rebooting. At this point it's just about getting the nit-picky things working solidly, but otherwise, I'm quite happy.
John Sjolund
@sjolundjohn
Aug 23 2016 13:08
NIce!
garykidd
@garykidd
Aug 23 2016 13:47
@eluhrs thanks. I;m going to plug through still. Not sure if maybe next week might be a possibility. I'm still waiting for my TI stick. I did get programmer, however, edison, charger board. So hopefully those come in and maybe then we can meet up. Thanks again!
@eluhrs cool--looks like TI stick should be here tomorrow. Just leaves battery an connectors I think.
Martin Haeberli
@mhaeberli
Aug 23 2016 14:00
@daveewall @eluhrs - I have made a few such cases, but haven’t actually integrated any Edisons into them yet ...
Eric Luhrs
@eluhrs
Aug 23 2016 14:32
@daveewall @sjolundjohn @mhaeberli I'm just about to finalize design of a new, smaller case. Those one will use a cheaper and smaller adafruit charger, a small lipo, and an ERF radio. These can be hard to find, but the case can be modified slightly for XRF, etc. Here's the link: https://www.thingiverse.com/thing:1716181
But wait until later today if you plan to print, because I am just now test printing what is likely the final version.
Colin Lennon
@colinlennon
Aug 23 2016 14:58
@eluhrs Awesome work. Did you remove and replace the J2 connector? Or just bend the existing pins to 90 degree angles?
Eric Luhrs
@eluhrs
Aug 23 2016 15:05
@colinlennon I bent this one because I thought it would be easier for most people to do. But you can also replace with a 90 degree JST connector.
Colin Lennon
@colinlennon
Aug 23 2016 15:08
@eluhrs Thanks, it hadn't occurred to me to try that! That would help reduce the height of my setup too so I'll give it a try.
Eric Luhrs
@eluhrs
Aug 23 2016 15:09
Yes, that's exactly why I switched to the right angle. Otherwise the wires extend slightly higher than the Edison's screw posts.
And the connector is easily tight enough on the pins.
Colin Lennon
@colinlennon
Aug 23 2016 15:11
:+1:
Eric
@ecc1
Aug 23 2016 15:48
The J2 pins are on 0.1" (2.54mm) spacing, but JST-PH connectors use 2mm spacing. Was someone still able to replace J2 with a JST female connector?
Eric Luhrs
@eluhrs
Aug 23 2016 15:50
@ecc1 I did it. Was just a little heavy handed with the solder.
Brandon Faloona
@bfaloona
Aug 23 2016 16:03
@all I'm looking for help on how to get nightscout site working again. See my messages from 04:44 above ^^.
Based on what I was working on (updating oref0 to dev branch), I suspect openaps uploaded invalid data and corrupted the site.
The openaps errors at that time looked like: Error: Cannot find module 'oref0/lib/temps'.
Now, nightscout UI fails to finish loading, the entries api shows BG data that ~ an hour old, and the uploaded api returns a 500 http error.
Brandon Faloona
@bfaloona
Aug 23 2016 16:18
Regarding my oref0 install: I ran sudo npm link on an oref0 repro, after things started failing I repeated that on but on the master branch, and then (still failing) I ran sudo npm install -g oref0
Now openaps is working but:
  • BG data from nightscout api is ~ an hour old
  • Nightscout UI is nearly all black.
:worried:
Brandon Faloona
@bfaloona
Aug 23 2016 18:00
@Benwest @scottleibrand Should I reset my nightscout database? redeploy nightscout entirely? I'd like to get our system back online while T1D is on current course of steroids.
Nightscout is returning a 500 error for this url: https://nightscout-lp.herokuapp.com/public/js/bundle.js?v=0.9.0-beta3
Martin Haeberli
@mhaeberli
Aug 23 2016 18:16
@bfaloona I’d like to advise but have no experience with the Heroku configuration; I have been using Azure for a long time and more recently spun up standalone Nightscout / mongodb on a Digital Ocean droplet.
C-Ville
@C-Ville
Aug 23 2016 18:23
This message was deleted
Ben West
@bewest
Aug 23 2016 18:23
that looks like c-r-m isn't deployed/installed quite right
I'd try restarting it maybe, does not look like a database issue at all
heroku probably has a log of what's going on somewhere
it might actually be crashing and restarting constantly
the log in heroku should tell exactly what's happening
Brandon Faloona
@bfaloona
Aug 23 2016 18:32
Perhaps a script that is not exiting? error: Forever detected script exited with code: 8
TypeError: Cannot read property 'time' of null
Brandon Faloona
@bfaloona
Aug 23 2016 18:37
Here's more context for the time null exception:
2016-08-23T18:27:15.569769+00:00 app[web.1]: Load Complete:
2016-08-23T18:27:15.569779+00:00 app[web.1]:      sgvs:456, treatments:200, profiles:1, devicestatus:233, tempbasalTreatments:62, tempTargetTreatments:3
2016-08-23T18:27:15.609713+00:00 app[web.1]: TypeError: Cannot read property 'time' of null
2016-08-23T18:27:15.609719+00:00 app[web.1]:     at fromDeviceStatus (/app/lib/plugins/iob.js:82:17)
2016-08-23T18:27:15.609720+00:00 app[web.1]:     at arrayMap (/app/node_modules/lodash/lodash.js:574:23)
2016-08-23T18:27:15.609721+00:00 app[web.1]:     at Function.map (/app/node_modules/lodash/lodash.js:8851:14)
Ben West
@bewest
Aug 23 2016 18:39
ah, ok
so it's starting, loading data from the database
and then it's tripping over one of the properties/fields
then it crashes
and it's doing this as fast as possible repeatedly
so there's a record in your database that is tripping things up, it seems to be lacking a time property
entries is ok
it's probably treatments
yeah, it's treatments
Brandon Faloona
@bfaloona
Aug 23 2016 18:43
so... use mongo cmdline to find and delete the record? Is there a GUI for that?
Ben West
@bewest
Aug 23 2016 18:43
you've got a few treatment entries that somehow cause NS to crash most likely
yeah, if you're using mlab, they have a web portal
Brandon Faloona
@bfaloona
Aug 23 2016 18:44
great. What I'd really like to do is save that db and create a new one.
Thanks for your help Ben!
Ben West
@bewest
Aug 23 2016 18:44
I think you want to find { "time": null } I think or similar
you can just change the collection name
and it'll start fresh from new collection
Brandon Faloona
@bfaloona
Aug 23 2016 18:45
that sounds nice! 'collection' is an mlab thing?
Ben West
@bewest
Aug 23 2016 18:46
just change MONGO_TREATMENTS_COLLECTION=new_treatments
by default the value is treatments
it's an environment variable, so it'll be a setting or environment variable in the heroku settings
collection is kind of like a table
Brandon Faloona
@bfaloona
Aug 23 2016 18:47
Makes perfect sense. Thanks.
Ben West
@bewest
Aug 23 2016 18:49
actually, it might be devicestatus causing the problem
in which case, MONGO_DEVICESTATUS_COLLECTION=other_devicestatus
Brandon Faloona
@bfaloona
Aug 23 2016 18:52
I'm back online! :heart: :rocket: :exclamation:
I was too excited to test if the problem was devicestatus or treatments. I'll go back and confirm now.
mLab UI is awesome. I had not seen it.
It was very simple to rename the collection in mLab, and the new collection was created immediately. So, I got my backup, kept the default table name, and a clean dataset to run in production.
Ben West
@bewest
Aug 23 2016 18:55
yeah, creation is a no-op
Martin Haeberli
@mhaeberli
Aug 23 2016 18:56
@bfaloona :+1:
Brandon Faloona
@bfaloona
Aug 23 2016 19:29
@bewest I can't find the bad record(s). Searching for {"time": null } returns all records from both treatments and devicestatus (because that's not a property?). Perhaps my search is too simple. Does it need to include the nested namespaces to the timestamp property?
Brandon Faloona
@bfaloona
Aug 23 2016 19:37

Yeah, I'm not querying correctly. Even this query is not returning results for me.

{
    "status": {
        "timestamp": {
            "$exists": true
        }
    }
}

Seems important to track the data issue down, but I'm happy to let it go. :smile:

Brandon Faloona
@bfaloona
Aug 23 2016 19:50

make sure you have the latest oref0 dev

@scottleibrand @bewest What's the best way to install oref0 dev? Is reinstalling it globally the correct way to revert back to the release version?

I think it has to be in ~/src/oref0/ for now

I used ~/oref0 . Should I try again inside ~/src/ ?

I used sudo npm link inside the repo directory while checked out to dev
Scott Leibrand
@scottleibrand
Aug 23 2016 20:10
Yeah, or update a local copy of the setup.sh to point to ~/oref0/
For this you don't need to install from ~/src/oref0/, just clone/pull the latest there.
Brandon Faloona
@bfaloona
Aug 23 2016 20:11
So, I should not run sudo npm link from there?
I just did that and reproduced the local openaps error, and the nightscout time null mongo issue.
Brandon Faloona
@bfaloona
Aug 23 2016 20:22
After running sudo npm install -g oref0 ,
and then cloning the openaps-sh repo to ~/src/oref0 ,
I should be able to run json-import/setup.sh in that repro to test it?
(oh, and i've checked out the dev branch)
Scott Leibrand
@scottleibrand
Aug 23 2016 20:24
you'll want to run the setup.sh from your homedir, giving it the name of the dir you want it to create as one of the arguments
Brandon Faloona
@bfaloona
Aug 23 2016 20:41
@bewest FYI: I confirmed the TypeError: Cannot read property 'time' of null exception was caused by devicestatus
Brandon Faloona
@bfaloona
Aug 23 2016 21:59
@scottleibrand @bewest I'm setting up to test Scott's setup.sh. Can you confirm my setup?
pi@openaps-lp:~/src/oref0 $ oref0.sh -h
[normal help output]
pi@openaps-lp:~/src/oref0 $ ./bin/oref0.sh -h
[new help output]
Reviewing the script I see references to ~/oref0 and ~/openaps-dev but I don't have those directories.
Brandon Faloona
@bfaloona
Aug 23 2016 22:21
Well, that was the script from master. Looks like I should be in refresh-loops branch.
Scott Leibrand
@scottleibrand
Aug 23 2016 22:22
no, json-import branch
Brandon Faloona
@bfaloona
Aug 23 2016 22:22
ok
Scott Leibrand
@scottleibrand
Aug 23 2016 22:23
ignore everything after https://github.com/scottleibrand/openaps-sh/blob/json-import/setup.sh#L121 - it is old code that can't run