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

12th
May 2016
Dan Piessens
@dpiessens
May 12 2016 00:00
Give me an hour to get my kids to bed and I'll post the commands
Paul Martin
@Spazholio
May 12 2016 00:02
@eyim To be honest, I’m not sure if you are or not. =) I’m still quite new to the CGM, and I thought NS took all the data that was gathered from the pump as well as the CGM, and then uploaded it. But as I look more into it, it doesn’t do that, does it? It just uploads the last reading from the CGM, as well as treatment recommendations, doesn’t it? This wouldn’t be an issue if I were looping every 5 mins, but since I’m not...
Ben West
@bewest
May 12 2016 00:02
there is a way to upload bg data
there's actually several ways
Dana Lewis
@danamlewis
May 12 2016 00:03
@Spazholio which CGM are you using? that might need to be clarified
Paul Martin
@Spazholio
May 12 2016 00:03
I’d like to think I’ve read most of the docs about this before embarking, but if I’m missing some fundamental component, or have misunderstood something basic, please feel free to point me in the right direction and tell me to RTFM.
@danamlewis Dexcom G4
Dana Lewis
@danamlewis
May 12 2016 00:04
ah yes. so you have to get that data from dexcom, because it’s not in your pump :) to pull
Paul Martin
@Spazholio
May 12 2016 00:05
Ok, but…I think have that data already pulled? I can see it in the monitor/glucose.json file.
Dana Lewis
@danamlewis
May 12 2016 00:07
yep. it’s just getting it to NS now that it sounds like you need
I was just trying to clarify that you have to distinctly do it, it won’t go up with pump data unless you tell it to
Paul Martin
@Spazholio
May 12 2016 00:11
@danamlewis Roger that. Thanks. =)
Dana Lewis
@danamlewis
May 12 2016 00:11
10:4 :)
and because ya’ll haven’t heard me say it enough…if you find something like this that’s not documented, PR please…anything added is better than nothing added :) </PRallthethingssoapbox>
Paul Martin
@Spazholio
May 12 2016 00:12
Well, looking at the NS docs, since I have the G4 w/Share, it looks like that aspect can be done relatively easily via Share/bridge/whatever-it’s-referred-to. Once I start looping, if I pull the data into NS from Share, will the looped data be duplicated? Or will it see that the timestamps are identical/nearly identical and do some magic?
Dana Lewis
@danamlewis
May 12 2016 00:12
Ah. Share bridge is magically awesome.
Paul Martin
@Spazholio
May 12 2016 00:12
And - with respect - while I’m happy to PR and improve documentation, I’mma wait until I have a freaking clue what I’m doing. =)
Dana Lewis
@danamlewis
May 12 2016 00:13
No. what you’ll do is check for NS data and use that; if missing NS data it’ll use local data (if cgm plugged into Pi)
somewhere in this ballpark of things to help: https://github.com/scottleibrand/openaps-sh/blob/master/setup.sh#L113
Paul Martin
@Spazholio
May 12 2016 00:14
Ah, yes. I remember reading this before. It’s all coming back in a bit of a foggy haze. However, this assumes 24/7 connectivity and I’m still working the logistics of that out...
Ben West
@bewest
May 12 2016 00:14
there's different ways to do it, I like to get my glucose over ble direct from share receiver, then upload any gaps to NS
Paul Martin
@Spazholio
May 12 2016 00:15
Now I seem to recall that the Share website went down a little while ago, within the last week or something, no? And that caused some problems? Sorry for the vagueness, but I wasn’t following it too closely when it happened.
Ben West
@bewest
May 12 2016 00:15
you don't have to get it all right up front
Dana Lewis
@danamlewis
May 12 2016 00:15
@Spazholio you want to design to fail over
Ben West
@bewest
May 12 2016 00:15
yes, it went down without notice
Dana Lewis
@danamlewis
May 12 2016 00:15
I don’t assume 24/7 connectivity
I always plug my cgm into Pi overnight for that reason. if wifi goes down, loop will go on
Paul Martin
@Spazholio
May 12 2016 00:17
I don’t think I realized that the Share data could be imported like that into NS. That helps my planning out a LOT. I’ve been trying to figure out how to get data into NS when I’m driving for a few hours (for example) but it seems that’s not needed.
I was looking for a way to failover from WiFi to BT in case I was in a place where I didn’t have WiFi access, but I think that was due to a fundamental misunderstanding of when data was needed. Share seems to be the solutions to a few questions I didn’t even know I had.
Neat.
Dana Lewis
@danamlewis
May 12 2016 00:18
:+1:
Ben West
@bewest
May 12 2016 00:24
here's an overlay of classic android-uploader at the beginning, with openaps doing gap syncs later on
blob
I left openaps several times, it filled in all the gaps, can't even tell
showing raw too
only thing missing there is getting the mbgs
Paul Martin
@Spazholio
May 12 2016 00:25
Holy visualized data, Batman!
Ben West
@bewest
May 12 2016 00:25
I'm not using any of the openaps/status plugins yet, that's just what you get unifying the cgm + pump data
Dana Lewis
@danamlewis
May 12 2016 00:25
:+1:
Ben West
@bewest
May 12 2016 00:26
trying to make openaps easier to use as a complete replacement uploader
Paul Martin
@Spazholio
May 12 2016 00:27
This message was deleted
Scott Leibrand
@scottleibrand
May 12 2016 00:27
The cyan ar2 cone in the future?
Paul Martin
@Spazholio
May 12 2016 00:28
Yes, I think that’s what it is.
Scott Leibrand
@scottleibrand
May 12 2016 00:28
heh. Of course there's a faq for that. ;-)
Paul Martin
@Spazholio
May 12 2016 00:28
Oh FFS, that’s even the name of the wiki article. =) No, I deleted my comment since I found this right after asking: http://www.nightscout.info/wp-content/uploads/2015/09/NS-site-diagram-FUNNELCAKE-printable_landscape-newinFC-1000px.png
Dana Lewis
@danamlewis
May 12 2016 00:29
perfect
Paul Martin
@Spazholio
May 12 2016 00:31
You guys rock. Thanks again. However, If possible I’d like to swing back around to my initial problem so I can get some data uploaded from my Pi? Have I missed something simple?
Dana Lewis
@danamlewis
May 12 2016 00:36
probably, or it’s part of what’s not documented (thus comments about PRs :)). what do you have so far?
Paul Martin
@Spazholio
May 12 2016 00:40
If I attempt to run openaps report invoke monitor/upload-status.json then I get (after lots of Python error code): AttributeError: 'Namespace' object has no attribute ‘clock’. However, I’m going through the setup.sh file you linked me to, and specifically in the nightscout section, I think I’m missing a few things. I’m going to re-run through that really quickly and see if that sorts things out. I don’t know that it will, because it’s not liking the whole ‘clock’ thing, so if you see anything right off the bat...
Paul Martin
@Spazholio
May 12 2016 00:47
Actually, since I started this whole thing off prior to me having the CGM, I’m wondering if I’d be better off just running the setup.sh from scratch and letting that get everything set up...
Dana Lewis
@danamlewis
May 12 2016 00:54
doesn’t hurt
Paul Martin
@Spazholio
May 12 2016 00:55
Agh. It’s setting up Azure-specific aliases. I self-host. Oh well, I’ll fix that later. =)
Scott Leibrand
@scottleibrand
May 12 2016 01:06
We self-host too. I think those are vestigial.
Check which branch of openaps-sh you're using. There are several for different setups.
Paul Martin
@Spazholio
May 12 2016 01:07
Looks like I should checkout the mmeowlink one, seeing as how I’m using that. Good call, thanks.
Dan Piessens
@dpiessens
May 12 2016 01:56
OK so here's what I do to upload BG:
upload-bg = ! bash -c "openaps latest-bg-records; ns-upload $NIGHTSCOUT_HOST $API_SECRET entries.json upload/glucose-zoned-recent.json"
zone-glucose = ! bash -c "openaps report invoke monitor/glucose-zoned-1.json && openaps report invoke monitor/glucose-zoned-2.json"
date-glucose = ! bash -c 'cat monitor/glucose-zoned-2.json | json -e "this.dateString=this.display_time" | json -e "this.sgv=this.glucose" | json -e "this.date=new Date(Date.parse(this.dateString)).getTime()"  > monitor/glucose-zoned.json'
latest-bg-records = ! bash -c "openaps zone-glucose; openaps date-glucose; openaps test-ns-bg-age; cat monitor/glucose-zoned.json | json -c \"this.date > '$(cat monitor/latest-ns-bg-time.json)'\" > upload/glucose-zoned-recent.json"
latest-ns-bg-time = ! bash -c "ns-get entries.json $NIGHTSCOUT_HOST | json -a date | sort -r | head -1 > monitor/latest-ns-bg-time.json"
oldest-cgm-bg-time = ! bash -c "cat monitor/glucose-zoned.json | json -a date | sort  | head -1 > monitor/oldest-cgm-bg-time.json"
test-ns-bg-age = ! bash -c "openaps latest-ns-bg-time; openaps oldest-cgm-bg-time; CGMVAL=$(json -f monitor/oldest-cgm-bg-time.json); NSVAL=$(json -f monitor/latest-ns-bg-time.json); test ${CGMVAL:-0} -gt ${NSVAL:-0} && openaps get-prep-older-bg-data"
get-prep-older-bg-data = ! bash -c "openaps report invoke monitor/glucose12hrs.json; cp -f monitor/glucose12hrs.json monitor/glucose.json; openaps zone-glucose; openaps date-glucose"


