Webserver

Web server

Juggluco incorporates a webserver by which other apps can receive glucose values from Juggluco. It can be used by xDrip watches and some Nightscout apps.

Using apps that are made to make use of the xDrip webserver is relatively easy. Just check active. Hereafter they can receive glucose from 127.0.0.1 on port 17580. Nightscout server URL: http://127.0.0.1:17580

Also, some Nightscout followers can make use of it. xDrip, Diabox, a Windows Floating Glucose app and a Windows, Linux and macOS widget (Owlet) can be used with http when "local only" is not set. On MacOS the same is true for Nightscout Menu Bar, Gluco Status and Gluco Tracker (all in Apple Store). You also only need http for Nightscouter and LoopFollow (IOS) and Nightguard (IOS and WatchOS).

If you want to access Juggluco over the internet, you need to forward a port from your modem. See:

Other Nightscout followers only make use of https and that requires that Juggluco has an authenticated SSL key for the domain name used to access Juggluco. If your external IP has an associated hostname, you can get a certificate for free via Certbot. You can't make use of it if your external IP doesn't have a hostname. You can get a free domain name from https://www.freenom.com. I tried it, but within a few weeks without any notification they just took the domain away from me and when I tried to register it again it had a price. You can buy a hostname for a few Euro's a year (for example from https://www.strato.nl/domeinnaam).

After installing Certbot and having redirected port 80 (http) from your modem to your computer, you can simply press:

certbot certonly --standalone --preferred-challenges http -d myhostname

See https://devpress.csdn.net/linux/62e7999e907d7d59d1c8cfd0.html.

After using Certbot I found the Private key in /etc/letsencrypt/live/myhostname/privkey.pem and the full chain in /etc/letsencrypt/live/myhostname/fullchain.pem. "myhostname" is the hostname I used.

If you have received the key files from an SSL authority, you have to give them to Juggluco. The private key can be read in by pressing "Private Key", the Full Chain by pressing "Full Chain".

If you just want to send glucose values from one Android to the other, you can better use Juggluco's mirror function (Left middle menu->Mirror).

You need SSL for the Android apps AAPS, Diabetes:M, Nightwatch and Checkmate, Sugarmate (MacOS and IOS) and Xdrip4ios, Shuggah and Cockpit (IOS). Specify as Nightscout server URL:

https://hostname:port

hostname is the host name of the authenticated key you have given to Juggluco, port is the port you forwarded to the port you specified in this screen (default: 17581).

AAPS can be used with Juggluco 7.3.0 and higher. For this you need to select NSClientV3 in AAPS, with the following settings:

Inserting amounts before earlier entered amounts, makes that AAPS will have duplicate treatments. This also happens when the v3 interface is used with a Nightscout server that receives v3 uploads from Juggluco.

Sometimes AAPS only starts asking the server for treatments after AAPS was force stopped and restarted.

The web server can also be run on a Linux computer. It will receive its data from a mirror connection from Juggluco connected to the sensor: https://www.juggluco.nl/Juggluco/cmdline.

Another phone can connect to this server via a mirror connection or as Nightscout follower (for example on an Iphone). If there is a Nightscout app that doesn't work with this web server, please tell me. Maybe it can be made to work with a few changes. (The IOS apps Nightscout and Nightscout X are specific for one particular Nightscout server program and will not work with Juggluco.)

api_secret: Specify that followers should set the api_secret http header element to this value. This secret also works when the followers use this secret as Nightscout token or use the api-secret header with an SHA1 encoded secret. Starting with Juggluco 7.1.15 it is also possible to make the api_secret the first element of the path of the Nightscout server URL. If xyz is the api_secret and http://hostname:port is the Nightscout server URL, you can specify http://hostname:port/xzy as the Nightscout server URL.

Visible: Make Secret visible.

Port: Specify the network port used to contact the https server. The default is 17581.

Save: Save modifications of Secret or Port.

Use SSL: use SSL (https). For SSL you need to give a Private key and Full chain for the host name used to contact this service.

Private Key: select a file containing the private key. See above.

Full Chain: select a file containing the Full Chain, see above.

Interval: default minimal interval (in seconds) between glucose values. Normally this is 270 seconds. A request can also change this value by supplying the interval= option. See https://www.juggluco.nl/Juggluco/webserver.html

Local only: the http server can only be accessed with localhost (127.0.0.1). This doesn't apply to https.

Give Amounts: make it possible to receive the entered amounts using http://127.0.0.1:17580/api/v1/treatments?count=3. (You have to specify for each label what has to be done with it. Previously this was the same as for Libreview, after version 4.18.0 you can place the labels in different categories for Libreview and this webserver.) Via this interface xDrip can receive Amounts from Juggluco. In xDrip you can do this in two ways:

  1. Take as "Hardware Data Source", "Nightscout Follower" and giving as “Follow URL”, http://127.0.0.1:17580 and check Download Treatments”.

  2. Take another Hardware Data Source for example Libre (patched app) and turn on Settings->Cloud Upload->Nightscout Sync (REST-API). Enter as Base API URL, http://somekey@127.0.0.1:17580/api/v1/ and turn on "Download treatments". Uploading to Juggluco is impossible, so this only downloads treatments and generates some error messages.

When "Local only" is unchecked, you can also use the home network IP of the phone Juggluco is running on and, when you configure your modem to forward to 17580 of that phone, the external IP of your phone. If you have given Juggluco a Private Key and Full Chain for a hostname by which the phone can be accessed and turned on use SSL, you can also use that hostname and the Port you specified here, using https instead of http.

When you want to upload treatments to Diabetes:M, you can either send Juggluco's data to Libreview and save the data in Libreview with "Download Glucose data" and import this data in Diabetes:M with Data->Import from other sources->Freestyle or get an authenticated Key for the external hostname of you phone and give as Link external source, Nightscout with as URL, https://yourhostname:Port, where yourhostname is the hostname of your phone running Juggluco for which you have received an authenticated key and Port is the port you mentioned here. It doesn't seem to sync automatically, so in Diabetes:M you have to press on Sync yourself.

Active: Web server is running.

For more information about the Nightscout/xDrip webserver commands implemented in Juggluco, see https://www.juggluco.nl/Juggluco/webserver.html