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

16th
Nov 2018
Jacob H
@jdhigh
Nov 16 2018 02:45
Good evening friends. I just reflashed my edison and installed everything. Was looping, but then I started getting a weird error shown in my log:
module.js:485
throw err;
^
SyntaxError: /root/myopenaps/settings/profile.json: Unexpected end of input
at Object.parse (native)
at Object.Module._extensions..json (module.js:482:27)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/.rootfs/usr/local/lib/node_modules/oref0/bin/oref0-calculate-iob.js:44:22)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
ed
Could not parse input data: [SyntaxError: /root/myopenaps/monitor/iob.json: Unexpected end of input]
I did two out-of-the-ordinary things before I started seeing this error. I did an openaps first-upload, and I copied the contents of my old autotune from before the flash back to the rig.
Jacob H
@jdhigh
Nov 16 2018 03:16
I'm going to rerun setup script and see if that resolves... I'll report back.
Jacob H
@jdhigh
Nov 16 2018 03:25
After re-running setup script, the loop resumed and the loop log problems disappeared. Problem solved.
Scott Leibrand
@scottleibrand
Nov 16 2018 04:10
@loztblaz ok. You can either set it to 3 and let oref0 fill in the gaps, or modify the code to change that safety check from 3 to 2 for you.
loztblaz
@loztblaz
Nov 16 2018 05:26
oh, my mistake, i thought i said that i did change the check to 2. it's working wonderfully after that, just wanted to mention it in case anyone else was searching through gitter and not finding it like i was. appreciate you confirming that solution though!
Craig Brenner
@cbrenner
Nov 16 2018 08:13
Just wondering if anyone else is having problems with the Nightscout App crashing on Heroku? Been working fine for over a year now. This evening, I keep getting this error, "018-11-16T08:10:33.469306+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/socket.io/?EIO=3&transport=polling&t=MSRab43" host=alexanderbrennercgmsite.herokuapp.com request_id=ad1dd426-3bc2-447b-b6a2-d8534c6e422b fwd="24.17.201.47" dyno= connect= service= status=503 bytes= protocol=https
Scott Leibrand
@scottleibrand
Nov 16 2018 16:22
@loztblaz 👍
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 17:43
Any ideas as to what could make NS report "Not Looping" but running l in the terminal when logged in, everything seems fine? I just went to update my rig and NS has been saying I'm out of loop for 30+ min but I can't seem to find a reason for it
Dana Lewis
@danamlewis
Nov 16 2018 17:46
Check NS loop log
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 17:50
uhhh
papertrail has nothing
apparently at some point I messed up and it stopped logging
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 17:58
Should I rerun startup?
setup
Jon Cluck
@cluckj
Nov 16 2018 18:08
did your database fill up?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 18:18
nope
Jon Cluck
@cluckj
Nov 16 2018 18:26
I second what dana said about checking ns-looplog
could be something as simple as a typo in your NS url or api secret
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 18:47
yeah i wonder if I didn't goof on the serial or something on my pump, I'm rerunning setup
It's weird, because I just finished set up, and did l, and got a successful loop
but NS says 2hrs out of loop
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 18:54
@cluckj how do I check ns-looplog?
got it

