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

9th
Mar 2016
Jason Calabrese
@jasoncalabrese
Mar 09 2016 02:26
@scottleibrand in https://github.com/scottleibrand/Adafruit_Python_BluefruitLE/blob/master/README.md#linux--raspberry-pi-requirements it says "For the Intel Edison, you'll need to edit init.d/bluetooth", I don't see that in /etc/init.d/, maybe I didn't install something?
also trying /usr/local/bin/bluetoothd --experimental from the shell gives this
D-Bus setup failed: Connection ":1.4" is not allowed to own the service "org.bluez" due to security policies in the configuration file
Scott Leibrand
@scottleibrand
Mar 09 2016 02:41
You have to apt-get install dbus. Maybe python-dbus?
Lots of clues in
adafruit/Adafruit_Python_BluefruitLE#8
tazitoo
@tazitoo
Mar 09 2016 02:53

apt-cache search python-dbus

python-dbus - simple interprocess messaging system (Python interface)
python-dbus-dbg - debug build of the D-Bus Python 2 interface
python-dbus-dev - main loop integration development files for python-dbus
python-dbus-doc - Documentation for the D-Bus Python interface
python-dbus.mainloop.pyqt5 - D-Bus Support for PyQt5 with Python
python-dbus.mainloop.pyqt5-dbg - D-Bus Support for PyQt5 (debug extensions for Python)
python-dbusmock - mock D-Bus objects for tests (Python 2)
python3-dbusmock - mock D-Bus objects for tests (Python 3)
Sorry - got to get the hang of markdown/gitter...
amoskane
@amoskane
Mar 09 2016 03:25
I just got this far, and I’m not really looking to delete anything , and nothing comes up when I google rm -f or even -f … ??
Scott Leibrand
@scottleibrand
Mar 09 2016 03:26
Google treats -f as "don't show me anything with the keyword f"
amoskane
@amoskane
Mar 09 2016 03:26
ha!
google is linux.
Scott Leibrand
@scottleibrand
Mar 09 2016 03:26
type "man rm" to read the full manual page
-f means force
That command removes the contents of those three subdirectories.
amoskane
@amoskane
Mar 09 2016 03:27
huh. why would I want to remove the files I just created?
Scott Leibrand
@scottleibrand
Mar 09 2016 03:27
Idea is you don't want to take action on old data
so you do that right before you refresh it.
And that guarantees you can't do anything unless you successfully refresh.
amoskane
@amoskane
Mar 09 2016 03:29
aha, TY
Scott Leibrand
@scottleibrand
Mar 09 2016 03:29
Pre-oref0, we had some issues with the loop getting stuck and reissuing the same temp over and over.
This guarantees that can't happen, as long as the rm succeeds.
amoskane
@amoskane
Mar 09 2016 03:30
Another one of those things I would have known if I’d made it through a 100 level comp sci class...
TY
Scott Leibrand
@scottleibrand
Mar 09 2016 03:39
Hehe
amoskane
@amoskane
Mar 09 2016 03:44
ok, I’m in a situation where I know there’s a bad reference to monitor/glucose.json and I need to change it to monitor/glucoseclean.json
if I just rerun a report add command, will that overwrite that report? In effect, “editing” it?
Scott Leibrand
@scottleibrand
Mar 09 2016 03:46
I believe that will work.
If not it will complain
and you can just do a remove and then add
I know you can overwrite aliases that way, but not devices. Don't remember for sure about reports.
amoskane
@amoskane
Mar 09 2016 03:48
it ran! ok, aliases=yes, devices=no, reports = not sure. TY
Scott Leibrand
@scottleibrand
Mar 09 2016 03:49
If it ran, then reports=yes
Eric Luhrs
@eluhrs
Mar 09 2016 05:30
Hi, all. Is anyone able to give me a hand with a corruption issue? openaps gather is giving me this error:
fatal: loose object e00ea165143f5a30457b313fb7af102cb160e7c5 (stored in .git/objects/e0/0ea165143f5a30457b313fb7af102cb160e7c5) is corrupt'
I tried git reset, but it gives me''' pi@raspberrypi:~/wopr $ git reset
error: object file .git/objects/e0/0ea165143f5a30457b313fb7af102cb160e7c5 is empty
error: object file .git/objects/e0/0ea165143f5a30457b313fb7af102cb160e7c5 is empty
fatal: loose object e00ea165143f5a30457b313fb7af102cb160e7c5 (stored in .git/objects/e0/0ea165143f5a30457b313fb7af102cb160e7c5) is corrupt
Eric Luhrs
@eluhrs
Mar 09 2016 05:52
Okay, well I fixed it with oref0-reset-git. But I'm not sure why it happened.
My loop had been working fine for a while, but then I took my rig out of my house for the first time, which means it had to connect over cellular instead of wifi. This doesn't seem related to me, so maybe it was just a coincidence. Any insight from others is welcomed.
William Fallon
@inform880
Mar 09 2016 13:17
@eluhrs I have so much trouble with corruption that I check for corruption every single loop and run oref0-reset-git if needed.
Eric Luhrs
@eluhrs
Mar 09 2016 13:25
@inform880 Yea, that's what I was thinking. It happened again when I unplugged this morning. I'm pretty sure it is related to connecting/disconnecting from the electrical outlet.
@inform880 How do you run the check?
Matthias
@ceben80
Mar 09 2016 13:42
I have experiencing a similar issue by pressing the powerbank on/off button by mistake.
Switching the pi on again my loop has shown corruption errors......
Jason Calabrese
@jasoncalabrese
Mar 09 2016 13:50
oref0-git-reset should be in a cron, I run it every minute, very easy to corrupt the repo is power is pulled
Matthias
@ceben80
Mar 09 2016 13:59
I am running it in a cleanup alias every 5 min. but will change this to cron now thanks @jasoncalabrese
Jason Calabrese
@jasoncalabrese
Mar 09 2016 14:00
An OpenAPS alias won't work when git is corrupted
Eric Luhrs
@eluhrs
Mar 09 2016 14:00
Thanks, @jasoncalabrese . I put it in my loop, which seems to have worked, but I like cron better since the loop is complex enough already....
Jason Calabrese
@jasoncalabrese
Mar 09 2016 14:00
Needs to be outside the loop
Matthias
@ceben80
Mar 09 2016 14:01
sounds very logical....better in cron :+1:
Eric Luhrs
@eluhrs
Mar 09 2016 14:02
Moving it now. Does it have to be run inside the openaps dir?
Matthias
@ceben80
Mar 09 2016 14:05
I definded in cron with:
cd /home/pi/myopenaps && oref0-reset-git
Jason Calabrese
@jasoncalabrese
Mar 09 2016 14:06
Yeah, that looks right
The version of the script on the dev branch is best since it first tries to fix the repo, before fully resetting/wiping it
Matthias
@ceben80
Mar 09 2016 14:07
and my output runs again to syslog :+1:
live4sw
@live4sw
Mar 09 2016 15:11
What does oref0-reset-git do? Do we really want to run it every minute even if we're in the main branch?
Jason Calabrese
@jasoncalabrese
Mar 09 2016 15:14
it first runs a git status, if that fails it will delete the .git dir and run openaps init again, the version on dev tries to fix the repo first
once the repo is corrupt the loop stops, so better to lose history and keep running
Bill Stackpole
@billstackpole
Mar 09 2016 15:47
bump > got a question - just turned on my Pi and trying to run gather-profile - getting a "attempting to use a port that's not open" message <
from a RasPi2. Just got my RasPi3 and it doesn't have this issue. (Bad pi?) I do have some weirdness in trying to get my eth0 to get DHCP (always 169.254 - boo hiss). Thoughts?
PS - just moved my flash card from RasPi 2 to RasPi 3 (had to set time manually to get scripts to allow suggestion but once timestamps matched, scripts work but still no network.)
Jason Calabrese
@jasoncalabrese
Mar 09 2016 15:56
see if openaps is already running, maybe from a cron ps -ef | grep openaps if you're going to run the command manually you should disable the cron
Matthias
@ceben80
Mar 09 2016 16:34
@/all pump 722 should working without restrictions like a 712? That's right?
Eric
@ecc1
Mar 09 2016 16:43

A good way to check in a shell script whether openaps is running:

if killall -0 openaps; then ... # yes it's running

(But unlike the grep example, you have to use the exact name of the binary, not just a substring of it.)

Matthias
@ceben80
Mar 09 2016 16:44
I havn't yet this pump :wink:
Rachel Sandlain
@audiefile
Mar 09 2016 16:45
Yes it should
Matthias
@ceben80
Mar 09 2016 16:45
it should possibly serve as a backup device
Jason Calabrese
@jasoncalabrese
Mar 09 2016 16:50
the x22s are useable, it's the other models like the x23s that you need to check the firmware
Dana Lewis
@danamlewis
Mar 09 2016 17:11
@ceben80 Correct.
Scott Leibrand
@scottleibrand
Mar 09 2016 17:39
has anyone finished getting openaps uploading dexcom CGM data to nightscout? @danamlewis share receiver has stopped working, so need to make the openaps rigs play uploader
William Fallon
@inform880
Mar 09 2016 19:19

I'm getting so frustrated. I can't get openaps to loop for more then 4 or 5 hours at a time, before something happens that interrupts it, and then it never fixes itself until I manually loop it myself a couple of times. I keep on getting errors like this:

ns-status://JSON/shell/monitor/upload-status.json
No JSON object could be decoded

Traceback (most recent call last):
  File "/usr/local/bin/openaps-report", line 6, in <module>
    exec(compile(open(__file__).read(), __file__, 'exec'))
  File "/home/pi/src/openaps/bin/openaps-report", line 82, in <module>
    app( )
  File "/home/pi/src/openaps/openaps/cli/__init__.py", line 44, in __call__
    self.run(self.args)
  File "/home/pi/src/openaps/bin/openaps-report", line 75, in run
    output = app(args, self)
  File "/home/pi/src/openaps/openaps/cli/subcommand.py", line 52, in __call__
    return self.method.main(args, app)
  File "/home/pi/src/openaps/openaps/reports/invoke.py", line 48, in main
    reporters.Reporter(report, device, task)(output)
  File "/home/pi/src/openaps/openaps/reports/reporters/__init__.py", line 27, in __call__
    self.blob = self.serialize(data)
  File "/home/pi/src/openaps/openaps/reports/reporters/__init__.py", line 25, in serialize
    return self.method.serialize(render(data), self)
  File "/home/pi/src/openaps/openaps/vendors/process.py", line 56, in prerender_json
    return json.loads(data)
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded

And I get these errors randomly. I also cannot figure out the carelink USB. It goes dead, and then nothing I do can fix it, even rebooting the Pi, until it decides that it's going to work again. Also, I 'm getting the above error randomly with basically all of the reports in openaps that I collect. Then I loop it manually a couple of times, reboot it a couple of times until it works.

Scott Leibrand
@scottleibrand
Mar 09 2016 19:49
next time it happens, check which json files are empty or corrupted
one thing that could be happening is your main loop doesn't refresh something unless something else, that depends on that thing, is present and valid
Jim Matheson
@jmatheson
Mar 09 2016 22:15
Just a heads up to anyone working on acquiring equiptment for their first Pi setup. I have an extra Carelink stick.
Dana Lewis
@danamlewis
Mar 09 2016 22:15
:+1:
jaylagorio
@jaylagorio
Mar 09 2016 22:41
Good evening! I'm using OpenAPS to get JSON data from a Medtronic pump+CGM to upload to Nightscout. It gets JSON from the pump for both, funnels those though mm-format-ns-pump-history or mm-format-ns-glucose, and then uses ns-upload-entries on both to get them to Nightscout. The CGM markers show up great but I'm not seeing any pump data go through (boluses, etc) even though the JSON that gets converted looks great. Anyone have any pointers?
Jason Calabrese
@jasoncalabrese
Mar 09 2016 22:45
I think the most current docs for getting treatments to NS is https://github.com/openaps/docs/blob/dev/docs/Automate-system/vizualization.md
Mark Wilson
@mddub
Mar 09 2016 22:46
cgm data goes to the entries collection, pump data should be uploaded to the treatments collection
i believe ns-upload-entries is hardcoded to post to entries.json, you want to use ns-upload
Dana Lewis
@danamlewis
Mar 09 2016 22:50
And welcome, by the way, @jaylagorio !
Toby Canning
@TC2013
Mar 09 2016 22:52
@inform880 Do you have this in your preflight? ( mm-stick warmup 2>&1 || sudo oref0-reset-usb )
jaylagorio
@jaylagorio
Mar 09 2016 22:54
@mddub I just took a look and yes, I do think that's what I want.
@jasoncalabrese Thank you! I'll take a look at that and tweak based on what's there, I don't think I've seen that page before
@TC2013 I don't, but I think I'm OK without it for now. Getting data written to the Pi in JSON has everything looking just fine, it's just the pump data that wasn't showing on NS
@danamlewis And thanks for the welcome! I'm looking forward to taking this on.
Toby Canning
@TC2013
Mar 09 2016 22:55
@inform880 I don't know if this is related, but I have had to get rid of the .git folder a couple times now, but I wasn't able to figure why that solution fixed things. I even had oref0-reset-git running every 5 min in cron, but that didn't help. Now I delete the .git directory instead.
@jaylagorio I meant that for @inform880 who is having issues with loop not running continuously and getting stuck for unknown reason
But, let me also say welcome!!! @jaylagorio
jaylagorio
@jaylagorio
Mar 09 2016 22:58
My mistake - and thank you too!
Tim Howard
@tghoward
Mar 09 2016 22:59
@scottleibrand yes we use openaps as an uploader for dexcom data. Actually also using xdrip now too, but have used openaps since the beginning. Generally no problems.
tazitoo
@tazitoo
Mar 09 2016 23:07
@inform880 - any chance it's the power supply?
Scott Leibrand
@scottleibrand
Mar 09 2016 23:08
@tghoward cool. can you paste the config you use to upload it?
Tim Howard
@tghoward
Mar 09 2016 23:32

@scottleibrand

upload-bg = ! bash -c "openaps latest-bg-records; ns-upload  $NS_HOST $API_SECRET entries.json upload/glucose-zoned-recent.json"

that's the final alias.

Scott Leibrand
@scottleibrand
Mar 09 2016 23:32
and you just zone glucose like pumphistory?
Tim Howard
@tghoward
Mar 09 2016 23:32
I do some crazy shenanigans to get the latest records
let me find the zone report
Scott Leibrand
@scottleibrand
Mar 09 2016 23:32
k
Tim Howard
@tghoward
Mar 09 2016 23:33
zone-glucose = ! bash -c "openaps use tz rezone --date system_time monitor/glucose.json > monitor/glucose-zoned-1.json && openaps use tz rezone --date display_time monitor/glucose-zoned-1.json > monitor/glucose-zoned-2.json"
Scott Leibrand
@scottleibrand
Mar 09 2016 23:34
cool. and the latest-records stuff?
Tim Howard
@tghoward
Mar 09 2016 23:34
... it's an alias. Back to getting the latest records, I don't think it is needed any more because the uploads are doing upserts now?
Scott Leibrand
@scottleibrand
Mar 09 2016 23:35
good question
the other question is how to deal with two CGM receivers
Tim Howard
@tghoward
Mar 09 2016 23:35
good point. Again, that shouldn't be a problem if the uploading is really upserts
as dups wouldn't go in
oh, wait, but two receivers wouldn't be producing dups!
Scott Leibrand
@scottleibrand
Mar 09 2016 23:36
exactly
Tim Howard
@tghoward
Mar 09 2016 23:40
just because it is such a hack :smile: I'll show you my awesome get lastest BG setup.
the idea here is that if you (Teddy) is away from the system for a while we need to go back to GGM and get more data
latest-bg-records = ! bash -c "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 https://bcbteddy.herokuapp.com | json -a date dateString | sort -r | head -1 | awk 'BEGIN {} {print $1}' > monitor/latest-ns-bg-time.json"
oldest-cgm-bg-time = ! bash -c "cat monitor/glucose-zoned.json | json -a date dateString | sort  | head -1 | awk 'BEGIN {} {print $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"
so that way the regular loop only gets a small set of records from CGM, but if you need to backfill up on nightscout, then get more and backfill (here, up to 12 hours).
Tim Howard
@tghoward
Mar 09 2016 23:48
@scottleibrand more date massaging it looks like I decided I needed at some time:
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'
Scott Leibrand
@scottleibrand
Mar 09 2016 23:51
whee :)
Jason Calabrese
@jasoncalabrese
Mar 09 2016 23:58
getting multiple receivers really right is going to be a little tricky, at least in NS, could mess up forcasting, deltas, etc