[report "monitor/glucose12hrs.json"]
device = cgm
use = iter_glucose
reporter = JSON
count = 400

[report "monitor/glucose-zoned-1.json"]
use = rezone
reporter = JSON
date = system_time
input = glucose.json
adjust = missing
device = tz

[report "monitor/glucose-zoned-2.json"]
use = rezone
reporter = JSON
date = display_time
input = monitor/glucose-zoned-1.json
adjust = replace
device = tz
@bewest I be interested in the bash commands that are manipulating json to see if there's a better way to cut down to the latest entries now
Paul Martin
@Spazholio
May 12 2016 02:00
@dpiessens My eyes are starting to cross, but I’m going to look that over later on.
Dan Piessens
@dpiessens
May 12 2016 02:01
@Spazholio Understood, I get that way too. This one is complex as it's trying to minimize upload so take some time and diagram out the commands on paper to understand the flow
Paul Martin
@Spazholio
May 12 2016 02:01
And while things appear to be moving nicely, I think I’m missing some data in NS. How does one get info from the pump itself into NS? Stuff like pump model number, IOB, etc. I thought I had a handle on that, but I’m missing that command.
Dan Piessens
@dpiessens
May 12 2016 02:03
@Spazholio if you create this report (remove things you don't use) and add the output to ns-upload it will add it
[report "upload/upload-status.json"]
suggested = enact/suggested.json
status = monitor/status.json
use = shell
reporter = JSON
battery = monitor/battery.json
clock = monitor/clock-zoned.json
json_default = True
reservoir = monitor/reservoir.json
device = ns-status
iob = oref0-predict/iob.json
enacted = enact/enacted.json
Paul Martin
@Spazholio
May 12 2016 02:04
@dpiessens Sounds good, thanks. Do you know where in the documentation that it shows part/all of that? I just want to make sure I didn’t miss an entire section or something.
Scott Leibrand
@scottleibrand
May 12 2016 02:06
This stuff is all new and still being documented.
Dan Piessens
@dpiessens
May 12 2016 02:07
Paul Martin
@Spazholio
May 12 2016 02:09
@scottleibrand @dpiessens Understood.
Is this still the right format for the ns-upload command: ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json upload/upload-status.json ?
ddaniels1
@ddaniels1
May 12 2016 04:12
I corrupted my RPI I think by unplugging it without shutting it down. I did back it up in bit bucket. What is the best way to restore my files?
Scott Leibrand
@scottleibrand
May 12 2016 04:17
What is corrupted?
ddaniels1
@ddaniels1
May 12 2016 04:17
ran the loop and failed. Here is output:
pi@raspberrypi:~/Documents/try5 $ openaps monitor-cgm
ns-glucose://text/shell/monitor/ns-glucose.json
reporting monitor/ns-glucose.json
Traceback (most recent call last):
File "/usr/local/bin/openaps-report", line 4, in <module>
import('pkg_resources').run_script('openaps==0.1.0', 'openaps-report')
File "/usr/local/lib/python2.7/dist-packages/setuptools-20.10.1-py2.7.egg/pkgresources/_init.py", line 719, in run_script
File "/usr/local/lib/python2.7/dist-packages/setuptools-20.10.1-py2.7.egg/pkgresources/_init.py", line 1504, in run_script
File "/usr/local/lib/python2.7/dist-packages/openaps-0.1.0-py2.7.egg/EGG-INFO/scripts/openaps-report", line 82, in <module>
app( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.1.0-py2.7.egg/openaps/cli/init.py", line 52, in call
self.epilog( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.1.0-py2.7.egg/EGG-INFO/scripts/openaps-report", line 69, in epilog
super(ReportToolApp, self).epilog( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.1.0-py2.7.egg/openaps/cli/init.py", line 75, in epilog
self.create_git_commit( )
File "/usr/local/lib/python2.7/dist-packages/openaps-0.1.0-py2.7.egg/openaps/cli/init.py", line 83, in create_git_commit
if self.repo.is_dirty( ) or self.repo.index.diff(None):
File "/usr/local/lib/python2.7/dist-packages/GitPython-2.0.2-py2.7.egg/git/repo/base.py", line 603, in is_dirty
len(self.git.diff('--cached', default_args)):
File "/usr/local/lib/python2.7/dist-packages/GitPython-2.0.2-py2.7.egg/git/cmd.py", line 459, in <lambda>
return lambda
args, kwargs: self._call_process(name, *args, kwargs)
File "/usr/local/lib/python2.7/dist-packages/GitPython-2.0.2-py2.7.egg/git/cmd.py", line 920, in _call_process
return self.execute(make_call(), **_kwargs)
File "/usr/local/lib/python2.7/dist-packages/GitPython-2.0.2-py2.7.egg/git/cmd.py", line 705, in execute
raise GitCommandError(command, status, stderr_value)
git.exc.GitCommandError: 'git diff --cached --abbrev=40 --full-index --raw' returned with exit code 128
stderr: 'error: object file .git/objects/4b/4764977bad7b647b6d49dd8cd63af69be538cd is empty
error: object file .git/objects/4b/4764977bad7b647b6d49dd8cd63af69be538cd is empty
fatal: loose object 4b4764977bad7b647b6d49dd8cd63af69be538cd (stored in .git/objects/4b/4764977bad7b647b6d49dd8cd63af69be538cd) is corrupt'
Scott Leibrand
@scottleibrand
May 12 2016 04:18
I would start with oref0-reset-git if it's git corruption. You shouldn't lose any of your files, just the git history (which you already backed up).
ddaniels1
@ddaniels1
May 12 2016 04:24
that worked to allow me to run the ns-glucose report, then tried to run the loop and failed:
settings/settings.json raised 'Pump' object has no attribute 'model'
Scott Leibrand
@scottleibrand
May 12 2016 04:27
Does it repeatedly fail? Do other pump queries work?
ddaniels1
@ddaniels1
May 12 2016 04:34
no and preflight continuously fails. It is right next to the pump
Scott Leibrand
@scottleibrand
May 12 2016 04:35
Check your pump.ini
ddaniels1
@ddaniels1
May 12 2016 04:35
the 'oref0-reset-git' you told me to try did fix the nightscout download report so think it must be corruption
It gives me the serial number
no model
can I do 'git pull'?
Scott Leibrand
@scottleibrand
May 12 2016 04:37
what about the expire time?
git pull shouldn't hurt, but not sure if it'll help.
ddaniels1
@ddaniels1
May 12 2016 04:40
what do you think is my Rpi corrupted or any other ideas?
ddaniels1
@ddaniels1
May 12 2016 04:48
expires = 2016-05-11T21:30:13.565410
model =
what does the expire time refer to?
I inspected my openaps.ini file and it all looks right
ddaniels1
@ddaniels1
May 12 2016 04:57
Since the configuration looks ok can I just re install openaps?
Scott Leibrand
@scottleibrand
May 12 2016 04:58
Expire time should be in the past, unless you've successfully initiated communication with the pump, in which case it should be a few minutes in the future. You can always delete the expires time if it's in the future to get openaps to try to init the pump again.
Are you using mmeowlink or carelink?
ddaniels1
@ddaniels1
May 12 2016 04:59
carelink
it was in the past
Scott Leibrand
@scottleibrand
May 12 2016 05:00
And does mm-stick warmup work or fail? Does your preflight do oref0-reset-usb if it fails?
ddaniels1
@ddaniels1
May 12 2016 05:01
no it fails and yes I have 'oref0-reset-usb '
Scott Leibrand
@scottleibrand
May 12 2016 05:02
If it's failing, is it doing a USB reset on preflight?
ddaniels1
@ddaniels1
May 12 2016 05:02
it did once
Scott Leibrand
@scottleibrand
May 12 2016 05:03
And is it still failing? Is it resetting USB every preflight?
ddaniels1
@ddaniels1
May 12 2016 05:04
just tried it as a solo command
pi@raspberrypi:~/Documents/try5 $ oref0-reset-usb
Power-cycling USB to fix dead Carelink stick
/usr/local/bin/oref0-reset-usb: 29: /usr/local/bin/oref0-reset-usb: cannot create /sys/devices/platform/soc/3f980000.usb/buspower: Permission denied
/usr/local/bin/oref0-reset-usb: 31: /usr/local/bin/oref0-reset-usb: cannot create /sys/devices/platform/soc/3f980000.usb/buspower: Permission denied
This seems very bad
Scott Leibrand
@scottleibrand
May 12 2016 05:08
Need sudo
ddaniels1
@ddaniels1
May 12 2016 05:10
ok that worked and stick warmup worked, well i think it did, it didn't give an error code anyway
ok, that worked, you rock!
Is the reason that didn't work in my loop because the preflight is the first thing in my loop and it is:
preflight ! bash -c "rm -f monitor/clock.json && openaps report invoke monitor/clock.json >/dev/null 2>/dev/null && grep -q T monitor/clock.json && echo PREFLIGHT OK || ( mm-stick warmup || sudo oref0-reset-usb; echo PREFLIGHT FAIL; sleep 120; exit 1 )"
Once it tries to run the monitor/clock.json it fails?
ddaniels1
@ddaniels1
May 12 2016 05:16
Would you recommend adding:
openaps alias add retry-loop '! bash -c "openaps preflight && until( ! mm-stick warmup || openaps loop); do sleep 5; done"'.
where do I put that exactly?
Scott Leibrand
@scottleibrand
May 12 2016 05:21
Let's focus on fixing your preflight's logic rather than adding new stuff.
ddaniels1
@ddaniels1
May 12 2016 05:22
all ears, what do you suggest?
Scott Leibrand
@scottleibrand
May 12 2016 05:23
Run through the logic. What happens if there is no clock.json?
This is the kind of stuff you can test out on the bash command line.
Scott Leibrand
@scottleibrand
May 12 2016 05:28
rm -f test.json && echo true || echo false
Try that with and without a test.json. (You can create one using touch test.json)
ddaniels1
@ddaniels1
May 12 2016 05:31
with or without a test.json I get "true"
Scott Leibrand
@scottleibrand
May 12 2016 05:32
Ok. If you want you can move on through each command on the preflight to see whether it returns true or false in each situation, and work out what the logic chain will try next in each case
And compare that to your logs of what actually happened to deduce which things were failing.
ddaniels1
@ddaniels1
May 12 2016 05:33
ok will try thanks
Scott Leibrand
@scottleibrand
May 12 2016 05:34
I'd be interested to know if you can tell from the logs whether it ever got to the point of trying a reset-usb (and echoing FAIL) in the loop.
It should have done that for you: you shouldn't have needed to run reset-usb manually.
I don't see an obvious error in your preflight, so it requires more debugging.
ddaniels1
@ddaniels1
May 12 2016 05:36
Can you explain why from the docs the preflight removes the clock.json and then re invokes it?
Scott Leibrand
@scottleibrand
May 12 2016 05:37
If you don't figure it out and ever get another instance where it is failing like that, you'll want to run the whole preflight alias manually and then run components of it until you figure out why it's not doing a reset.
ddaniels1
@ddaniels1
May 12 2016 05:37
is that just a command used to check for a response?
then --> echo preflight OK? that's what makes sense looking at it
Sorry, this is probably super obvious to you, but still learning this command line stuff
Scott Leibrand
@scottleibrand
May 12 2016 05:38
you always want to remove old stuff before refreshing it, so if the old stuff doesn't exist it can't act on old data. (Except for settings where that is ok)
Yes, invoking the clock report is done to see if the pump is alive.
Hristina Dimova
@xpucuto
May 12 2016 09:27
I have bought the Tecknet 9600 mah battery but it doesnt want to charge up while the pi3 and dexcom are connected . No matter what charger i use to plug it in the battery level never goes up , it stays the same. Last night my rig even died because of that and woke up with 300 :( Do you think the battery might be faulty or there is a trick i dont know about ?
Paul Martin
@Spazholio
May 12 2016 12:35
@xpucuto I’ve got the same situation with a Tecknet battery. It doesn’t seem to be drawing any more battery power, but it won’t charge either. I don’t think it’s faulty, but I think that’s how it’s designed to work, despite their claims.
Paul Martin
@Spazholio
May 12 2016 12:46
I’ve had the Pi plugged into mine and had it charging for 24 hours - no change in battery level.
Bill Stackpole
@billstackpole
May 12 2016 12:57
May be a day late and a dollar short, but I'm using the Zendure A3 10,000 mAh battery and it is working very well for me (pass thru charging, works for 13+ hrs and still indicates approx 1/2 power available, etc).
Hristina Dimova
@xpucuto
May 12 2016 12:58
@Spazholio do you have wired Dexcom to the pi ? I guess this might be the problem .
@billstackpole thanks , I saw your earlier post about the zendure. I was wondering for along time . How do u upload CGM data ?
Paul Martin
@Spazholio
May 12 2016 13:00
@billstackpole But does the power level ever go back up once it’s gotten to halfway? I’m wondering if Tecknet’s “passthru” means “won’t charge the battery, but won’t drain it either”.
@xpucuto I don’t have the wired Dexcom connected to the Pi right now. Haven’t all night either.
Bill Stackpole
@billstackpole
May 12 2016 13:06
While the way I'm doing it now works, I'm not completely happy w/performance and reliability. Current am using the Carelink with Enlight sensor uploading to the Carelink website via the Medtronic Connect. Lots of moving parts and anytime I lose bluetooth to the Connect (once/day?) I have to restart the Medtronic app (which acts as the uploader to the Medtronic site from which my mongoDB gets its data). This leaves "holes" in my data stream so the NS instance doesn't have consistent and continuous data.
I Intend to move to uploading to mongo directly from the RasPi (OpenAPS) as it's already pulling the data from the sensor, using the Medtronic Connect as a backup path to populate the mongoDB. Further down the road I am likely to move from the Enlight to the Dexcom. Thinking a G5 as I have read that it uses bluetooth as well but can connect directly to my phone and I won't have to carry the Dexcom receiver object.
Not looking forward to rebuilding from scratch, but think I'm going to do so anyway both for the practice as well as to see how the instructions have changed, so that I can ensure that I don't miss any new options and such.
Hristina Dimova
@xpucuto
May 12 2016 13:12
@Spazholio so my dexcom receiver is not the problem, the battery is. I bought it from the German amazon and Tecknet customers service have already contacted me to see if i am happy with my purchase. I will see what hey thave to say about this.m
@billstackpole so far the main problem with G5 is the cost. I love the idea of cgm data uploading trough my phone but the expences are more than double for the G5 comparing to the G4( which i am curently using) .
Bill Stackpole
@billstackpole
May 12 2016 13:14
@Spazholio - I recharge from a 2amp charger designed for an iPad, plug it in overnight, and the battery charges while simultaneously running the Pi. (short answer: yes - it recharges to 100% overniht while running)
Hristina Dimova
@xpucuto
May 12 2016 13:17
Zendure is my new favorite. Thank you @billstackpole
Bill Stackpole
@billstackpole
May 12 2016 13:18
@xpucuto - I suffer from what many of us suffer from - I call it "device burden". Many items to carry (pump/sensor/meter/spare supplies/etc) so I'm looking to reduce the number. When I had to make a decision about my CGM the major reason I chose the Medtronic was because the CGM receiver is built into the pump (as opposed to the Dexcom at the time requiring the additional receiver to be carried in order to display the CGM data - e.g. no integration by Dexcom with my pump, and full integration between Medtronic and their CGM -- with only the pump and the CGM required to collect data)
Hristina Dimova
@xpucuto
May 12 2016 13:22
@billstackpole i trully understand you but for openaps i am ready to wear a big packpack for the freedom and the control it gives me. After i finish my TI rig , my next project will be Edison or RIleylink . In this relation i cant wait for the meeting on 26th to see other peoples minimized rig
Bill Stackpole
@billstackpole
May 12 2016 13:25
I have the parts and pieces for an Edison rig in hand - just need time to build / configure / troubleshoot. Going to build at least two more Pi's first though (so I have one to carry, one at home, and a spare). The one thing I'm struggling with is the balance between LiPo and other types of battery packs. (Don't want a fire from a battery in my pocket <smile>)
Hristina Dimova
@xpucuto
May 12 2016 13:28
Time and sleep and the two things i dont get enough
Jarred Yaw
@jyaw
May 12 2016 13:54
Haven't dug into any of the code yet... Does openaps use dexcom raw data and noise from the NS site that I would miss out on (I am using an iphone right now, probably switch to android next month)?
William Fallon
@inform880
May 12 2016 14:02
Thank you everybody, I just had an endo appointment and my A1C was 6.6, a drop from 7 from 4 months ago. I also got a chance to explain how openaps works to 2 nurses, who were very interested in how openaps works. That's with openaps after 2 months. Thanks again.
@jyaw no, openaps itself does not use raw, if that's what you're asking.
Jarred Yaw
@jyaw
May 12 2016 14:04
@inform880 Thanks! That's awesome about your A1C. I'm pretty similar, run a 7, but just started building my rig. Looking to push down towards 6!
Jason Curry
@mccgm
May 12 2016 14:06
My SD card just died :worried:
I'm down and my "backup" isn't working
This sucks, and it's probably better in the end, but I'm starting from page 1
Stamfordmike
@stamfordmike_twitter
May 12 2016 14:25
Guys new to this after reading the WSJ article, seems techy and a west coast thing, is it worth the time for a 9 yr old who's had diabetes for 6mths and on the Omnipod w/ no cgm, just a dad trying to make my sons life better
Jason Curry
@mccgm
May 12 2016 14:44
@stamfordmike_twitter If you are obsessive about it and have some technical aptitude, you can do it. If you like the idea of overnight BG of 100 plus or minus 10, it's worth it.
If you aren't using Nightscout, I recommend starting there.
Paul Martin
@Spazholio
May 12 2016 14:54
I am having a bear of a time getting anything to upload to NS. I have the Dexcom Share info in there now, but no matter what I try, I can't seem to get info from my pump (battery level, iob, etc) to upload, and there aren't any error messages to tell me what I've done wrong. I've set up the scripts from here https://github.com/scottleibrand/openaps-sh/blob/master/setup.sh#L113 and tried to use the ns-upload tool to no avail. Once I've run the setup.sh script, everything appears to be created properly, and I've run what I think are the appropriate reports, but nothing uploads. Can anyone shed some light on what else might need doing? I'm hapy to provide any links or output that might help diagnose.
Specifically, I was trying to use the ns-upload command from http://openaps.readthedocs.io/en/dev/docs/walkthrough/phase-1/visualization.html.
JaysonEwer
@JaysonEwer
May 12 2016 15:08
Did you enable the variables in your NS site? I forget, are you using a local server or using azure?
Paul Martin
@Spazholio
May 12 2016 15:12
I'm using local, and I believe I have. export ENABLE="rawbg iob openaps pump careportal bridge"
The issue is, none of the methods I've read to actually invoke ns-upload seem to function.
I'm sure I'm missing something, I just don't know what it is.
JaysonEwer
@JaysonEwer
May 12 2016 15:13
So your pills are appearing in you NS site, they are just not being populated with data yet, is that correct?
Paul Martin
@Spazholio
May 12 2016 15:15
Correct.
JaysonEwer
@JaysonEwer
May 12 2016 15:17
Where do you have your secret defined? In your crib or in environment variable?
Cron
Paul Martin
@Spazholio
May 12 2016 15:17
Screenshot_20160512_111649.png
Environment variable.
And I verified that when I echo $API_SECRET it's the right value.
JaysonEwer
@JaysonEwer
May 12 2016 15:19
Did you use the hashed version of your API_Secret?
Paul Martin
@Spazholio
May 12 2016 15:21
I...might not be. Standby.
Paul Martin
@Spazholio
May 12 2016 15:28
Ok, I wasn't. Rookie mistake. =) So I've fixed that, but still no go.
Does NS have a logfile I can tail or something to see what it has to say about what I'm attempting?
JaysonEwer
@JaysonEwer
May 12 2016 15:32
Are you including """ or no quotes?
In other words when you echo your hash now does it include quotes?
Also when you run the NS-upload command what does the output look like?
@Spazholio BTW, I hope you documented everything well on your stand alone server, I might be interested in setting that up myself. 😎
Paul Martin
@Spazholio
May 12 2016 15:37
Wait wait wait...I want clarify something. On my NS install, how is the API_SECRET value initially determined? I set it up a month or so ago, so I forgot. Isn't it a hashed version of a password already or something like that?
Bill Stackpole
@billstackpole
May 12 2016 15:38
@Spazholio - pretty sure it is an arbitrary length string (longer is better) defined by you. Can be a hash if you like, but could also be any continguous string that you select.
Pretty sure that spaces are NOT allowed (not sure if you could escape them if you wanted to)
Dana Lewis
@danamlewis
May 12 2016 15:39
@stamfordmike_twitter most people find it worthwhile. It does require wearing a CGM, though.
JaysonEwer
@JaysonEwer
May 12 2016 15:41
For me it is a standard password in my azure website that I ended up taking the hashed version of and added it to my API_Secret variable on my pi which the NS-upload uses to authenticate the data being added to the database.
Paul Martin
@Spazholio
May 12 2016 15:41
Ok, I'm checking something. I think I created the API_SECRET on the NS install by just hashing a password.
So it looks like a fairly standard API string.
Now on the Pi, I need to hash that AGAIN in order to use it to communicated with NS?
JaysonEwer
@JaysonEwer
May 12 2016 15:42
Yep
Paul Martin
@Spazholio
May 12 2016 15:42
Ok, cool.
I mean, it's not working still, but I've wrapped my head around it a bit more.
@JaysonEwer There is no difference in the resulting hash whether I quote it or not.
And if you could give me the proper format for the ns-upload command, I would be incredibly grateful.
JaysonEwer
@JaysonEwer
May 12 2016 15:45
I was burned by having my hashed secret in quotes in my crontab, as soon as I removed the quotes it worked, I also need to make sure I had the path set correctly for the NS-upload binary in my crontab.
Bill Stackpole
@billstackpole
May 12 2016 15:46
@Spazholio - from my openaps.ini: '''
whoops
wait one...
'''
upload-recent-treatments = ! bash -c "openaps format-latest-nightscout-treatments && test $(json -f upload/latest-treatments.json -a created_at eventType | wc -l ) -gt 0 && (ns-upload $NIGHTSCOUT_HOST $API_SECRET treatments.json upload/latest-treatments.json ) || echo \"No recent treatments to upload\""
status-upload = ! bash -c "openaps report invoke monitor/upload-status.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json monitor/upload-status.json"
'''
if you have devicestatus.json and monitor/upload-status.json in place, AND the two environment variables $NIGHTSCOUT_HOST and $API_SECRET correctly set, the command starting at "ns-upload..." should send the data to your NS instance.
(from the command line)
(the quotes above should have been backtics - sometimes I am confused <smile>)
like this:
upload-recent-treatments = ! bash -c "openaps format-latest-nightscout-treatments && test $(json -f upload/latest-treatments.json -a created_at eventType | wc -l ) -gt 0 && (ns-upload $NIGHTSCOUT_HOST $API_SECRET treatments.json upload/latest-treatments.json ) || echo \"No recent treatments to upload\""
status-upload = ! bash -c "openaps report invoke monitor/upload-status.json && ns-upload $NIGHTSCOUT_HOST $API_SECRET devicestatus.json monitor/upload-status.json"
Paul Martin
@Spazholio
May 12 2016 15:56
I don't have devicestatus.json and have no idea what it contains, nor how to generate it. =/
The docs seem to indicate that this file is generated BY the ns-upload command, rather than being required by it.
The openaps.ini I'm currently using is the one that's generated by this script: https://github.com/scottleibrand/openaps-sh/blob/master/setup.sh
Scott Leibrand
@scottleibrand
May 12 2016 16:00
devicestatus.json is an API endpoint on NS, not a file.
Paul Martin
@Spazholio
May 12 2016 16:00
ohthankgod
I thought I was losing my mind. I mean, the uploads still aren't working, but at least I'm moderately sane.
Bill Stackpole
@billstackpole
May 12 2016 16:01
Ah - so the devicestatus.json is the file that is CREATED on NS by the ns-upload command - sorry for the misdirection.
Scott Leibrand
@scottleibrand
May 12 2016 16:01
@jyaw it is possible to use dexcom raw data for some things (like calculating BG during sensor startup): see oref0-raw. But we currently don't pull raw calibration records from the Dexcom: @jasoncalabrese only uses it with xDrip data from NS.
@billstackpole it's not a file there either. It's a URL used for uploading to the devicestatus collection in the DB.
@Spazholio are you running the uploads from command line or from cron?
Paul Martin
@Spazholio
May 12 2016 16:03
@scottleibrand CLI. Not even close to setting up cronjobs yet.
Scott Leibrand
@scottleibrand
May 12 2016 16:04
The way the API endpoints work, you could also use devicestatus.csv if you want, for example to read the data from that collection on CSV format.
@Spazholio ok, so no environment variable worries then. What do you get when you run ns-upload manually?
Paul Martin
@Spazholio
May 12 2016 16:07
Well, at this point, I'm having trouble generating the upload/upload-status.json file. I had it at one point, but it seems that it got deleted while running some of the aliases trying things out. Now when I attempt to generate it, I'm getting BG data is too old, or clock set incorrectly Thu May 12 2016 11:13:15 GMT-0400 (EDT) so I'm troubleshooting that now.
And while I know it's asking for a bit of handholding here, since I'm using the setup.sh from your repo, do you have a recommendation for an order of commands to issue in order to make sure everything's run in the right sequence? I can certainly track it down, but if you have it handy or know it off the top of your head...
Scott Leibrand
@scottleibrand
May 12 2016 16:09
Look at the bottom at what cron runs. You can run that manually, or look at what it runs and run the component aliases one by one.
Paul Martin
@Spazholio
May 12 2016 16:12
Ok, looks like it essentially just invokes openaps loop. Checking that out now.
Ok, the loop seems to need iob.json which is perpetually missing. It seems to keep getting deleted...
Scott Leibrand
@scottleibrand
May 12 2016 16:14
It's supposed to get deleted and then get refreshed every run.
By the rm -f monitor/* or whatever it is.
Paul Martin
@Spazholio
May 12 2016 16:15
It's not getting refreshed during the run. I just manually ran the report, then ran openaps loop and it's still complaining that it's not there.
Scott Leibrand
@scottleibrand
May 12 2016 16:16
So you're missing an input file then. Run the component aliases of loop one by one to see what is failing.
And check the input files of the report that fails if it's not a pump query.
Paul Martin
@Spazholio
May 12 2016 16:18
It's at openaps enact that fails. Doesn't have the iob.json file. I'll dig into the alias.
preflight, gather, and get-settings all ran without error.
Scott Leibrand
@scottleibrand
May 12 2016 16:27
You can also try running the iob.json report and see what it complains about.
Paul Martin
@Spazholio
May 12 2016 16:29
Ok, added the required reports to the get-settings alias. It was missing something like 3 that were required to generate the upload/upload-status.json file. That file is generated properly now, but the ns-uploadcommand still doesn't upload. No output, no error, no nothing.
ericmtx
@ericmtx
May 12 2016 16:33
@Spazholio make sure the Care Portal is enabled on your Nightscout site (though you'd get an error if that wasn't the case).
@Spazholio I remember now I had the same issue with ns-upload having no output/error. The problem was my nightscout site and api secret weren't properly set in the environment variables (forget what that's called Linux). Where you set the export of those terms in your profile so they're picked up by this command.
I tried hard-coding those variables instead of using the $API... and it worked, so I worked back from there.
Paul Martin
@Spazholio
May 12 2016 16:37
@ericmtx Well, I just double checked the values, but I'll give hard coding a shot. Good idea.
Paul Martin
@Spazholio
May 12 2016 16:45
Ok, just tried hardcoding, and I'm getting the same result. It almost instantaneously goes to the next line with no status/error message. It feels like there's not even enough time for it to go out to the NS install and try.
Scott Hanselman
@shanselman
May 12 2016 16:46
@scottleibrand @danamlewis @jasoncalabrese Is one of you available right now? I'm on the phone with Intel
Paul Martin
@Spazholio
May 12 2016 16:47
In my /var/log/user.log and /var/log/syslog it just says "pi: Unable to upload to <my site>". Now, my site also has a port number - does that matter?
Jason Calabrese
@jasoncalabrese
May 12 2016 16:55
I am if Scott and/or Dana isn't
Scott Hanselman
@shanselman
May 12 2016 17:00
@jasoncalabrese just DM'ed you. Or you can call my cell after and I can share what they said
JaysonEwer
@JaysonEwer
May 12 2016 17:05
Is Intel building an OpenAPS pump for us? 😀
Dana Lewis
@danamlewis
May 12 2016 17:07
@shanselman yes
Paul Martin
@Spazholio
May 12 2016 17:13
ARGH. Ok, so my NS has HTTPS. I'm using a letsencrypt cert, but apparently it's not being recognized as valid. So adding a -k flag to all the curl commands I could find in the /usr/local/bin/ns-* files fixed it. Who maintains those tools? I'd like to make a suggestion. =)
Scott Hanselman
@shanselman
May 12 2016 17:20
@Spazholio sounds like it's missing a intermediate cert in the chain
Scott Leibrand
@scottleibrand
May 12 2016 17:29
Unless you're using the old beta LE certs, curl should validate your cert if it's installed properly. Do you get a green lock icon if you try the URL in chrome?
Paul Martin
@Spazholio
May 12 2016 17:30
@shanselman Yeah, I had to replace cert.pem with fullchain.pem in my NS setup.
I always got a green lock, yes.
Scott Leibrand
@scottleibrand
May 12 2016 17:31
Wonder if the browser vendors added trust for LE's CA cert directly. Is it working now with fullchain.pem?
Paul Martin
@Spazholio
May 12 2016 17:33
@scottleibrand It appears to be, yes. The fields in NS populated the first time. Although - while the upload seems to be working fine - they fields aren't updating with subsequent uploads. Says that the last time I uploaded was 28 mins ago, when it was actually closer to 2 mins.
And from what I understand, all browsers are now fully supporting the LE certs.
@scottleibrand Using your setup.sh, does the way that loop run assume that the Dexcom is always plugged into the Pi? Not a big deal if so, it just seems to get a little wiggy and stop running if I unplug it...
Scott Leibrand
@scottleibrand
May 12 2016 17:36
Depends on which branch you're using. Some are setup to download BG from NS if CGM isn't plugged in.
Dana Lewis
@danamlewis
May 12 2016 17:36
No, see the version I posted last night, l133 shows looking at NS for BGs and failing over
Scott Leibrand
@scottleibrand
May 12 2016 17:36
Check the get-bg alias.
Paul Martin
@Spazholio
May 12 2016 17:36
I'm using the mmeowlink version.
Checking...
Ok, so if I'm reading this right, I either need to have the CGM plugged in or I need to have internet connectivity...correct? That way it can either pull BG info from the device or NS, right?
Dana Lewis
@danamlewis
May 12 2016 17:40
Correct. Or third option to use openxshareble
Paul Martin
@Spazholio
May 12 2016 17:44
Ok, cool. Last question - I'm looking through the devicestatus.json that gets returned from NS when I issue the ns-upload command manually, and I see something that might be concerning, but I'm not the best at deciphering what it means. I see an error and a missing field, but I'm not sure what to make of them:
[
  {
    "pump": {
      "battery": {
        "status": "normal",
        "voltage": 1.34
      },
      "status": {
        "status": "normal",
        "timestamp": "2016-05-12T16:25:59.000Z",
        "bolusing": false,
        "suspended": false
      },
      "reservoir": 244.3,
      "clock": "2016-05-12T12:21:03-04:00"
    },
    "openaps": {
      "suggested": {
        "bg": 142,
        "temp": "absolute",
        "snoozeBG": 114,
        "timestamp": "2016-05-12T16:22:25.000Z",
        "reason": "Eventual BG 114>90 but Delta -5 < Exp. Delta -4.3; no temp to cancel",
        "eventualBG": 114,
        "tick": -5
      },
      "iob": {
        "timestamp": "2016-05-12T16:25:58.000Z",
        "bolusiob": 0.0086000317333332,
        "iob": 1.2853598817167,
        "activity": 0.037644620811287
      },
      "enacted": {
        "bg": 112,
        "temp": "absolute",
        "missing": [
          "duration",
          "rate"
        ],
        "timestamp": "2016-05-12T01:57:01.000Z",
        "snoozeBG": 116,
        "reason": "Eventual BG 93>90 but Delta -1 < Exp. Delta -0.5; no temp to cancel",
        "eventualBG": 93,
        "error": "missing required input fields",
        "input": {
          "bg": 112,
          "temp": "absolute",
          "snoozeBG": 116,
          "reason": "Eventual BG 93>90 but Delta -1 < Exp. Delta -0.5; no temp to cancel",
          "eventualBG": 93,
          "tick": -1
        },
        "tick": -1
      }
    },
    "created_at": "2016-05-12T17:41:41.674Z",
    "_id": "5734c0550cd869a41f231b6d"
  }
]
live4sw
@live4sw
May 12 2016 17:46
Quick question - do you guys set a periodic reboot in your cron?
Dana Lewis
@danamlewis
May 12 2016 17:50
@Spazholio there's no temp to cancel, so there's no duration and its flagged as missing. Not a problem, though
Paul Martin
@Spazholio
May 12 2016 17:52
@danamlewis Ok, cool. Just wasn't sure if I should be concerned. Still perplexed as to why NS isn't updating. I mean, the "reservoir" entry in the JSON I just posted is different than what I'm showing in NS. And that JSON doesn't look like a "hey, something's wrong!" status, but rather a "success" status, so I'm a little stymied. Shouldn't NS update with every upload?
Dana Lewis
@danamlewis
May 12 2016 17:53
How long has it been? Or are you saying you haven't successfully had an upload at all?
Paul Martin
@Spazholio
May 12 2016 17:54
No, I had one successful upload. But nothing in NS (pump status-wise) has updated since. Shows 52 mins now, and I've run both the entire openaps loop, the singleopenaps upload command, and the ns-upload manual command several times. They appear to be successful, but...
Oh damn it all, NOW it seems to have uploaded. Maybe it only works every 9th time? headdesk
Ben West
@bewest
May 12 2016 20:10
are you trying to upload to nightscout?
Paul Martin
@Spazholio
May 12 2016 20:17
@bewest I am, yes. And it appears to be working. I just got home, so I’ll give it another shot just to make sure...
Paul Martin
@Spazholio
May 12 2016 20:27
Actually, the upload seems to be NOT working again, for some reason. And occasionally, I’ll get this error message right at the end of the loop (I haven’t really dug in to see why though):
reporting monitor/status.json
determine-basal://text/shell/enact/suggested.json
{"delta":-4,"glucose":73,"avgdelta":-3.6666666666666665}
{"duration":30,"rate":0,"temp":"absolute"}
{"iob":0.14782465486888893,"activity":0.004414902998236331,"bolusiob":0}
{"max_iob":5,"type":"current","dia":3,"current_basal":1.8,"max_daily_basal":2.2,"max_basal":6,"min_bg":90,"max_bg":100,"sens":20}
reporting enact/suggested.json
{"temp":"absolute","bg":73,"tick":-4,"eventualBG":60,"snoozeBG":60,"reason":"Eventual BG 60<90, no temp, setting -1.7U/hr","duration":30,"rate":0}
pump://JSON/set_temp_basal/enact/enacted.json
reporting enact/enacted.json

undefined:2
if(this.duration === this.requested.duration){ this.recieved = true }
                                   ^
TypeError: Cannot read property 'duration' of undefined
    at Object.eval (eval at main (/usr/local/lib/node_modules/json/lib/json.js:1283:27), <anonymous>:2:36)
    at parseChunk (/usr/local/lib/node_modules/json/lib/json.js:1482:29)
    at /usr/local/lib/node_modules/json/lib/json.js:1371:13
    at Socket.<anonymous> (/usr/local/lib/node_modules/json/lib/json.js:713:13)
    at Socket.emit (events.js:117:20)
    at _stream_readable.js:929:16
    at process._tickCallback (node.js:419:13)
Uploaded
Scott Leibrand
@scottleibrand
May 12 2016 20:32
ah, yes. that means that the upload script doesn't like the data with the missing duration and rate fields
are you on oref0 master (the version you get from quick-packages.sh), or dev (from quick-src.sh)?
pretty sure we fixed that in a more recent version of oref0, most likely the dev branch. on earlier versions, the workaround was to add a check to your enact script that looked for a duration in the suggested.json and only did an enact if it found one. something like grep -q duration enact/requested.json &&
Paul Martin
@Spazholio
May 12 2016 20:35
It seems that I’m missing the enact/enacted.json during the loop. When I generate it manually, it’s succeeding, but something’s wonky in the loop (I think). And I don’t know which one I’m on. Is that what provides the ns-* tools? I could always just reinstall those if that’ll fix the issue.
Scott Leibrand
@scottleibrand
May 12 2016 20:35
do you have a ~/src/oref0 directory?
Paul Martin
@Spazholio
May 12 2016 20:35
Nope.
Scott Leibrand
@scottleibrand
May 12 2016 20:35
ok, then you're using the packaged version from master.
if enact/enacted.json is completely missing, you might have done something in your loop to delete it, which you probably don't want. (you do want to delete the input files in the monitor/ directory, though, and the suggested.json)
Paul Martin
@Spazholio
May 12 2016 20:39
Well, the file is there, but it’s zero-length. And I’m using the stuff that your setup.sh, but haven’t really modified anything there (except for a few missing reports in get-settings). I don’t feel comfortable enough messing with it on my own just yet. =)
The enact alias I have is a little more complex (probably because I’m using the mmeowlink branch) but it appears to have the grep -q duration enact/requested.json line already. Odd.
Scott Leibrand
@scottleibrand
May 12 2016 20:45
you might want to play around with running the enact manually and see what it does under different conditions. I don't remember what might cause you to get a zero-byte enacted.json, but it's probably some sort of mmeowlink / comms failure.
Ben West
@bewest
May 12 2016 20:45
I would try simplifying it
also try updating mmeowlink
Paul Martin
@Spazholio
May 12 2016 20:45
I re-added the alias from here, but get the same result: https://github.com/scottleibrand/openaps-sh/blob/mmeowlink/setup.sh#L163
If I run the report manually, it works fine.
Jason Curry
@mccgm
May 12 2016 20:46
Again
fatal: bad object HEAD
fatal: Could not parse object 'HEAD'.
fatal: bad object HEAD
fatal: bad object HEAD
Again
fatal: bad object HEAD
fatal: Could not parse object 'HEAD'.
fatal: bad object HEAD
Anyone know what is going on with this?
Ben West
@bewest
May 12 2016 20:46
ah, git corruption
Scott Leibrand
@scottleibrand
May 12 2016 20:46
You should be running oref0-reset-git in cron probably
Ben West
@bewest
May 12 2016 20:47
looks like the fix script has already attempted
Paul Martin
@Spazholio
May 12 2016 20:47
@bewest My mmeowlink is up to date - just checked.
Jason Curry
@mccgm
May 12 2016 20:47
Yeah, I'm trying to "uncorrupt" script
Ben West
@bewest
May 12 2016 20:47
I think we should remove the reset-git advice
Scott Leibrand
@scottleibrand
May 12 2016 20:47
it's actually perfect for this case
if the uncorrupt script can't fix it, it will time out and reset
Ben West
@bewest
May 12 2016 20:47
hmm, the problem is that it's very distructive
Scott Leibrand
@scottleibrand
May 12 2016 20:47
maybe for interactive use you can do better, but that's the most reliable way to keep a loop up and running
Ben West
@bewest
May 12 2016 20:47
maybe it ould save things in a backup area
Scott Leibrand
@scottleibrand
May 12 2016 20:48
I think it might do that: move stuff to /tmp/
Ben West
@bewest
May 12 2016 20:48
thing is, we need to solve this issue
and if I can't get debug details on it, it'll never get solved
Ben West
@bewest
May 12 2016 20:48
like, maybe the fix script could be patched
Jason Curry
@mccgm
May 12 2016 20:48
My sd card was burning hot and cracked this morning....Starting over. If I just let it continue with the fail, it will time out and then what?
Ben West
@bewest
May 12 2016 20:48
ok
Scott Leibrand
@scottleibrand
May 12 2016 20:48
could pick another place to move it that doesn't get wiped on reboot if you like
Ben West
@bewest
May 12 2016 20:49
ah, yeah, maybe /var/cache/openaps-backup or something
maybe install or something creates that location
ruination
also, if anyone has battery monitoring working
need integrated power management for that
but that's another way to solve this
make it shutdown when dangerously low
Scott Leibrand
@scottleibrand
May 12 2016 20:50
or just mkdir -p /var/cache/openaps-backup; mv .git /var/cache/openaps-backup/.git-date +%s&& openaps init .
Ben West
@bewest
May 12 2016 20:50
might be a permission issue initially is the thing
just to mkdir
at this point ,we can also investigate import -l and show --json and friends
Scott Leibrand
@scottleibrand
May 12 2016 20:51
I think most people run their loop as a user with sudo perms, so we could do sudo mkdir
anyway, we're already saving it to /tmp/, so we can use that for investigation
Jason Curry
@mccgm
May 12 2016 20:53
So...question. Am I looking at a fresh install of OpenAPS?
Ben West
@bewest
May 12 2016 20:53
no
oref0-reset-git
openaps init .
Scott Leibrand
@scottleibrand
May 12 2016 20:54
it should do the latter for you
Ben West
@bewest
May 12 2016 20:54
do you have an openaps import -l?
Jason Curry
@mccgm
May 12 2016 20:55
Oh. Ok, so I should be able to work oref0-reset-git into my cron then? How frequently?
No, I don't have an import
Jason Curry
@mccgm
May 12 2016 21:01
Clearing the room....Like I do :unamused:
Scott Leibrand
@scottleibrand
May 12 2016 21:03
Yes, I run oref0-reset-git every minute in cron.
Ben West
@bewest
May 12 2016 21:13
I just patched it to accept a custom location for backups
Paul Martin
@Spazholio
May 12 2016 21:19
Can I get a quick ’n dirty explanation as to what oref0-reset-git actually does and why it’s recommended to run every minute?
Ben West
@bewest
May 12 2016 21:23
it runs oref0-fix-git-corruption
there's a bug in fix-git-corruption that can result in loop, looks like
so the tool watches for that vs success
if the fix tool works it just stops and does nothing
if git is still broken, it moves the .git directory to another location and re-initializes git
I wouldn't run it every minute, probably, different people have different styles
mine is a bit simpler, I only run one cron job, once every five minutes
you could alternatively put it at the beginning or end of your loop, existing alias
Jason Curry
@mccgm
May 12 2016 21:32
Thanks so much!
Scott Leibrand
@scottleibrand
May 12 2016 21:37
if git is not corrupted (git status returns ok) then oref0-reset-git does nothing. so it's safe to run as often as you like
Ben West
@bewest
May 12 2016 23:09
there's a pretty good intro video on github for beginners here http://thegovlab.org/github-for-government/