### Start Vagrant Virtual Machine Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/Technical info/local-implementation.rst Use these commands to initiate the Vagrant virtual machine for Nightscout installation. The setup script will install OS and Node packages. ```bash host$ vagrant up ``` ```bash host$ vagrant ssh ``` ```bash vm$ setup.sh ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/Technical info/local-implementation.rst Run this command in the root of the cloned Nightscout repository on a Linux-based system to install necessary Node.js packages. ```bash $ npm install ``` -------------------------------- ### Set Environment Variables for Nightscout Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/Technical info/local-implementation.rst Create a .env file to define environment variables like MONGO_CONNECTION and MONGO_COLLECTION. This example uses a MongoDB connection string and collection name. ```bash echo 'MONGO_CONNECTION=mongodb://sally:sallypass@ds099999.mongolab.com:99999/nightscout' >> my.env ``` ```bash echo 'MONGO_COLLECTION=entries' >> my.env ``` -------------------------------- ### Query Nightscout API endpoints Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/Technical info/api.rst Examples of URL-based queries for retrieving specific CGM and treatment data from a Nightscout instance. ```http http://localhost:1337/api/v1/entries.json?find[sgv]=100 ``` ```http http://localhost:1337/api/v1/count/entries/where?find[dateString][$gte]=2016-09&find[dateString][$lte]=2016-10&find[sgv]=100 ``` ```http http://localhost:1337/api/v1/entries/sgv.json?find[dateString][$gte]=2015-08-28&find[dateString][$lte]=2015-08-30 ``` ```http http://localhost:1337/api/v1/treatments.json?count=1000&find[carbs]=15&find[eventType]=Carb+Correction&find[created_at][$gte]=2015 ``` ```http http://localhost:1337/api/v1/treatments.json?find[insulin][$gte]=2 ``` -------------------------------- ### Get Server Status API Source: https://context7.com/andrew-warrington/documentation/llms.txt Retrieves the current server status including version information, enabled plugins, and configuration settings. ```APIDOC ## GET /api/v1/status.json ### Description Retrieves the current server status including version information, enabled plugins, and configuration settings. ### Method GET ### Endpoint /api/v1/status.json ### Response #### Success Response (200) - **status** (string) - The status of the server (e.g., "ok"). - **name** (string) - The name of the Nightscout instance. - **version** (string) - The version of the Nightscout software. - **serverTime** (string) - The current time on the server (ISO 8601 format). - **apiEnabled** (boolean) - Indicates if the API is enabled. - **careportalEnabled** (boolean) - Indicates if the care portal is enabled. - **settings** (object) - Server configuration settings. - **units** (string) - Glucose measurement units. - **timeFormat** (integer) - Time display format (e.g., 12 or 24 hour). - **theme** (string) - The configured theme. - **alarmTypes** (array) - List of enabled alarm types. #### Response Example ```json { "status": "ok", "name": "nightscout", "version": "14.2.6", "serverTime": "2024-01-01T12:00:00.000Z", "apiEnabled": true, "careportalEnabled": true, "settings": { "units": "mg/dl", "timeFormat": 12, "theme": "default", "alarmTypes": ["simple", "predict"] } } ``` ``` -------------------------------- ### Get Treatment Profiles API Source: https://context7.com/andrew-warrington/documentation/llms.txt Retrieves the treatment profile containing user-specific settings for insulin sensitivity, carb ratios, basal rates, and targets used for calculations. ```APIDOC ## GET /api/v1/profile.json ### Description Retrieves the treatment profile containing user-specific settings for insulin sensitivity, carb ratios, basal rates, and targets used for calculations. ### Method GET ### Endpoint /api/v1/profile.json ### Response #### Success Response (200) - **_id** (string) - Unique identifier for the profile. - **defaultProfile** (string) - The name of the default profile. - **store** (object) - An object containing different profile configurations. - **[ProfileName]** (object) - Specific profile configuration. - **dia** (integer) - Insulin duration in hours. - **carbratio** (array) - Array of objects specifying carb ratios over time. - **time** (string) - Time of day (HH:MM). - **value** (integer) - Carb ratio value. - **sens** (array) - Array of objects specifying insulin sensitivity over time. - **time** (string) - Time of day (HH:MM). - **value** (integer) - Insulin sensitivity value. - **basal** (array) - Array of objects specifying basal rates over time. - **time** (string) - Time of day (HH:MM). - **value** (number) - Basal rate value. - **target_low** (array) - Array of objects specifying low target glucose levels over time. - **time** (string) - Time of day (HH:MM). - **value** (integer) - Target low glucose value. - **target_high** (array) - Array of objects specifying high target glucose levels over time. - **time** (string) - Time of day (HH:MM). - **value** (integer) - Target high glucose value. - **units** (string) - Glucose measurement units (e.g., "mg/dl"). - **timezone** (string) - The configured timezone. #### Response Example ```json [ { "_id": "5f8a1b2c3d4e5f6g7h8i9j0k", "defaultProfile": "Default", "store": { "Default": { "dia": 3, "carbratio": [{"time": "00:00", "value": 10}], "sens": [{"time": "00:00", "value": 50}], "basal": [{"time": "00:00", "value": 0.8}], "target_low": [{"time": "00:00", "value": 80}], "target_high": [{"time": "00:00", "value": 120}], "units": "mg/dl", "timezone": "America/New_York" } } } ] ``` ``` -------------------------------- ### IFTTT Maker Event: ns-allclear Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst This event is triggered when an alarm is acknowledged or when the server starts without any active alarms. It can be used for actions like turning a status light green. ```text ns-allclear ``` -------------------------------- ### Configure IOB and COB Plugins Source: https://context7.com/andrew-warrington/documentation/llms.txt Settings for Insulin-on-Board and Carbs-on-Board calculations. ```bash # Enable IOB and COB plugins ENABLE="iob cob" # IOB uses 'dia' and 'sens' from treatment profile # COB uses 'carbs_hr', 'carbratio', and 'sens' from treatment profile # Treatment profile example (set via Profile Editor or API): # { # "dia": 3, # Duration of insulin action (hours) # "carbs_hr": 20, # Carbs absorbed per hour # "carbratio": 10, # Grams of carbs per unit of insulin # "sens": 50, # mg/dl drop per unit of insulin # "target_low": 80, # "target_high": 120 # } ``` -------------------------------- ### Configure Browser Display Settings Source: https://context7.com/andrew-warrington/documentation/llms.txt Environment variables to customize the web interface appearance, language, and visualization plugins. ```bash # Time format TIME_FORMAT="12" # Options: "12" or "24" # Night mode NIGHT_MODE="off" # Options: "on" or "off" # Custom site title CUSTOM_TITLE="My Nightscout" # Theme selection THEME="colors" # Options: "default", "colors", "colorblindfriendly" # Language setting LANGUAGE="en" # Supported: en, de, es, fr, it, nl, pl, pt, ru, sv, zh_cn, zh_tw, etc. # Chart scale SCALE_Y="log" # Options: "log", "linear", "log-dynamic" # Forecast display SHOW_FORECAST="ar2 openaps" # Space-delimited plugin forecasts to show # Plugins to show visualizations for SHOW_PLUGINS="iob cob bwp cage sage basal" ``` -------------------------------- ### Get CGM Entries API Source: https://context7.com/andrew-warrington/documentation/llms.txt Retrieves continuous glucose monitor (CGM) readings from the database. Supports filtering by specific glucose values and date ranges. ```APIDOC ## GET /api/v1/entries.json ### Description Retrieves continuous glucose monitor readings from the database. The API returns SGV (sensor glucose value) data along with trend direction and timestamp information. By default, results are limited to the 10 most recent values from the last 2 days. ### Method GET ### Endpoint /api/v1/entries.json ### Query Parameters - **find[sgv]** (integer) - Optional - Filters entries by a specific glucose value. - **find[dateString][\$gte]** (string) - Optional - Filters entries with a date greater than or equal to the specified date (YYYY-MM-DD). - **find[dateString][\$lte]** (string) - Optional - Filters entries with a date less than or equal to the specified date (YYYY-MM-DD). ### Request Example ```bash curl "https://YOUR-SITE.herokuapp.com/api/v1/entries.json" curl "https://YOUR-SITE.herokuapp.com/api/v1/entries.json?find[sgv]=100" curl "https://YOUR-SITE.herokuapp.com/api/v1/entries/sgv.json?find[dateString][\$gte]=2024-01-01&find[dateString][\$lte]=2024-01-31" ``` ### Response #### Success Response (200) - **_id** (string) - Unique identifier for the entry. - **sgv** (integer) - Sensor glucose value. - **date** (integer) - Timestamp of the reading in milliseconds. - **dateString** (string) - Timestamp of the reading in ISO 8601 format. - **trend** (integer) - Trend indicator. - **direction** (string) - Direction of glucose trend. - **device** (string) - The device that reported the reading. - **type** (string) - Type of data, typically "sgv". #### Response Example ```json [ { "_id": "5f8a1b2c3d4e5f6g7h8i9j0k", "sgv": 120, "date": 1609459200000, "dateString": "2024-01-01T12:00:00.000Z", "trend": 4, "direction": "Flat", "device": "share2", "type": "sgv" } ] ``` ``` -------------------------------- ### Configure Pushover Integration Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the Pushover plugin for sending push notifications. Provide API credentials and optional separate keys for alarms and announcements. ```bash # Enable Pushover plugin ENABLE="pushover" # Pushover API credentials PUSHOVER_API_TOKEN="your-pushover-application-token" PUSHOVER_USER_KEY="your-pushover-user-key" # Optional: Separate key for alarms (level > WARN) PUSHOVER_ALARM_KEY="alarm-recipient-user-key" # Optional: Separate key for announcements PUSHOVER_ANNOUNCEMENT_KEY="announcement-recipient-user-key" # Required for callbacks BASE_URL="https://your-nightscout-site.herokuapp.com" API_SECRET="your-api-secret" # Disable specific notification types # PUSHOVER_USER_KEY="off" # Disable info notifications # PUSHOVER_ALARM_KEY="off" # Disable alarm pushes # PUSHOVER_ANNOUNCEMENT_KEY="off" # Disable announcement pushes ``` -------------------------------- ### Configure OpenAPS Plugin Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the OpenAPS plugin for closed-loop system monitoring. Set alert thresholds and display fields for relevant data. ```bash # Enable OpenAPS plugin ENABLE="openaps" # Required for OpenAPS plugin DEVICESTATUS_ADVANCED="true" # Enable loop alerts OPENAPS_ENABLE_ALERTS="true" # Alert thresholds (minutes since last loop) OPENAPS_WARN="30" OPENAPS_URGENT="60" # Display fields OPENAPS_FIELDS="status-symbol status-label iob meal-assist rssi freq" OPENAPS_RETRO_FIELDS="status-symbol status-label iob meal-assist rssi" # Show OpenAPS predictions SHOW_FORECAST="ar2 openaps" ``` -------------------------------- ### Retrieve Treatment Profiles Source: https://context7.com/andrew-warrington/documentation/llms.txt Access user-specific settings such as insulin sensitivity, carb ratios, and basal rates. ```bash # Get treatment profiles curl "https://YOUR-SITE.herokuapp.com/api/v1/profile.json" ``` -------------------------------- ### Configure Pump Monitoring Source: https://context7.com/andrew-warrington/documentation/llms.txt Settings for monitoring insulin pump status, reservoir levels, and battery alerts. ```bash # Enable pump monitoring ENABLE="pump" # Required for pump plugin DEVICESTATUS_ADVANCED="true" # Enable pump alerts PUMP_ENABLE_ALERTS="true" PUMP_WARN_ON_SUSPEND="true" # Display fields PUMP_FIELDS="reservoir battery clock status device" PUMP_RETRO_FIELDS="reservoir battery clock" # Pump clock warnings PUMP_WARN_CLOCK="30" # Minutes before warning PUMP_URGENT_CLOCK="60" # Minutes before urgent # Reservoir warnings (units) PUMP_WARN_RES="10" PUMP_URGENT_RES="5" # Battery warnings (percent) PUMP_WARN_BATT_P="30" PUMP_URGENT_BATT_P="20" # Battery warnings (voltage, if percent unavailable) PUMP_WARN_BATT_V="1.35" PUMP_URGENT_BATT_V="1.30" ``` -------------------------------- ### Get Treatments API Source: https://context7.com/andrew-warrington/documentation/llms.txt Retrieves treatment data including insulin boluses, carbohydrate entries, and other care portal events. Supports filtering by event type, insulin amounts, carbs, and date ranges. ```APIDOC ## GET /api/v1/treatments.json ### Description Retrieves treatment data including insulin boluses, carbohydrate entries, and other care portal events. Supports filtering by event type, insulin amounts, carbs, and date ranges. ### Method GET ### Endpoint /api/v1/treatments.json ### Query Parameters - **count** (integer) - Optional - The maximum number of treatments to return. - **find[insulin][\$gte]** (number) - Optional - Filters treatments with insulin units greater than or equal to the specified value. - **find[carbs]** (integer) - Optional - Filters treatments by a specific carb amount. - **find[eventType]** (string) - Optional - Filters treatments by event type (e.g., "Carb Correction", "Meal Bolus"). - **find[created_at][\$gte]** (string) - Optional - Filters treatments created on or after the specified date (YYYY). ### Request Example ```bash curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json" curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json?find[insulin][\$gte]=2" curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json?count=1000&find[carbs]=15&find[eventType]=Carb+Correction&find[created_at][\$gte]=2024" ``` ### Response #### Success Response (200) - **_id** (string) - Unique identifier for the treatment. - **eventType** (string) - The type of treatment event. - **insulin** (number) - Amount of insulin administered. - **carbs** (integer) - Amount of carbohydrates consumed. - **created_at** (string) - Timestamp when the treatment was recorded (ISO 8601 format). - **enteredBy** (string) - The source that entered the treatment data. #### Response Example ```json [ { "_id": "5f8a1b2c3d4e5f6g7h8i9j0k", "eventType": "Meal Bolus", "insulin": 4.5, "carbs": 45, "created_at": "2024-01-01T12:00:00.000Z", "enteredBy": "careportal" } ] ``` ``` -------------------------------- ### Retrieve Server Status Source: https://context7.com/andrew-warrington/documentation/llms.txt Check the current server version, enabled plugins, and configuration settings. ```bash # Get server status curl "https://YOUR-SITE.herokuapp.com/api/v1/status.json" ``` -------------------------------- ### Access Alternative Display Views Source: https://context7.com/andrew-warrington/documentation/llms.txt Access simplified display views for Nightscout, such as the clock view, for different use cases like wall-mounted displays. ```bash # Simple clock view (grey text on black) https://YOUR-SITE.herokuapp.com/clock.html ``` -------------------------------- ### Run Nightscout with Environment Variables Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/Technical info/local-implementation.rst Execute the Nightscout server using Node.js, applying the environment variables defined in the 'my.env' file and setting a specific port. ```bash $ (eval $(cat my.env | sed 's/^/export /') && PORT=1337 node server.js) ``` -------------------------------- ### Configure Age Trackers Plugins Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure age tracking plugins for cannula, sensor, and insulin. Set notification timings for info, warning, and urgent alerts. ```bash # Enable age tracking plugins ENABLE="cage sage iage" # Cannula Age (CAGE) settings CAGE_ENABLE_ALERTS="true" CAGE_INFO="44" # Hours until info notification CAGE_WARN="48" # Hours until warning CAGE_URGENT="72" # Hours until urgent alarm CAGE_DISPLAY="hours" # Options: "hours" or "days" # Sensor Age (SAGE) settings SAGE_ENABLE_ALERTS="true" SAGE_INFO="144" # Hours until info notification (6 days) SAGE_WARN="164" # Hours until warning SAGE_URGENT="166" # Hours until urgent alarm # Insulin Age (IAGE) settings IAGE_ENABLE_ALERTS="true" IAGE_INFO="44" # Hours until info notification IAGE_WARN="48" # Hours until warning IAGE_URGENT="72" # Hours until urgent alarm ``` -------------------------------- ### Configure ENABLE Environment Variable Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst Add 'maker' to the list of enabled plugins. This is a required step to activate the IFTTT Maker integration. ```bash ENABLE="maker" ``` -------------------------------- ### Server Configuration Source: https://context7.com/andrew-warrington/documentation/llms.txt Environment variables for configuring Nightscout server behavior, alarms, and display settings. ```APIDOC ## Server Configuration ### Required Environment Variables Essential environment variables that must be set for Nightscout to function properly. - **MONGO_CONNECTION** (string) - Required - MongoDB connection string. - **DISPLAY_UNITS** (string) - Optional - Display units for glucose values. Options: "mg/dl" or "mmol". Defaults to "mg/dl". - **BASE_URL** (string) - Required - Base URL for your site. - **API_SECRET** (string) - Required - API secret for write access (minimum 12 characters). - **ENABLE** (string) - Optional - Space-delimited list of plugins to enable. - **DISABLE** (string) - Optional - Space-delimited list of default plugins to disable. - **AUTH_DEFAULT_ROLES** (string) - Optional - Default authentication role. Options: "readable", "denied", "status-only". Defaults to "readable". ### Alarm Configuration Environment variables for configuring blood glucose alarm thresholds and snooze durations. - **ALARM_TYPES** (string) - Optional - Alarm types to use. Options: "simple", "predict". Defaults to "simple predict". - **BG_HIGH** (string) - Optional - Urgent high blood glucose threshold (in mg/dl). - **BG_TARGET_TOP** (string) - Optional - Top of target blood glucose range (in mg/dl). - **BG_TARGET_BOTTOM** (string) - Optional - Bottom of target blood glucose range (in mg/dl). - **BG_LOW** (string) - Optional - Urgent low blood glucose threshold (in mg/dl). - **ALARM_URGENT_HIGH** (string) - Optional - Enable/disable urgent high alarm. Options: "on" or "off". - **ALARM_HIGH** (string) - Optional - Enable/disable high alarm. Options: "on" or "off". - **ALARM_LOW** (string) - Optional - Enable/disable low alarm. Options: "on" or "off". - **ALARM_URGENT_LOW** (string) - Optional - Enable/disable urgent low alarm. Options: "on" or "off". - **ALARM_URGENT_HIGH_MINS** (string) - Optional - Space-delimited list of snooze durations (minutes) for urgent high alarms. - **ALARM_HIGH_MINS** (string) - Optional - Space-delimited list of snooze durations (minutes) for high alarms. - **ALARM_LOW_MINS** (string) - Optional - Space-delimited list of snooze durations (minutes) for low alarms. - **ALARM_URGENT_LOW_MINS** (string) - Optional - Space-delimited list of snooze durations (minutes) for urgent low alarms. - **ALARM_TIMEAGO_WARN** (string) - Optional - Enable/disable stale data warning alarm. Options: "on" or "off". - **ALARM_TIMEAGO_WARN_MINS** (string) - Optional - Warning duration (minutes) for stale data alarm. - **ALARM_TIMEAGO_URGENT** (string) - Optional - Enable/disable stale data urgent alarm. Options: "on" or "off". - **ALARM_TIMEAGO_URGENT_MINS** (string) - Optional - Urgent duration (minutes) for stale data alarm. ### Browser Display Settings Environment variables to customize the default appearance and behavior of the Nightscout web interface. - **TIME_FORMAT** (string) - Optional - Time format. Options: "12" or "24". Defaults to "12". - **NIGHT_MODE** (string) - Optional - Enable night mode. Options: "on" or "off". Defaults to "off". - **CUSTOM_TITLE** (string) - Optional - Custom site title. - **THEME** (string) - Optional - Theme selection. Options: "default", "colors", "colorblindfriendly". Defaults to "colors". - **LANGUAGE** (string) - Optional - Language setting. Supported: en, de, es, fr, it, nl, pl, pt, ru, sv, zh_cn, zh_tw, etc. - **SCALE_Y** (string) - Optional - Chart Y-axis scale. Options: "log", "linear", "log-dynamic". Defaults to "log". - **SHOW_FORECAST** (string) - Optional - Space-delimited plugin forecasts to show. - **SHOW_PLUGINS** (string) - Optional - Space-delimited list of plugins to show visualizations for. ### Plugin Configuration - IOB/COB Configuration for Insulin-on-Board (IOB) and Carbs-on-Board (COB) calculation plugins. - **ENABLE** (string) - Optional - Enable IOB and COB plugins. Example: "iob cob". IOB uses 'dia' and 'sens' from the treatment profile. COB uses 'carbs_hr', 'carbratio', and 'sens' from the treatment profile. ### Plugin Configuration - Pump Monitoring Configuration for monitoring insulin pump status including reservoir levels and battery. - **ENABLE** (string) - Optional - Enable pump monitoring. Example: "pump". - **DEVICESTATUS_ADVANCED** (string) - Optional - Required for pump plugin. Options: "true" or "false". - **PUMP_ENABLE_ALERTS** (string) - Optional - Enable pump alerts. Options: "true" or "false". - **PUMP_WARN_ON_SUSPEND** (string) - Optional - Warn on pump suspend. Options: "true" or "false". - **PUMP_FIELDS** (string) - Optional - Fields to display for pump status. - **PUMP_RETRO_FIELDS** (string) - Optional - Fields to display for retrospective pump status. - **PUMP_WARN_CLOCK** (string) - Optional - Minutes before warning for pump clock. - **PUMP_URGENT_CLOCK** (string) - Optional - Minutes before urgent warning for pump clock. - **PUMP_WARN_RES** (string) - Optional - Reservoir warning threshold (units). - **PUMP_URGENT_RES** (string) - Optional - Urgent reservoir warning threshold (units). - **PUMP_WARN_BATT_P** (string) - Optional - Battery warning threshold (percent). - **PUMP_URGENT_BATT_P** (string) - Optional - Urgent battery warning threshold (percent). - **PUMP_WARN_BATT_V** (string) - Optional - Battery warning threshold (voltage). - **PUMP_URGENT_BATT_V** (string) - Optional - Urgent battery warning threshold (voltage). ``` -------------------------------- ### Configure MAKER_ANNOUNCEMENT_KEY Environment Variable Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst Optionally set a separate Maker key for system-wide user-generated announcements. If not defined, it defaults to MAKER_KEY. This supports a space-delimited list of keys. ```bash MAKER_ANNOUNCEMENT_KEY="your_announcement_key" ``` -------------------------------- ### Configure Server Environment Variables Source: https://context7.com/andrew-warrington/documentation/llms.txt Essential environment variables for Nightscout, including database connections, display units, and plugin management. ```bash # MongoDB connection string (required) MONGO_CONNECTION="mongodb://user:password@hostname:27017/nightscout" # Display units for glucose values DISPLAY_UNITS="mg/dl" # Options: "mg/dl" or "mmol" # Base URL for your site (used for callbacks and links) BASE_URL="https://your-nightscout-site.herokuapp.com" # API secret for write access (minimum 12 characters) API_SECRET="your-secret-passphrase-here" # Enable specific plugins (space-delimited list) ENABLE="careportal rawbg iob cob bwp cage sage iage basal pump openaps loop" # Disable specific default plugins DISABLE="direction upbat" # Default authentication role AUTH_DEFAULT_ROLES="readable" # Options: "readable", "denied", "status-only" ``` -------------------------------- ### Configure Loop Plugin Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the Loop plugin for iOS Loop app monitoring. Set alert thresholds and specify prediction sources. ```bash # Enable Loop plugin ENABLE="loop" # Required for Loop plugin DEVICESTATUS_ADVANCED="true" # Enable loop alerts LOOP_ENABLE_ALERTS="true" # Alert thresholds (minutes since last loop) LOOP_WARN="30" LOOP_URGENT="60" # Show Loop predictions SHOW_FORECAST="ar2 loop" ``` -------------------------------- ### Configure Alarm Thresholds Source: https://context7.com/andrew-warrington/documentation/llms.txt Environment variables for setting blood glucose alarm thresholds and snooze durations. ```bash # Alarm type configuration ALARM_TYPES="simple predict" # Use both simple threshold and predictive alarms # Blood glucose thresholds (always in mg/dl) BG_HIGH="260" # Urgent high threshold BG_TARGET_TOP="180" # Top of target range BG_TARGET_BOTTOM="80" # Bottom of target range BG_LOW="55" # Urgent low threshold # Enable/disable specific alarms ALARM_URGENT_HIGH="on" ALARM_HIGH="on" ALARM_LOW="on" ALARM_URGENT_LOW="on" # Snooze options (space-delimited minutes) ALARM_URGENT_HIGH_MINS="30 60 90 120" ALARM_HIGH_MINS="30 60 90 120" ALARM_LOW_MINS="15 30 45 60" ALARM_URGENT_LOW_MINS="15 30 45" # Stale data alarms ALARM_TIMEAGO_WARN="on" ALARM_TIMEAGO_WARN_MINS="15" ALARM_TIMEAGO_URGENT="on" ALARM_TIMEAGO_URGENT_MINS="30" ``` -------------------------------- ### Configure IFTTT Maker Integration Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the IFTTT Maker plugin for triggering custom automations. Provide your IFTTT Maker secret key and specify event types. ```bash # Enable IFTTT Maker plugin ENABLE="maker" # IFTTT Maker secret key (from https://ifttt.com/maker) MAKER_KEY="your-ifttt-maker-secret-key" # Optional: Separate key for announcements MAKER_ANNOUNCEMENT_KEY="announcement-maker-key" # Events sent to IFTTT (prefixed with 'ns-'): # - ns-event : All alarms and notifications (catch-all) # - ns-allclear : When alarms are acknowledged or server starts clean # - ns-info : Info level notifications # - ns-warning : Warning level alarms # - ns-urgent : Urgent level alarms # Example IFTTT recipe trigger URL: # https://maker.ifttt.com/trigger/ns-urgent/with/key/YOUR_MAKER_KEY ``` -------------------------------- ### Configure Dexcom Share Bridge Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the Dexcom Share bridge plugin to fetch glucose readings directly from Dexcom Share. Set credentials and polling intervals. ```bash # Enable Share bridge plugin ENABLE="bridge" # Dexcom Share credentials BRIDGE_USER_NAME="your-dexcom-share-username" BRIDGE_PASSWORD="your-dexcom-share-password" # Polling settings BRIDGE_INTERVAL="150000" # Milliseconds between updates (2.5 min) BRIDGE_MAX_COUNT="1" # Records to fetch per update BRIDGE_FIRST_FETCH_COUNT="3" # Records on first fetch BRIDGE_MAX_FAILURES="3" # Failures before giving up BRIDGE_MINUTES="1400" # Time window to search (1 day) ``` -------------------------------- ### Configure MAKER_KEY Environment Variable Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst Set your secret IFTTT Maker key. This variable can also accept a space-delimited list of keys for multiple integrations. ```bash MAKER_KEY="abcMyExampleabc123defjt1DeNSiftttmak-XQb69p" ``` -------------------------------- ### Retrieve Treatment Data Source: https://context7.com/andrew-warrington/documentation/llms.txt Fetch insulin boluses, carbohydrate entries, and care portal events with optional filtering. ```bash # Get recent treatments curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json" # Get treatments with more than 2 units of insulin curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json?find[insulin][\$gte]=2" # Get carb corrections of 15g in 2024 curl "https://YOUR-SITE.herokuapp.com/api/v1/treatments.json?count=1000&find[carbs]=15&find[eventType]=Carb+Correction&find[created_at][\$gte]=2024" ``` -------------------------------- ### Retrieve CGM Entries Source: https://context7.com/andrew-warrington/documentation/llms.txt Use these commands to fetch sensor glucose values, filter by specific values, or query within date ranges. ```bash # Get the latest CGM entries curl "https://YOUR-SITE.herokuapp.com/api/v1/entries.json" # Get entries with specific glucose value curl "https://YOUR-SITE.herokuapp.com/api/v1/entries.json?find[sgv]=100" # Get entries between two dates curl "https://YOUR-SITE.herokuapp.com/api/v1/entries/sgv.json?find[dateString][\$gte]=2024-01-01&find[dateString][\$lte]=2024-01-31" # Get count of readings in a specific range for a month curl "https://YOUR-SITE.herokuapp.com/api/v1/count/entries/where?find[dateString][\$gte]=2024-01&find[dateString][\$lte]=2024-02&find[sgv]=100" ``` -------------------------------- ### Configure MiniMed Connect Bridge Source: https://context7.com/andrew-warrington/documentation/llms.txt Enable and configure the MiniMed Connect bridge plugin to fetch glucose readings from Medtronic CareLink. Set credentials, polling intervals, and debug options. ```bash # Enable MiniMed Connect plugin ENABLE="mmconnect" # CareLink credentials MMCONNECT_USER_NAME="your-carelink-username" MMCONNECT_PASSWORD="your-carelink-password" # Polling settings MMCONNECT_INTERVAL="60000" # Milliseconds between updates (1 min) MMCONNECT_MAX_RETRY_DURATION="32" # Seconds to retry failed requests MMCONNECT_SGV_LIMIT="24" # Max SGV values per request # Debug options MMCONNECT_VERBOSE="true" # Log CareLink requests MMCONNECT_STORE_RAW_DATA="true" # Store raw CareLink data ``` -------------------------------- ### Post Treatment Records via API Source: https://context7.com/andrew-warrington/documentation/llms.txt Use these cURL commands to post meal bolus or site change events to the Nightscout API. Ensure the api-secret is provided as a SHA1 hash. ```bash # Post a meal bolus treatment curl -X POST "https://YOUR-SITE.herokuapp.com/api/v1/treatments" \ -H "Content-Type: application/json" \ -H "api-secret: YOUR_API_SECRET_SHA1_HASH" \ -d '{ "eventType": "Meal Bolus", "insulin": 4.5, "carbs": 45, "created_at": "2024-01-01T12:00:00.000Z", "enteredBy": "api" }' # Post a site change event curl -X POST "https://YOUR-SITE.herokuapp.com/api/v1/treatments" \ -H "Content-Type: application/json" \ -H "api-secret: YOUR_API_SECRET_SHA1_HASH" \ -d '{ "eventType": "Site Change", "created_at": "2024-01-01T12:00:00.000Z", "enteredBy": "api", "notes": "Changed infusion set" }' ``` -------------------------------- ### IFTTT Maker Event: ns-event Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst This is a catch-all event sent to the IFTTT Maker service for all alarms and notifications, useful for general logging. ```text ns-event ``` -------------------------------- ### Post New CGM Entry Source: https://context7.com/andrew-warrington/documentation/llms.txt Submit new glucose data to the database. This operation requires an API_SECRET header for authentication. ```bash # Post a new SGV entry with API secret authentication curl -X POST "https://YOUR-SITE.herokuapp.com/api/v1/entries" \ -H "Content-Type: application/json" \ -H "api-secret: YOUR_API_SECRET_SHA1_HASH" \ -d '[{ "sgv": 120, "date": 1704110400000, "dateString": "2024-01-01T12:00:00.000Z", "trend": 4, "direction": "Flat", "device": "xdrip", "type": "sgv" }]' ``` -------------------------------- ### IFTTT Maker Event: ns-info Source: https://github.com/andrew-warrington/documentation/blob/master/Nightscout/EN/3rd party integration/IFTTT.rst This event is triggered for notifications at the info level, in addition to the general 'ns-event'. ```text ns-info ``` -------------------------------- ### Post New Entry (Authenticated) API Source: https://context7.com/andrew-warrington/documentation/llms.txt Posts new CGM entries to the database. Requires API_SECRET authentication via the api-secret header. ```APIDOC ## POST /api/v1/entries ### Description Posts new CGM entries to the database. Requires API_SECRET authentication via the api-secret header. ### Method POST ### Endpoint /api/v1/entries ### Headers - **Content-Type**: application/json - **api-secret**: YOUR_API_SECRET_SHA1_HASH ### Request Body - **[Array of Entry Objects]** (array) - Required - An array containing one or more entry objects to be posted. - **sgv** (integer) - Required - Sensor glucose value. - **date** (integer) - Required - Timestamp of the reading in milliseconds. - **dateString** (string) - Required - Timestamp of the reading in ISO 8601 format. - **trend** (integer) - Optional - Trend indicator. - **direction** (string) - Optional - Direction of glucose trend. - **device** (string) - Optional - The device that reported the reading. - **type** (string) - Optional - Type of data, typically "sgv". ### Request Example ```bash curl -X POST "https://YOUR-SITE.herokuapp.com/api/v1/entries" \ -H "Content-Type: application/json" \ -H "api-secret: YOUR_API_SECRET_SHA1_HASH" \ -d '[{ "sgv": 120, "date": 1704110400000, "dateString": "2024-01-01T12:00:00.000Z", "trend": 4, "direction": "Flat", "device": "xdrip", "type": "sgv" }]' ``` ### Response #### Success Response (200) Typically returns an empty response or a success message upon successful posting of entries. ```