Web server

Juggluco contains a web server. You can turn it on with Left menu->Settings->Web server. Via the web server other programs can make use of the data in Juggluco. In the following is used for the hostname or IP of the web server. In this way you can try out the commands by opening this web page on the same phone where Juggluco is running. If you unset "Local only" in Left menu->Settings -> Web server, you can also use it from other hosts on your home network by replacing with the IP of the phone. If Use SSL is set, you can replace with https://ahostname:aport. Whereby "ahostname" is the hostname associated with the SSL certificate and "aport" is the port that your modem redirects to "SSL Port" (set in left menu->Settings->Web server) of your phone. You can also use this page when using something different from "": If you add ?urlstart=aurl in all these examples is replaced with aurl.  For example you can use https://www.juggluco.nl/Juggluco/webserver.html?urlstart= in which case is replaced with (It works only when you click on a link, not when you open a link in a different tab or window). You can also append the api_secret, for example: https://www.juggluco.nl/Juggluco/webserver.html?urlstart= whereby somethingsecret is the api_secret.

Instead of Juggluco on a phone, you can also use Juggluco server. Android or WearOS apps can, instead of making use of the web server, also receive a broadcast every time a new glucose value is received from the sensor.

Juggluco export web server

Starting with Juggluco 7.1.0 exactly the same data as can be exported in Juggluco with Left middle menu->Export, can also be assessed with via the web interface.






After one of the above commands you can place '?' followed by a list of the following options separated by '&".





Place a header with the meaning of each column above the columns.


Give glucose in mg/dL

The default unit is dependent on the unit settings of Juggluco or Juggluco server.


Give glucose in mmol/L


Specify for how many days data should be returned.


The duration of data in seconds. Multiple days and duration specifications are added. When the total duration is zero, it defaults to 5 hours.


Start time in Unix time (seconds since 00:00 1 January 1970 GMT).


End time in Unix time (seconds since 00:00 1 January 1970 GMT).


Other way to specify the start time for testing purposes. The time is in local time (Nightscout uses GMT).


Specify end time.


Truncates output to the specified number of items.


The Nightscout token used for Nightscout commands, can also be used for the Juggluco's export commands. In other Nightscout servers, Nightscout token is different from api_secret, but in the Nightscout server in Juggluco they are the same.

api_secret and api-secret also work with all commands that use the web server in Juggluco. They are http header elements. api_secret is plain text, api-secret is SHA1 encoded. Examples:

api_secret: xyx

api-secret: 3c4bc8e59079403cb17a03a19c889769faadfdc8

Juggluco 7.1.15 has added a third method to supply the api_secret. You can add the api_secret after the hostname and port. This has the advantage that you can also add an api_secret to app that themselves don’t have the possibility to supply an api_secret or token. This is meant to be used with Nightscout clients. So you can give as Nightscout Follow URL instead of when xyz is the api_secret.

The data contains the following columns:

Column header


Used with:


Sensor identifier

Sensor only


Number starting with 1 for the first data item of a particular sensor or data source and incremented with each new item.



Time in number of seconds since 00:00 1 January 1970 GMT



Local time split into its component parts. mm= month, MM= Minute.



Time zone in number of hours from GMT



Number of minutes since the start of the sensor.

sensor only

mmol/L or mg/dL

Glucose value. If the url doesn't contain mmol/L or mg/dL, is the unit dependent on the unit setting of Juggluco.

sensor only


Rate of change.

sensor only


Label for rate of change

sensor only


0 for Amounts entered in Juggluco, 1 for Kerfstok.

amounts only


Value of amount

amounts only


Label for amount

amounts only

The meaning of rate of change:



Arrow in Abbott app:



Between -2 and -1


-1 to 1


1 to 2






Meals can easily be imported into R, Python and Mathematica. The footer of each meal contains also the unix time (seconds since 1 january 1970 00:00 GMT) after the date in local time.



[1] "2023-12-29 13:12"
> tail(meal1[[1]]$Quantity,n=1)
[1] 1703851920
> as.POSIXct(tail(meal1[[1]]$Quantity,n=1), origin="1970-01-01")
[1] "2023-12-29 13:12:00 CET"


