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

31st
May 2018
Dana Lewis
@danamlewis
May 31 2018 00:12
anyone care to test this? openaps/docs#1266
Martin Haeberli
@mhaeberli
May 31 2018 00:50
@cascer1 @danamlewis nice… haven’t tested yet. if/when I do (not today; hoping in the next few) I’ll report back ...
henghayan
@henghayan
May 31 2018 01:10
Which script in openaps controls insulin release?
re your PM, I think you're looking at the device toolkit, and not the algorithm (openaps/oref0). Per the link above, the main decision making math is in determine-basal.js
Tim Gunn
@Tornado-Tim
May 31 2018 01:17
I would test if I could Dana but I don't run mongolab 😐
henghayan
@henghayan
May 31 2018 01:25
@danamlewis The Python code's main role is to prompt help information and deliver real-time messages to the web by JSON, and the mathematical logic is controlled by the JS code, right?
Dana Lewis
@danamlewis
May 31 2018 01:26
Close: I would describe it as the python code is working to read/write information between devices. correct that the math is done by the JS (determine-basal etc)
(web is optional)
henghayan
@henghayan
May 31 2018 01:28
@danamlewis I see, thanks!!!!!!!
Dana Lewis
@danamlewis
May 31 2018 01:28
:+1:
henghayan
@henghayan
May 31 2018 01:40
@danamlewis I have new doubts about how you say the web is optional, and how JS controls mathematical logic.
Scott Leibrand
@scottleibrand
May 31 2018 01:45

Please do go ahead and ask your questions here.

If you have a rig connected to a pump and CGM, it can control the pump offline without connectivity to Nightscout.

henghayan
@henghayan
May 31 2018 02:07
Under which platform does the desermin-basal.js work, and what is it connected to?
henghayan
@henghayan
May 31 2018 02:14
In other words, which quoted the JS?
In other words, which JS?
which import the js?
Scott Leibrand
@scottleibrand
May 31 2018 02:16
nodejs
henghayan
@henghayan
May 31 2018 02:19
@scottleibrand Thank you. I think I need to learn more.
Scott Leibrand
@scottleibrand
May 31 2018 02:46
What’s your goal?
henghayan
@henghayan
May 31 2018 02:59
I want to know which part of the code controls the mathematical logic so that I can customize the open apps to fit into my research and see if they can be integrated into the app, so I want to know which part of the code I need to know
Scott Leibrand
@scottleibrand
May 31 2018 05:56
That would be pretty much all of the JavaScript in oref0.
henghayan
@henghayan
May 31 2018 07:02
ok,thanks
skubesch
@skubesch
May 31 2018 07:37
Having trouble will all my openaps rigs at once (edison/explorer and pi) so I'm wondering if there is an issue with my nightscout somehow? Didn't see anything in the docs that helped give me more insight. My error across rigs is raise ValueError("No JSON object could be decoded") ValueError: No JSON object could be decoded
Martin Haeberli
@mhaeberli
May 31 2018 07:49
@skubesch : try sending a small bolus. Or a 30 minute zero temp. There has to be recent pump history in the last 24 hours. It’s sort of a known bug
Preferably while disconnected
Martin Haeberli
@mhaeberli
May 31 2018 07:54
If that’s not it, check your MongoDB size (see troubleshooting docs). Needs to be well under 500 MB total.
kelseyyearick
@kelseyyearick
May 31 2018 14:12
@scottleibrand @danamlewis I pulled up the autotune directory and had it show which files it had but I'm not sure how to see invalid contacts. I reached out on Facebook to both of you so I could send screen shots!
Scott Leibrand
@scottleibrand
May 31 2018 14:33
You can drag and drop screenshots into Gitter.
skubesch
@skubesch
May 31 2018 15:42
@mhaeberl When you say to send a small bolus or set a temp rate, I'm assuming you mean to do it some way other than directly on the pump (otherwise I have been using the pump continuously so I've sent a lot of boluses). How do I do this?
Eric
@ecc1
May 31 2018 15:47
@skubesch the problem @mhaeberli is talking about only happens with a newly-turned-on pump, so probably not the case here. Please provide more context (lines in your log file) around the JSON error, so we can figure out which file is empty when it shouldn't be. If pasting here, please surround it with lines containing 3 backticks so it's more readable
skubesch
@skubesch
May 31 2018 16:21
Thank you both for the help, working now and I'm so relieved. The tip about mlab was correct even though I just did this a few months ago; it fills up so fast.
Scott Leibrand
@scottleibrand
May 31 2018 16:32
So much complaining: so little willingness to work on a fix.
(Not from you specifically, but this is a longstanding issue with a fairly easy fix that no one has bothered to implement.)
Martin Haeberli
@mhaeberli
May 31 2018 17:30
@skubesch :+1: glad to hear it’s working now!
Neal
@tnharvey
May 31 2018 18:04
@scottleibrand regarding my earlier issue with BT not connecting on restart (and it seems to drop without a restart after a bit):
You asked for anything relevant from /var/log/openaps/network.log:
Starting oref0-online at Wed May 30 15:33:02 PDT 2018.
At Wed May 30 15:33:02 PDT 2018 my wifi network name is MovingMountains.io Team
At Wed May 30 15:33:02 PDT 2018 my local wifi IP is: 192.168.86.41
UID        PID  PPID  C STIME TTY          TIME CMD
root      1004   987  0 15:05 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash
At Wed May 30 15:33:02 PDT 2018 my Bluetooth is connected to Pixel 2 XL
At Wed May 30 15:33:02 PDT 2018 my local Bluetooth IP is: 192.168.44.189
At Wed May 30 15:33:03 PDT 2018 my public IP is: XX (I edited this out)
At Wed May 30 15:33:03 PDT 2018 my local hotspot is not running (and not enabled in preferences.json)
Disconnecting BT
Finished oref0-online at Wed May 30 15:33:04 PDT 2018.