```root@jankypanky:~# tail -F /var/log/openaps/ns-loop.log

Starting oref0-ns-loop at Fri Nov 16 13:57:01 EST 2018:
Found recent valid BG:
{"glucose":110,"dateString":"2018-11-16T13:51:56-05:00"}
Latest NS temptargets: {"target":80,"duration":60,"start":"2018-11-16T16:18:54.319Z"}
Merging local temptargets: Temptargets merged: {"target":80,"duration":60,"start":"2018-11-16T16:18:54.319Z"}
Refreshed carbhistory; COB: 0
{"batteryVoltage":3882,"battery":70}
{"status":401,"message":"Unauthorized","description":"Invalid/Missing"}
Completed oref0-ns-loop at Fri Nov 16 13:57:19 EST 2018

Starting oref0-ns-loop at Fri Nov 16 13:58:02 EST 2018:
Found recent valid BG:
{"glucose":110,"dateString":"2018-11-16T13:51:56-05:00"}
Latest NS temptargets: {"target":80,"duration":60,"start":"2018-11-16T16:18:54.319Z"}
Merging local temptargets: Temptargets merged: {"target":80,"duration":60,"start":"2018-11-16T16:18:54.319Z"}
Refreshed carbhistory; COB: 0
{"batteryVoltage":3864,"battery":68}
{"status":401,"message":"Unauthorized","description":"Invalid/Missing"}
Completed oref0-ns-loop at Fri Nov 16 13:58:19 EST 2018```

Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:00
I'm guessing "Invalid/Missing" is the problem?
Jon Cluck
@cluckj
Nov 16 2018 19:02
{"status":401,"message":"Unauthorized","description":"Invalid/Missing"}
yep
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:03
is that password/token stuff from setup
Jon Cluck
@cluckj
Nov 16 2018 19:03
yeah
you can check what it used by looking in oref0-runagain.sh
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:04
what do I do if it's correct but still not working?
like the password is correct, the address is correct, serial is correct
Jon Cluck
@cluckj
Nov 16 2018 19:07
are you using tokens, or api secret?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:08
api secret
Jon Cluck
@cluckj
Nov 16 2018 19:09
maybe the heroku logs can tell you more
dashboard --> "more" button --> "application logs"
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:14
hm
it keeps scrolling through granted/denied
2018-11-16T19:14:13.324580+00:00 app[web.1]: GRANTED:  74.98.247.88 no-token api:treatments:read default
2018-11-16T19:14:13.331477+00:00 heroku[router]: at=info method=GET path="/api/v1/treatments.json?find[created_at][$gte]=2018-11-15T19:14+0000&find[carbs][$exists]=true" host=traceyspancreas.herokuapp.com request_id=3660e792-d414-498a-8ae6-f7e31db226c0 fwd="74.98.247.88" dyno=web.1 connect=1ms service=12ms status=200 bytes=605 protocol=https
2018-11-16T19:14:19.355416+00:00 heroku[router]: at=info method=POST path="/api/v1/devicestatus.json" host=traceyspancreas.herokuapp.com request_id=da5d5564-057e-46ac-bf08-a62547fce8b5 fwd="74.98.247.88" dyno=web.1 connect=1ms service=25ms status=401 bytes=311 protocol=https
2018-11-16T19:14:19.352531+00:00 app[web.1]: GRANTED:  74.98.247.88 no-token api:devicestatus:read default
2018-11-16T19:14:19.353115+00:00 app[web.1]: DENIED:  74.98.247.88 no-token api:devicestatus:create
2018-11-16T19:14:20.176444+00:00 heroku[router]: at=info method=GET path="/api/v1/treatments.json?find[enteredBy]=/openaps:\/\//&count=1?" host=traceyspancreas.herokuapp.com request_id=9ea648fc-14da-4d15-a843-5bc7d814e7ae fwd="74.98.247.88" dyno=web.1 connect=1ms service=14ms status=200 bytes=1045 protocol=https
2018-11-16T19:14:20.165253+00:00 app[web.1]: GRANTED:  74.98.247.88 no-token api:treatments:read default
2018-11-16T19:14:24.316888+00:00 heroku[router]: at=info method=POST path="/api/v1/treatments.json" host=traceyspancreas.herokuapp.com request_id=f1f048f3-84d3-4ef7-9e13-9804b4fb96bd fwd="74.98.247.88" dyno=web.1 connect=0ms service=37ms status=401 bytes=311 protocol=https
2018-11-16T19:14:24.312538+00:00 app[web.1]: GRANTED:  74.98.247.88 no-token api:treatments:read default
2018-11-16T19:14:24.314454+00:00 app[web.1]: DENIED:  74.98.247.88 no-token api:treatments:create
Jon Cluck
@cluckj
Nov 16 2018 19:16
it looks like your heroku is set up for tokens, not api secret?
live4sw
@live4sw
Nov 16 2018 19:16
Anyone with experience using an expired G6 sensor? I have a one here that is a week or so expired.
Jon Cluck
@cluckj
Nov 16 2018 19:16
(also delete/edit that message if you don't want your NS site shared)
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:18
hmmm, ok so I guess I have to..create another token?
Jon Cluck
@cluckj
Nov 16 2018 19:23
see which tokens there are in admin tools on your NS
iirc api secret should work with full permissions, regardless of which tokens you have
but (I think) if you put your api secret into oref0-setup as a token, it might cause this problem
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:27
the second time I ran the Setup script today, I said no to tokens, and entered my API secret, but I think the first time I ran it, I did enter my API as a token
but shouldn't running it the second time delete that error?
Jon Cluck
@cluckj
Nov 16 2018 19:27
maybe :grimacing:
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:28
I don't see any tokens in my Nightscount admin tools
Jon Cluck
@cluckj
Nov 16 2018 19:29
did you reboot at all between those re-runs of setup?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:30
no, probably should do that
Jon Cluck
@cluckj
Nov 16 2018 19:32
if that doesn't do the trick, we can check on the places where the secret/token is stored on your rig
should just be in ~/.bash_profile and ~/myopenaps/preferences.json
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:35
permission denied to ~/.bash_profile
Jon Cluck
@cluckj
Nov 16 2018 19:35
:eyes:
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:39
yep
Jon Cluck
@cluckj
Nov 16 2018 19:40
that's not good. are you logged in as root?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:40
yep
Jon Cluck
@cluckj
Nov 16 2018 19:41
check the permissions on that file?
doing ls -lah ~/.bash_profile should dump something like -rw-r--r-- 1 root root 674 Aug 10 18:35 /root/.bash_profile
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:51
I get
-rw-r--r-- 1 root root 1.5K Nov 16 14:51 /root/.bash_profile
Jon Cluck
@cluckj
Nov 16 2018 19:54
not being able to read that file could also stop ns-loop from using the api secret :\
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:54
uhhh ok. So how do I get it to read that file?
do I need to reflash and start over?
Jon Cluck
@cluckj
Nov 16 2018 19:55
do you get permission denied when you try to cat it?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:55
is it cat ~/.bash_profile?
Jon Cluck
@cluckj
Nov 16 2018 19:55
yeah
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 19:56
YES
Random jumble of numbers API secret!
So I should rerun the setup script using the random jumble of numbers as the token and not API secret?
Jon Cluck
@cluckj
Nov 16 2018 19:58
that's the hash that's automatically generated
is the api secret in your preferences.json accurate? (it's stored plaintext there)
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:00
no
root@jankypanky:~/myopenaps# vi preferences.json
        "max_iob": 18,
        "max_daily_safety_multiplier": 3,
        "current_basal_safety_multiplier": 4,
        "autosens_max": 1.2,
        "autosens_min": 0.7,
        "rewind_resets_autosens": true,
        "adv_target_adjustments": false,
        "exercise_mode": false,
        "wide_bg_target_range": false,
        "sensitivity_raises_target": true,
        "unsuspend_if_no_temp": false,
        "enableSMB_with_COB": false,
        "enableSMB_with_temptarget": false,
        "enableUAM": true,
        "curve": "rapid-acting",
        "offline_hotspot": false
}
Jon Cluck
@cluckj
Nov 16 2018 20:02
oh, are you using master?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:03
yes?
Jon Cluck
@cluckj
Nov 16 2018 20:03
ah
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:03
I was a bunch of versions behind so I thought I'd update this morning
Jon Cluck
@cluckj
Nov 16 2018 20:05
hmm, check the contents of ~/myopenaps/ns.ini?
you can make sure the hash is correct for your api secret by doing nightscout hash-api-secret typeyourapisecretpasswordhere
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:06
[device "ns"] fields = oper cmd = nightscout args = ns http://MySite.herokuapp.com bunchaRandomNumbersHere
Jon Cluck
@cluckj
Nov 16 2018 20:07
does the hash match the one from bash_profile, and from the nightscout hash generator?
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:08
yes
Jon Cluck
@cluckj
Nov 16 2018 20:08
okay :D
does it also match echo $API_SECRET
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:13
yep
Jon Cluck
@cluckj
Nov 16 2018 20:16
:/
are the same kinds of messages in ns-loop log and your heroku application logs after the reboot?
I'm a little stumped, but I will also brb
Jon Cluck
@cluckj
Nov 16 2018 20:44
ah, it might also be stored in ~/.profile too
and in your cron (crontab -e)
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:45
ok, in ~/.profile it's the same hash as before
is it just (crontab -e) orcat (crontab -e)
Jon Cluck
@cluckj
Nov 16 2018 20:47
crontab -e
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:49
AH
in `crontab -e it's different!
Jon Cluck
@cluckj
Nov 16 2018 20:50
!
wfeddern
@wfeddern
Nov 16 2018 20:50
Just got back first HBa1c after start of running openAPS (still just oref0), and really only for less then 2 months of that while waiting for replacement piHAT. Dropped from 7.3 to 6.8 :)
Jon Cluck
@cluckj
Nov 16 2018 20:50
change it to the correct hash, and reboot!
@wfeddern :clap: :confetti_ball:
that hash is stored in way too many places :eyes:
Jon Cluck
@cluckj
Nov 16 2018 20:57
:D
Tracey Berg-Fulton
@BergFulton
Nov 16 2018 20:59
YAAAAAS
thanks @cluckj !
We're back :tada:
Jon Cluck
@cluckj
Nov 16 2018 21:00
no problem!
Dana Lewis
@danamlewis
Nov 16 2018 21:39
Nice troubleshooting @cluckj
And congrats @wfeddern!
Garrett Webb
@garetis
Nov 16 2018 21:52
Has anyone seen these errors before or have any recommendations?
Waiting up to 4 minutes for new BG: jq: error: Cannot index string with number
parse error: Expected string key before ':' at line 513, column 9
Warning: could not parse monitor/glucose.json
/home/.rootfs/usr/local/lib/node_modules/oref0/lib/determine-basal/cob.js:8
    glucose_data = inputs.glucose_data.map(function prepGlucose (obj) {
TypeError: Cannot read property 'map' of undefined
wfeddern
@wfeddern
Nov 16 2018 23:24
@danamlewis Thanks, and for reference, in my 24 years with Type-1, I have never had an HBa1c below 7.1 . Next Monday is first appointment with endocrinologist since loop start, so should be interesting.
Jon Cluck
@cluckj
Nov 16 2018 23:34
Nice 😁
Dana Lewis
@danamlewis
Nov 16 2018 23:34
@wfeddern wow. thanks for sharing <3