import pandas as pd
from datetime import datetime

2023-12-29 13:12:00
2023-12-29 13:12


xDrip / Nightscout web server

Some existing apps make use of a xDrip or Nightscout web interface.


Juggluco incorporates an xDrip web server. This way you can receive glucose values via on the devices running Juggluco. Turn the server on in Juggluco under left menu->watch->web server.

Juggluco recognizes the following xDrip server options:


Give nr values, instead of 24.

For example to receive 10 values use:


Display less information. For example:


Give sensor start date and age. For example:


If necessary also displays values of previous sensors.


Displays nothing instead of [] when no data is available.

Juggluco added the following option:


interval gives the minimal number of seconds between values. If not specified, it is set to 270 seconds (4.5 minutes) to keep in line with xDrip. This means that if multiple values are given they are spaced at least 270 seconds apart (the first is always the most recent value). If you like to receive values spaced more closely in time, you can specify a smaller number.

for example:

To receive 100 glucose values spaced 90 seconds apart. In reality this will be around 2 minutes apart.

Another possibility could be to round values instead of skipping them. But averaging the last values makes the measurement older. If the last value is the average of the last 5 values, the average of its age will be 2 to 3 minutes. Because the measurement location is already physiologically distance from the blood, there is more to say for extrapolating instead of averaging the values. Thus, if you have for the last 5 minutes 10,9,8,7 and 6 mmol/L you should return 5 mmol/L instead of 7.6 mmol/L.


Juggluco only implements Nightscout used by apps contacting Nightscout; it has not the intent to implements commands used by no one and full-filling no other purpose than what other commands already do.

Nightscout commands implemented in Juggluco:

You can receive the same results as with, but with time in GMT instead of server local time, also with: and

In csv format:

In tsv format: or or

For only the last value in tsv format, you can use

You can receive the amounts from Juggluco with:

In addition to count, you have also the following options:


give results after datemsec, where datemsec is the number of milli seconds since 00:00 1 January 1970 GMT For example:[date][$gt]=1679266800000


gives results at or after datemsec


give results before datemsec, where datemsec are the number of milli seconds since 00:00 1 January 1970 GMT For example:[date][$lt]=1679266800000


gives results at or before datemsec

By using dateString or created_at instead of date, you can use a date in the format YYYY-mm-DDThh:MM:ss, were mm is the month and MM the minutes. For example[dateString][$lt]=2023-03-02T08:04:01


See the Juggluco export web server options above.


Made for a 2013 watch, some apps still use the following command:

It contains the following information:

now: current time in milliseconds since 1 January 1970 00:00 GMT.

sgv: current glucose value in the unit of the server. For Libre sensor you can determine the unit by using the knowledge that the value of mg/dL is in the range 39-501 mg/dL and of mmol/L in the range 2.2-27.8 mmol/L.

Table 1: Meaning of trend and direction in pebble results


Rate of change


DexCom arrow

Abbott arrow







[2, 3.5)



[1, 2)



(-1, 1)



(-2, -1]



(-3.5, -2]