Starting oref0-online at Wed May 30 15:34:02 PDT 2018.
UID        PID  PPID  C STIME TTY          TIME CMD
root      1004   987  0 15:05 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash
At Wed May 30 15:34:02 PDT 2018 my wifi network name is MovingMountains.io Team
At Wed May 30 15:34:02 PDT 2018 my local wifi IP is: 192.168.86.41
At Wed May 30 15:34:02 PDT 2018 my Bluetooth is connected to Pixel 2 XL
At Wed May 30 15:34:02 PDT 2018 my local Bluetooth IP is: 192.168.44.189
At Wed May 30 15:34:02 PDT 2018 my public IP is: XX (I edited this out)
At Wed May 30 15:34:03 PDT 2018 my local hotspot is not running (and not enabled in preferences.json)

Disconnecting BT
Finished oref0-online at Wed May 30 15:34:03 PDT 2018.

Starting oref0-online at Wed May 30 15:37:02 PDT 2018.
UID        PID  PPID  C STIME TTY          TIME CMD
At Wed May 30 15:37:03 PDT 2018 my wifi network name is MovingMountains.io Team
At Wed May 30 15:37:03 PDT 2018 my local wifi IP is: edison:x:1002:100::/home/edison:/bin/bash
192.168.86.41
At Wed May 30 15:37:03 PDT 2018 my Bluetooth PAN is not connected
At Wed May 30 15:37:04 PDT 2018 my local hotspot is not running (and not enabled in preferences.json)
Finished oref0-online at Wed May 30 15:37:04 PDT 2018.
UID        PID  PPID  C STIME TTY          TIME CMD
root       664   638  0 15:37 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash
Scott Leibrand
@scottleibrand
May 31 2018 18:11
it looks like it's properly dropping BT as soon as it gets proper connectivity over wifi. what is it doing differently than you'd like?
Neal
@tnharvey
May 31 2018 18:12
Additionally helpful (?) info:
root@edtronic:~# bluetoothctl
[NEW] Controller [] (I edited this out) edtronic [default]
[NEW] Device [] (I edited this out) Pixel 2 XL
Agent registered
[bluetooth]# show
Controller [] (I edited this out) (public)
        Name: BlueZ 5.48
        Alias: edtronic
        Class: 0x00000110
        Powered: yes
        Discoverable: no
        Pairable: yes
        UUID: ... (I removed the list of UUID info to save space)
        Modalias: usb:v1D6Bp0246d0530
        Discovering: no
[bluetooth]# info B4:F1:DA:64:7A:A5
Device B4:F1:DA:64:7A:A5 (public)
        Name: Pixel 2 XL
        Alias: Pixel 2 XL
        Class: 0x005a020c
        Icon: phone
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: no
        LegacyPairing: no
... (I removed the list of UUID info to save space)
root@edtronic:~# hciconfig -a
hci0:   Type: BR/EDR  Bus: UART
        BD Address: [](I edited this out)  ACL MTU: 1021:8  SCO MTU: 64:1
        UP RUNNING PSCAN
        RX bytes:550077 acl:0 sco:0 events:5932 errors:0
        TX bytes:27233 acl:0 sco:0 commands:5932 errors:0
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH SNIFF
        Link mode: SLAVE ACCEPT
        Name: 'edtronic'
        Class: 0x000110
        Service Classes: Unspecified
        Device Class: Computer, Handheld
        HCI Version: 4.0 (0x6)  Revision: 0xa6
        LMP Version: 4.0 (0x6)  Subversion: 0x410e
        Manufacturer: Broadcom Corporation (15)
root@edtronic:~# rfkill list
0: bcm43xx Bluetooth: Bluetooth
        Soft blocked: no
        Hard blocked: no
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: no
2: brcmfmac-wifi: Wireless LAN
        Soft blocked: no
        Hard blocked: no
3: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
@scottleibrand It never recovers BT connectivity when wifi drops

I tested this with

iwconfig wlan0 txpower off; sleep 120; iwconfig wlan0 txpower auto

and it never switches to BT :/

Scott Leibrand
@scottleibrand
May 31 2018 18:20
what does the network.log show when wifi drops? the ones you pasted were with working wifi.
Neal
@tnharvey
May 31 2018 18:28

I was just grabbing that for you =]
Here's with wifi dropping:

Starting oref0-online at Thu May 31 11:16:02 PDT 2018.
At Thu May 31 11:16:02 PDT 2018 my Bluetooth is connected to Pixel 2 XL
At Thu May 31 11:16:02 PDT 2018 my local Bluetooth IP is: unassigned
At Thu May 31 11:16:02 PDT 2018 my public IP is:
UID        PID  PPID  C STIME $
root       652   616  0 00:17 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash
not found

At Thu May 31 11:16:02 PDT 2018 my wifi is not connected

Getting new wlan0 IP

No Internet access detected, attempting to connect BT to [] (edited out)
UID        PID  PPID  C STIME TTY          TIME CMD
root       652   616  0 00:17 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash
Connected to Bluetooth with IP: unassigned