Rate of change is the Rate returned when exporting stream and scans in Juggluco (for example:


datetime: time of glucose value in milliseconds since 1 january 1970 00:00 GMT.

iob: Insulin on board (since Juggluco 7.1.10). Measure of how much insulin of previous rapid insulin injections is still present in the body. pebble is the only command that returns this measure. has the following options:

units=mmol: give glucose values in mmol/L instead of the server units  e.g.

units=mg: give glucose values in mg instead of server units. e.g.

count= specify the number of glucose values to return. e.g.

To used this web interface with SSL, you give Juggluco an SSL key as described in Left menu->Settings->Web server->Help.

Juggluco server

This web interface is also put in a standalone version of the network connectivity of Juggluco: see https://www.juggluco.nl/Juggluco/cmdline

In the same way as the other options, you can also turn on the eXport/xDrip/Nightscout web server. For local only usage, you do

./juggluco -x

You can see the current settings with

./juggluco -l



eXport web server turned on (port 17580)

http only over localhost


If you want to access from other hosts, you need to use capital X:

./juggluco -X

./juggluco -l now shows:

eXport web server turned on (port 17580)

can also be used remotely over http

With -e you can enable SSL encryption.

The http web server always uses port 17580, because xDrip watch apps can only be used with this port number. The SSL version is accessed by the port specified with -o

./juggluco -e -o 9191

says to enable the SSL (https) version and to use port 9191.

The mirror port, the http and the https port all need to be different.

./juggluco -l now shows:

Use SSL, sslport=9191

You can configure an api-secret with -g "an api-secret", for example you can use

./juggluco -g Xsa%sLF8

To set the api-secret to "Xsa%sLF8"

When you also enable https, this gives a kind of access restriction so that only people who know the api-secret can see your data. See api-secret.

As with the web server in the Juggluco app, you can also give treatments via the Nightscout web protocol. You also have to specify for each label what should be done with it. If juggluco server has received "Amounts", you can see the available labels with ./juggluco -l, for example:

eXport web server turned on (port 17580)
can also be used remotely over http
Use SSL, sslport=9191
0: Aspart      Not set
1: Carbohydra  Not set
2: Dextro      Not set
3: Levemir     Not set
4: Bike        Not set
5: Walk        Not set
6: Blood       Not set
7: bad         Not set
api/v1/treatments turned off

For each label numbered 0 to 7, you have to say what it is.

The following code is used for that:

R: Rapid acting Insulin

L: Long acting Insulin

C: Carbohydate

O: cOmments

D: Don't send

You assign a label to a category, by using '-' followed by the number of the label followed by the letter for the category.

To assign Aspart to Rapid acting Insulin you use -0R : Aspart is label number 0 and R means "Rapid acting Insulin". To assign all labels you can use:

./juggluco -0R -1C -2C -3L -4O -5O -6O -7D

labels 0 is R, 1 and 2 are C (Carbohydrate) and 4, 5 and 6 are O (cOmments) and 7 is not sent.


./juggluco -l shows:

eXport web server turned on (port 17580)
can also be used remotely over http
Use SSL, sslport=9191
0: Aspart      Rapid acting insulin
1: Carbohydra  Carbohydrate
2: Dextro      Carbohydrate
3: Levemir     Long acting insulin
4: Bike        Comments
5: Walk        Comments
6: Blood       Comments
7: bad         Don't send
api/v1/treatments turned off

Now it still doesn't give treatments. You first have to turn it on with -t

./juggluco -t

./juggluco -l now shows:

Saving in directory jugglucodata
eXport web server turned on (port 17580)
can also be used remotely over http
Use SSL, sslport=9191
0: Aspart      Rapid acting insulin
1: Carbohydra  Carbohydrate
2: Dextro      Carbohydrate
3: Levemir     Long acting insulin
4: Bike        Comments
5: Walk        Comments
6: Blood       Comments
7: bad         Don't send
api/v1/treatments turned on
api_secret: Xsa%sLF8

Mirror port 9113
unit: mg/dL


To make use of SSL, you need to give Juggluco server a SSL certificate for the hostname by which the server is accessed. How you can get an SSL key is described in the help under Left menu->Settings->Webserver and in the README in the source of Juggluco server. For Juggluco server, you need to put the the private key in a file named prevkey.pem and the fullchain in a file named fullchain.pem in jugglucodata. jugglucodata is the directory were Juggluco server saves its data:

ls -l jugglucodata/
total 136
-rwxr-xr-x   1 juggluco juggluco   8064 18 nov 20:36 backup.dat
-rwxr-xr-x   1 juggluco juggluco   4716  8 nov 13:12 fullchain.pem
drwxr-xr-x   2 juggluco juggluco   4096 12 jan  2023 logs
-rwxr-xr-x   1 juggluco juggluco 253952 18 nov 20:00 meals.dat
drwxr-xr-x   4 juggluco juggluco   4096 12 jan  2023 nums
-rw-r--r--   1 juggluco juggluco   1702  8 nov 13:12 privkey.pem
drwxr-xr-x 104 juggluco juggluco   4096 18 nov 12:36 sensors
-rwxr-xr-x   1 juggluco juggluco  22032 18 nov 17:49 settings.dat