Offline hotspot not enabled in preferences.json
At Thu May 31 11:16:25 PDT 2018 my local hotspot is not running (and not enable$
Cycling wlan0
Finished oref0-online at Thu May 31 11:16:48 PDT 2018.

at this point, I saw no connection on my Android, so I ran the following:

root@edtronic:~# sudo bt-pan client [] (edited out)
root@edtronic:~# ifconfig bnep0
bnep0     Link encap:Ethernet  HWaddr [] (edited out)
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:12 (12.0 B)  TX bytes:96 (96.0 B)

I saw the connection on my Android at this point, but no IP still...

root@edtronic:~# sudo dhclient bnep0
root@edtronic:~# ifconfig bnep0
bnep0     Link encap:Ethernet  HWaddr [] (edited out)
          inet addr:192.168.44.189  Bcast:192.168.44.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:710 (710.0 B)  TX bytes:862 (862.0 B)

and network.log then showed the following:

Starting oref0-online at Thu May 31 11:17:01 PDT 2018.
At Thu May 31 11:17:01 PDT 2018 my Bluetooth is connected to Pixel 2 XL
At Thu May 31 11:17:01 PDT 2018 my local Bluetooth IP is: 192.168.44.189
UID        PID  PPID  C STIME TTY          TIME CMD
root       652   616  0 00:17 ?        00:00:00 /usr/local/bin/bluetoothd
At Thu May 31 11:17:02 PDT 2018 my public IP is: edison:x:1002:100::/home/edison:/bin/bash
[] (edited out, shows proper public IP though)
At Thu May 31 11:17:04 PDT 2018 my local hotspot is not running (and not enable$
Finished oref0-online at Thu May 31 11:17:04 PDT 2018.

whew! Thoughts?

Scott Leibrand
@scottleibrand
May 31 2018 18:55
looks to me like it's working
what makes you think it's not?
oh, sorry, that was only after you manually ran it?
looks like the initial dhclient run on initial connection didn't get assigned an IP from the phone
not sure if oref0-online needs some retry logic for that...
Neal
@tnharvey
May 31 2018 18:57
yeah, I had to manually run bt-pan client which connected it, but without an IP, and then run dhclient to get an IP
Scott Leibrand
@scottleibrand
May 31 2018 18:58
it said Connected to Bluetooth with IP: unassigned
which means the bt-pan client had already been done automatically (and apparently worked)
it just didn't get an IP until you re-did both
Neal
@tnharvey
May 31 2018 19:00
hmm, let me check and make sure. I'll drop BT and reconnect to wifi, and make sure it's connecting to BT automatically. The problem I was noticing was that, on my Android, I showed no connection from the edison until I ran bt-pan client. Once I ran that, the connection showed up.
Neal
@tnharvey
May 31 2018 19:08
Okay, here's after a restart with wifi turned off:
Starting oref0-online at Thu May 31 12:02:02 PDT 2018.
UID        PID  PPID  C STIME TTY          TIME CMD
At Thu May 31 12:02:02 PDT 2018 my Bluetooth PAN is not connected
edison:x:1002:100::/home/edison:/bin/bash
At Thu May 31 12:02:02 PDT 2018 my public IP is: not found

At Thu May 31 12:02:03 PDT 2018 my wifi is not connected

Getting new wlan0 IP

No Internet access detected, attempting to connect BT to [] (edited out)
UID        PID  PPID  C STIME TTY          TIME CMD
root       598   573  0 12:02 ?        00:00:00 /usr/local/bin/bluetoothd
edison:x:1002:100::/home/edison:/bin/bash

Offline hotspot not enabled in preferences.json
At Thu May 31 12:02:27 PDT 2018 my local hotspot is not running (and not enable$
Cycling wlan0
Finished oref0-online at Thu May 31 12:02:52 PDT 2018.
Scott Leibrand
@scottleibrand
May 31 2018 19:09
        echo; echo "No Internet access detected, attempting to connect BT to $MAC"
        oref0-bluetoothup
        sudo bt-pan client $MAC -d
        sudo bt-pan client $MAC && sudo dhclient bnep0
try those manually?
Neal
@tnharvey
May 31 2018 19:13
Results:
Traceback (most recent call last):
  File "/usr/local/bin/bt-pan", line 228, in <module>
    if __name__ == '__main__': sys.exit(main())
  File "/usr/local/bin/bt-pan", line 196, in main
    try: iface = net.Connect(opts.uuid)
  File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
    **keywords)
  File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.bluez.Error.Failed: Operation already in progress
okay, I ran dhclient bnep0 again a minute later and it worked
so manually they are working, but not right away?
Scott Leibrand
@scottleibrand
May 31 2018 19:24
which command was that error on?
Neal
@tnharvey
May 31 2018 19:24
In network.log, it shows the same thing as above ("attempting to connect to BT" with no connection listed) a few more times, and then (I'm assuming once I ran the commands manually, I don't know the exact moment) it shows connected with "unassigned" IP until dhclient is run.
sudo bt-pan client $MAC && sudo dhclient bnep0
The error was on sudo bt-pan client $MAC && sudo dhclient bnep0, but since they were combined, I'm not sure which
(I replaced "$MAC" with my phone's MAC)
Scott Leibrand
@scottleibrand
May 31 2018 19:25
try with a longer sleep after sudo bt-pan client $MAC -d ?
Neal
@tnharvey
May 31 2018 19:25
when I ran sudo dhclient bnep0 again after that about 30 seconds later, it worked without the error
Scott Leibrand
@scottleibrand
May 31 2018 19:26
the bluez error would be on the bt-pan client command, not the dhclient
Neal
@tnharvey
May 31 2018 19:26
okay, so it may have already connected at that point. I'll reboot to have a clean slate and try the process again with a sleep inserted
wilson99
@wilson99
May 31 2018 19:34
I have updated to 0.6.1, but kepp get below log
Starting oref0-pump-loop at Fri Jun 1 03:13:02 CST 2018 with 16 se
cond wait_for_silence:
Waiting up to 4 minutes for new BG: .......glucose.json newer than
pump_loop_completed
Radio ok. Listening: ..............................................
...................................................................
...................................................................
...................................................................
...................................................................
.................................
sometimes waiting very long, more than half hour. but the xdrip-js-logger is work well.
Neal
@tnharvey
May 31 2018 19:43
@scottleibrand it appears that (and you didn't see this because I was editing out my MAC), I entered my MAC into oref0-setup as lower case, and it's case sensitive. I'm re-running oref0-setup and entering the MAC as uppercase to see if this was the issue. It probably was. Sigh, it's always something stupid :D
... the commands were working when entered manually because I was copying the uppercase version and it would work, but if I copied the mac from the network.log (which had the lower case version I had entered into oref0-setup) it would fail
Scott Leibrand
@scottleibrand
May 31 2018 19:48
ah, yeah, some of those are finicky about case
Neal
@tnharvey
May 31 2018 19:54
Confirmed. With a reboot, it connected without issue. I will say though, I reran oref0-setup with the MAC edited, and it didn't appear to change cron, so I edited crontab and it then everything worked. If I didn't restart, would oref0-setup not have taken effect?
Scott Leibrand
@scottleibrand
May 31 2018 19:56
did you have it delete cron?
Neal
@tnharvey
May 31 2018 19:56
It didn't ask, it just asked if I wanted to continue, I said 'y', and it returned me to the prompt. I'm wondering if it ran at all
also, how do I get wlan0 to power back up? I ran sudo iwconfig wlan0 txpower on and got
Error for wireless request "Set Tx Power" (8B27) :
    GET failed on device wlan0 ; Input/output error.
Neal
@tnharvey
May 31 2018 20:06
NM, got it, needed to unblock it in rfkill
wilson99
@wilson99
May 31 2018 20:09
Anyone can help me out? I keep get stuck on my openaps 0.6.1 as below logs
Starting oref0-pump-loop at Fri Jun 1 03:39:02 CST 2018 with 23 se
cond wait_for_silence:
Waiting up to 4 minutes for new BG: .glucose.json newer than pump_l
oop_completed
Radio ok. Listening: ..............................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
...................................................................
.................Couldn't wait_for_silence 23
oref0-pump-loop failed. pump_loop_completed more than 15m old; wait
ing for 40s silence before mmtuning
Radio ok. Listening: ..............................................
............
kelseyyearick
@kelseyyearick
May 31 2018 20:10
@scottleibrand these are files in autotune directory. How do I see which are the issues?
autotune.2018-05-25.json.gz
autotune.2018-05-31-040502.log newprofile.2018-05-30.json ns-treatments.2018-05-25.json.gz profile.2018-05-26.json
autotune.2018-05-26.json.gz autotune_recommendations.log ns-entries.2018-05-25.json.gz ns-treatments.2018-05-26.json.gz profile.2018-05-27.json
autotune.2018-05-27.json.gz newprofile.2018-05-25.json ns-entries.2018-05-26.json.gz ns-treatments.2018-05-27.json.gz profile.2018-05-28.json
autotune.2018-05-28.json.gz newprofile.2018-05-26.json ns-entries.2018-05-27.json.gz ns-treatments.2018-05-28.json.gz profile.2018-05-29.json
autotune.2018-05-29.json.gz newprofile.2018-05-27.json ns-entries.2018-05-28.json.gz ns-treatments.2018-05-29.json.gz profile.2018-05-30.json
autotune.2018-05-30-185353.log newprofile.2018-05-28.json ns-entries.2018-05-29.json.gz ns-treatments.2018-05-30.json profile.json
autotune.2018-05-30.json newprofile.2018-05-29.json ns-entries.2018-05-30.json profile.2018-05-25.json profile.pump.json
Scott Leibrand
@scottleibrand
May 31 2018 20:15
@wilson99 does it ever manage to mmtune? If so, with what results?
@kelseyyearick you can use cat or less to look at the most recent json files. You can probably ignore the .gz and .log ones for now.
skubesch
@skubesch
May 31 2018 20:24
@scottleibrand Did you mean my comment? What is the fix for MLab issues (besides manually cleaning/compressing) and how would one go about implementing that?
Scott Leibrand
@scottleibrand
May 31 2018 20:27
the fix is for someone to write a script to scan NS for really old devicestatus entries and delete them, rather than having to delete the whole collection. ideally it would also upload data to open humans as well.
the NS API makes it easy to filter for devicestatus entries older than a certain date
and I think you can even use the HTTP DELETE method with that filter to do the actual deletion
wilson99
@wilson99
May 31 2018 20:41
@scottleibrand Does it because I use the Rileylink in open loop mode And use it as a remote contoller? I switched it off, seems stable for half hours till now.
Scott Leibrand
@scottleibrand
May 31 2018 20:50
ah, yeah, I was going to ask if you had any other rigs, but if the RL is constantly talking to the pump, that would prevent OpenAPS from getting started
skubesch
@skubesch
May 31 2018 21:46
I'm not sure how to even scan Nightscout for entries, but it somebody wants to team up with me on this I'd be happy to work on it.
Martin Haeberli
@mhaeberli
May 31 2018 21:48
@skubesch for example:
curl -v https://<sitename>.herokuapp.com/api/v1/devicestatus.json
will get the most recent

@mhaeberli

curl -v https://<sitename>.herokuapp.com/api/v1/devicestatus.json?count=10

will get the most recent 10. there is some magic for date range queries, etc; I’ve always had trouble getting my head around how to escape the special characters well enough to make that work, but others can likely advise.
see also:
https://github.com/nightscout/cgm-remote-monitor/wiki/API-v1.0.0-beta-Endpoints
and
https://github.com/nightscout/cgm-remote-monitor#nightscout-api

for more info
Kelly Watson
@kellyisworking
May 31 2018 22:30
D's nightscout is down. I think it's heroku (https://status.heroku.com/incidents/1561) though can someone else confirm theirs is also down?
Kelly Watson
@kellyisworking
May 31 2018 22:45
Back online :sparkles:
Jon Cluck
@cluckj
May 31 2018 23:02
:thumbsup: